Interview Question : What is Thread?

Quad Core processor and Threads Winged Post

A thread is a single sequential flow of control within a program. the threads of a computer program allows the program to execute sequential actions or many actions at once. Each thread in a program identifies a process that runs when the program asks it to.

The term “Thread” can also be defined as

  1. a smallest unit of processing that can be scheduled by an Operating System.
  2. a portion of code that may be executed independently of the main program.
  3. an ordered sequence of instructions that tells the computer what to do
  4. In online discussion, a thread can refer to a series of related messages.
  5. In e-mail, a thread can refer to a series of replies back and forth pertaining a certain message.

Extended Information:

All programmers are familiar with writing sequential programs. You’ve probably written a program that displays “Hello World!” or sorts a list of names or computes a list of prime numbers. These are sequential programs. That is, each has a beginning, an execution sequence, and an end. At any given time during the runtime of the program, there is a single point of execution.

A thread is similar to the sequential programs described above. A single thread also has a beginning, a sequence, and an end. At any given time during the runtime of the thread, there is a single point of execution. However, a thread itself is not a program; a thread cannot run on its own. Rather, it runs within a program.

Some texts call a thread, a lightweight process. A thread is similar to a real process in that both have a single sequential flow of control. However, a thread is considered lightweight because it runs within the context of a full-blown program and takes advantage of the resources allocated for that program and the program’s environment.

Multiple threads can exists within the same process and share resources such as memory, while different processes do not share these resources.


Source / Courtesy : WiseGeek

Interview Question : What is Object Oriented Programming?

Object Oriented Programming Languages - Winged Post

Object Oriented Programming (OOP) is a type of programming in which programmers define not only the data type of a data structure, but also the types of operations (functions) that can be applied to the data structure. In this way, the data structure becomes an object that includes both data and functions. In addition, programmers can create relationships between one object and another. For example, objects can inherit characteristics from other objects.

The Object Oriented Programming can also be defined as:

1. A style of programming that focuses on using objects to design and build applications.

2. Object oriented programming (OOP) is a model of programming language that focuses on the use of objects instead of actions in order to carry out tasks. This involves taking an approach that is more mindful of data and less concerned with logic, which is more commonly the case in other programming paradigms.

3. Object-oriented programming (OOP) is a programming paradigm based on the concept of “objects”, which are data structures that contain data, in the form of fields, often known as attributes; and code, in the form of procedures, often known as methods.


For your information, the following are some additional concepts associated with the Object Oriented Programming:

  1. Encapsulation means that a group of related properties, methods, and other members are treated as a single unit or object.
  2. Inheritance describes the ability to create new classes based on an existing class.
  3. Polymorphism means that you can have multiple classes that can be used interchangeably, even though each class implements the same properties or methods in different ways.


Interview Question : Define Array.

multi dimentional array data structure Winged Post

Array is a data structure consisting of a collection of elements (values or variables), each identified by at least one array index or key. An array is stored so that the position of each element can be computed from its index tuple by a mathematical formula. The simplest type of data structure is a linear array, also called one-dimensional array.  We can also define a array as a container object which holds a fixed number of values of a single data type.

array data structure Winged Post

Arrays are among the oldest and most important data structures, and are used by almost every program. They are also used to implement many other data structures, such as lists and strings. They effectively exploit the addressing logic of computers. In most modern computers and many external storage devices, the memory is a one-dimensional array of words, whose indices are their addresses. Processors, especially vector processors, are often optimized for array operations.

Arrays are useful mostly because the element indices can be computed at run time. Among other things, this feature allows a single iterative statement to process arbitrarily many elements of an array. For that reason, the elements of an array data structure are required to have the same size and should use the same data representation.

The following are also the definitions of array in the area other than computer programming:

  • In general, an array is a number of items arranged in some specified way – for example, in a list or in a three-dimensional table.
  • In random access memory (RAM), an array is the arrangement of memory cells.
  • In data storage, an array (disk array) is a method for storing information on multiple devices. A disk array is a hardware element that contains a large group of hard disk drives (HDDs).

Simple… Put the Glass Down


glass of water - Winged Post

A Professor began his class by holding up a glass with some water in it. He held it up for all to see and asked the students, “How much do you think this glass weighs?”

“50g!” ….”100g!” ….. “125g!” … the students answered.

“I really don’t know unless I weigh it,” said the professor, “but, my question is: What would happen if I held it up like this for a few minutes?”

“Nothing” … the students said.

“Okay what would happen if I held it up like this for an hour?” the professor asked.

“Your arm would begin to ache,” said one of the student.

“You’re right, now what would happen if I held it for a day?”

“Your arm could go numb, you might have severe muscle stress and paralysis and have to go to hospital for sure!” ventured another student and all the students laughed …

“Very good, But during all this, did the weight of the glass change?” asked the professor.

“No” was the answer.

“Then what caused the arm ache and the muscle stress?”

The students were puzzled.

“What should I do now to come out of pain?” asked professor again.

“Put the glass down!” said one of the students.

“Exactly!” said the professor.

Life’s problems are something like this. Hold it for a few minutes in your head and they seem OK.

Think of them for a long time and they begin to ache.

Hold it even longer and they begin to paralyze you.

You will not be able to do anything.

It’s important to think of the challenges or problems in your life, but even more important is to

“PUT THEM DOWN” at the end of every day before you go to sleep.

That way, you are not stressed, you wake up every day fresh and strong and can handle any issue, any challenge that comes your way!

So, when your day ends today, just remember to put the glass down…


Story Source:

The above post is reprinted from materials provided by Jesus Daily. Note: Materials may be edited for content and length.

Interview Question: Difference between LinkedList vs ArrayList in Java?


LinkedList and ArrayList both implement List Interface but how they work internally is where the differences lies. Main difference between ArrayList and LinkedList is that ArrayList is implemented using re-sizable array while LinkedList is implemented using doubly LinkedList. ArrayList is more popular among Java programmer than LinkedList as there are few scenarios on which LinkedList is a suitable collection than ArrayList. In this article we will see some differences between LinkedList and ArrayList and try to find out when and where to use LinkedList over ArrayList.

difference between arraylist and linkedlist - WingedPostThe Differences:

  1. Since Array is an index based data-structure searching or getting element from Array with index is pretty fast. Array provides O(1) performance for get(index) method but remove is costly in ArrayList as you need to rearrange all elements. On the Other hand LinkedList doesn’t provide Random or index based access and you need to iterate over linked list to retrieve any element which is of order O(n).
  2. Insertions  are easy and fast in LinkedList as compared to ArrayList because there is no risk of resizing array and copying content to new array if array gets full which makes adding into ArrayList of O(n) in worst case, while adding is O(1) operation in LinkedList in Java. ArrayList also needs to update its index if you insert something anywhere except at the end of array.
  3. Removal is like insertions better in LinkedList than ArrayList.
  4. LinkedList has more memory overhead than ArrayList because in ArrayList each index only holds actual object (data) but in case of LinkedList each node holds both data and address of next  and previous node.


From mountains to moons: discoveries from Pluto mission

New close-up images of a region near Pluto's equator reveal a giant surprise -- a range of youthful mountains rising as high as 11,000 feet (3,500 meters) above the surface of the icy body. Credit: NASA/JHU APL/SwRI
New close-up images of a region near Pluto’s equator reveal a giant surprise — a range of youthful mountains rising as high as 11,000 feet (3,500 meters) above the surface of the icy body.

Icy mountains on Pluto and a new, crisp view of its largest moon, Charon, are among the several discoveries announced Wednesday by the NASA’s New Horizons team, just one day after the spacecraft’s first ever Pluto flyby.

“Pluto New Horizons is a true mission of exploration showing us why basic scientific research is so important,” said John Grunsfeld, associate administrator for NASA’s Science Mission Directorate in Washington. “The mission has had nine years to build expectations about what we would see during closest approach to Pluto and Charon. Today, we get the first sampling of the scientific treasure collected during those critical moments, and I can tell you it dramatically surpasses those high expectations.”

“Home run!” said Alan Stern, principal investigator for New Horizons at the Southwest Research Institute (SwRI) in Boulder, Colorado. “New Horizons is returning amazing results already. The data look absolutely gorgeous, and Pluto and Charon are just mind blowing.”

A new close-up image of an equatorial region near the base of Pluto’s bright heart-shaped feature shows a mountain range with peaks jutting as high as 11,000 feet (3,500 meters) above the surface of the icy body.

The mountains on Pluto likely formed no more than 100 million years ago — mere youngsters in a 4.56-billion-year-old solar system. This suggests the close-up region, which covers about one percent of Pluto’s surface, may still be geologically active today.

“This is one of the youngest surfaces we’ve ever seen in the solar system,” said Jeff Moore of the New Horizons Geology, Geophysics and Imaging Team (GGI) at NASA’s Ames Research Center in Moffett Field, California.

Unlike the icy moons of giant planets, Pluto cannot be heated by gravitational interactions with a much larger planetary body. Some other process must be generating the mountainous landscape.

“This may cause us to rethink what powers geological activity on many other icy worlds,” says GGI deputy team leader John Spencer at SwRI.

The new view of Charon reveals a youthful and varied terrain. Scientists are surprised by the apparent lack of craters. A swath of cliffs and troughs stretching about 600 miles (1,000 kilometers) suggests widespread fracturing of Charon’s crust, likely the result of internal geological processes. The image also shows a canyon estimated to be 4 to 6 miles (7 to 9 kilometers) deep. In Charon’s north polar region, the dark surface markings have a diffuse boundary, suggesting a thin deposit or stain on the surface.

New Horizons also observed the smaller members of the Pluto system, which includes four other moons: Nix, Hydra, Styx and Kerberos. A new sneak-peak image of Hydra is the first to reveal its apparent irregular shape and its size, estimated to be about 27 by 20 miles (43 by 33 kilometers).

The observations also indicate Hydra’s surface is probably coated with water ice. Future images will reveal more clues about the formation of this and the other moon billions of years ago. Spectroscopic data from New Horizons’ Ralph instruments reveal an abundance of methane ice, but with striking differences among regions across the frozen surface of Pluto.

The Johns Hopkins University Applied Physics Laboratory in Laurel, Maryland designed, built and operates the New Horizons spacecraft and manages the mission for NASA’s Science Mission Directorate. SwRI leads the mission, science team, payload operations and encounter science planning. New Horizons is part of NASA’s New Frontiers Program, managed by the agency’s Marshall Space Flight Center in Huntsville, Alabama.

Follow the New Horizons mission on Twitter and use the hashtag #PlutoFlyby to join the conversation. Live updates also will be available on the mission Facebook page.

For more information on the New Horizons mission, including fact sheets, schedules, video and all the new images, visit:


Story Source:

The above post is reprinted from materials provided by NASA. Note: Materials may be edited for content and length.

What Is Electrical Conductivity?

Power lines are made of conducting materials.
Power lines are made of conducting materials.

Electrical conductivity (EC) is a property that is used to describe how well materials allow electrons to flow. It is determined using experiments and math equations. Conductivity is the reciprocal of resistivity, meaning the higher the conductivity, the lower the resistivity. A conductor is a material that has a high electrical conductivity, and an insulator is a material that has a high electrical resistivity. Both properties depend on the temperature and purity of materials.

Temperature dependence of electrical conductivity follows a general pattern. Metal is a conductor, and it has lower conductivity at higher temperatures. Glass is an insulator and shows higher conductivity at higher temperatures.

At very high temperatures, conductors behave like insulators, and insulators behave like conductors. This behavior of insulators and conductors is explained by the free electron model. In this model, conductors clearly show the ability to free electrons, and when a current, or electric force, is applied, the force can easily push around the extra electrons.

Soil is a mixture of minerals, salts and organic materials. It has a special electrical conductivity called soil electrical conductivity, which measures the amount of salt that is in a soil sample, which is called its salinity. The process can also measure other soil properties where salinity is low enough. These properties are related to the influence that purity has on EC data.

EC data of a soil sample can determine how much impurity is in the soil. Soil impurities are water, air and minerals. Each impurity influences the data differently, but a practiced soil scientist can determine this information from the gathered data. In general, more impurities lower the EC, with the exception of minerals that increase EC. Impurities also can explain the use of pure copper in electrical wiring.

Metals are often made of alloys, a mixture of two or more elements. This is not useful for conducting electricity. The metals in alloys are not the same elements and electrons cannot flow easily between different elements. Pure metals, such as copper wire, have high electricalconductivity. This applies only to solid metals because air pockets can lower the electricalconductivity of materials.

Materials that are not metals usually make good insulators. The best insulators are materials that naturally have air pockets in them, such as rubber. The air pockets are like impurities and disrupt the flow of electrons. Gases, such as air, are the best natural insulators. Modern chemistry has mastered insulators, creating materials that have thousands of times more resistivity than air.


Source / Courtesy : WiseGeek

Do you really think you’re a foodie?

Think you’re a foodie? Adventurous eaters, known as “foodies,” are often associated with indulgence and excess. However, a new Cornell Food and Brand Lab study shows just the opposite -adventurous eaters weigh less and may be healthier than their less-adventurous counterparts.

The nationwide U.S. survey of 502 women showed that those who had eaten the widest variety of uncommon foods — including seitan, beef tongue, Kimchi, rabbit, and polenta– also rated themselves as healthier eaters, more physically active, and more concerned with the healthfulness of their food when compared with non-adventurous eaters. “They also reported being much more likely to have friends over for dinner,” said lead author Lara Latimer, PhD, formerly at the Cornell Food and Brand Lab and now at the University of Texas.

“These findings are important to dieters because they show that promoting adventurous eating may provide a way for people -especially women — to lose or maintain weight without feeling restricted by a strict diet,” said coauthor Brian Wansink, (author of Slim by Design: Mindless Eating Solutions for Everyday Life). He advises, “Instead of sticking with the same boring salad, start by adding something new. It could kick start a more novel, fun and healthy life of food adventure.”

The article is published in the journal Obesity. It is authored by former Cornell researchers, Lara Latimer, PhD, (currently a Lecturer at the University of Texas at Austin) and Lizzy Pope, PhD, RD (currently Assistant Professor at the University of Vermont), and Brian Wansink, (Professor and Director of the Food and Brand Lab at Cornell University.

Story Source:

The above post is reprinted from materials provided by Cornell Food & Brand Lab. Note: Materials may be edited for content and length.

Journal Reference:

  1. Latimer, Lara; Lizzy Pope, and Brian Wansink. Food Neophiles: Profiling the Adventurous Eater. Obesity, 2015

What Is Electrical Resistivity?

Ohm's Law can be used to find the electrical resistance applied to a circuit by resistors.
Ohm’s Law can be used to find the electrical resistance applied to a circuit by resistors.

Electrical resistivity is the characteristic of a conductor, a semiconductor, or an insulator that limits the amount of current flow. It is determined by the atomic or molecular properties that may either allow or impede the flow of free electrons through the material. Electrical resistivity is almost the same as electrical resistance with the slight difference in the way electrical resistivity may refer to resistance of a specific length of a material. For instance, a basic unit of resistivity could refer to the amount of resistance per unit length of a copper cable.

Ohm’s law provides the relationship between the electrical resistance (R), the voltage (V), and the current flow in amperes (A). Resistance is the ratio of the voltage to the current. For the same voltage, a higher current is a result of a lower resistance. An electrical fuse is meant to have a very low voltage drop when placed in series with an electrical load. If the load is 9.999 ohms and the fuse has a resistance of 0.001 ohms, a 10-volt (V) supply voltage will produce a current of 1 A and the voltage across the fuse is negligible at 0.001 V.

Electrical resistivity tomography is an imaging tool that is able to present a three-dimensional profile of embedded materials. This is accomplished by using embedded electrodes and direct current (DC) to create a two-dimensional image. By using perpendicular image planes, it is possible to have an idea of the three-dimensional layout.

Various elements with notable electric resistivity have different uses in electrical applications. Silver and gold are very low-electrical resistivity elements that are used for special applications such as microbonding used in the semiconductor industry. Copper is the chosen commercial conductor sure to its acceptable electrical resistivity and relatively low price. Carbon is a low-cost material of choice for medium to high resistance resulting in huge varieties of carbon resistance in the market. The high stability of tungsten in relatively high temperatures makes it a common choice for incandescent and filament applications such as light bulbs, wire-wound variable resistors, and electric heaters.

Contact electrical resistance is usually very low when the conductive surfaces are not contaminated. In the case of relay contacts, the pressure that temporarily joins them determines how low the resistance will drop when the contact is closed. If the pressure is not enough and the current is high, it is possible for the contact to form plasma that can melt the contact. The spark generated due to repeated closures shortens the relay lifespan. In most cases, it is a good idea to use electronic DC switches such as the silicon-controlled rectifier (SCR) or use electronic alternating current (AC) switches like the three-terminal AC (TRIAC) switch.


Source / Courtesy : WiseGeek

How a newborn baby sees you

This is how a newborn infant percieves expressions at different distances. Credit: Illustration by Professor Bruno Laeng/ UiO.
This is how a newborn infant percieves expressions at different distances.
Credit: Illustration by Professor Bruno Laeng/ UiO.

[dropcap]A[/dropcap] newborn infant can see its parents’ expressions at a distance of 30 cm. For the first time researchers have managed to reconstruct infants visual perception of the world.

By combining technology, mathematics and previous knowledge of the visual perception of infants, researchers have finally succeeded in showing to an adult audience how much of its environment a newborn baby can actually see. The results tell us that an infant of 2 to 3 days old can perceive faces, and perhaps also emotional facial expressions, at a distance of 30 centimeters — which corresponds to the distance between a mother and her nursing baby. If the distance is increased to 60 centimeters, the visual image gets too blurred for the baby to perceive faces and expressions.

The study was conducted by researchers at the Institute of psychology at The University of Oslo in collaboration with colleagues at the University of Uppsala and Eclipse Optics in Stockholm, Sweden.

Live pictures

The study plugs a gap in our knowledge about infants’ visual world, which was left open for several decades. It may also help explain claims that newborn babies can imitate facial expressions in adults during the first days and weeks of their lives, long before their vision is sufficiently developed to perceive details in their environments. The key word is motion.

“Previously, when researchers have tried to estimate exactly what a newborn baby sees, they have invariably used still photos. But the real world is dynamic. Our idea was to use images in motion,” says professor emeritus Svein Magnussen from the Institute of Psychology.

Testing an old idea

Early in his career, Magnussen conducted research into the visual perception of humans. One day, about 15 years ago, he found himself discussing with colleagues the problem of testing whether newborn infants are really able to perceive facial expressions in people around them. The researchers agreed that if it were true that babies could see and imitate facial expressions, the reason might be that the faces were moving.

“Back then we had neither the equipment nor the technical competence to test our idea. We dug it out again only a year ago. So, our results are based on an old idea which nobody had tested in the meantime,” he says.

What makes facial expressions intelligible? In order to carry out the test, the researchers had to combine modern simulation techniques with previous insight into how infants’ vision works. We have a great deal of information about young infants’ contrast sensitivity and spatial resolution from behavioural studies conducted, for the most part, in the 80s. At that time, it was discovered that presenting an infant with a figure against a uniformly grey background, caused the infant to direct its gaze towards the figure.

“Figures made up of black and white stripes were used. By choosing a certain stripe width and frequency, the field would appear uniformly grey, and the child would not direct its gaze towards it. Changing the width and frequency to make up figures, made it possible to determine the exact level of contrast and spatial resolution needed to make the infant direct its gaze towards the figure,” Magnussen says.

In other words, the researchers had access to quite accurate information about newborn infants’ vision. What was unknown to them, was the practical consequences of this information. Does it, for instance, mean that a newborn baby can see the expression in the face of an adult bending over the baby?

Movement is easier to see

It’s easier to recognise something that moves, than a blurry still photo. The researchers made video recordings of faces that changed between several emotional expressions, and subsequently filtered out the information which we know is unavailable to newborn infants. Then they let adult participants see the videos. The idea was that if the adults were unable to identify a facial expression, then we can certainly assume that a newborn would also be unable to do so.

The adult participants correctly identified facial expressions in three out of four cases when viewing the video at a distance of 30 centimeters. When the distance was increased to 120 centimeters, the participants’ rate of identification were about what one could expect from random responding. This means that the ability to identify facial expressions based on the visual information available to a newborn baby, reaches its limit at a distance of about 30 centimeters.

Filling a gap in the foundation wall

“It’s important to remember that we have only investigated what the newborn infant can actually see, not whether they are able to make sense of it,” Magnussen points out.

Previous attempts to recreate the newborn baby’s visual reality, for instance in students’ textbooks, have usually relied on taking a normal photograph and blur it. Magnussen confesses himself surprised that nobody before them have made use of the detailed information we possess about infants’ visual perception. Hence this is the first time that we have a concrete estimate of the visual information available to the newborn baby.

Magnussen and his colleagues are happy to finally have been able to carry out an idea that had been on the back burner for fifteen years. But as for developing their results further, they will leave that to others.

“All of us behind this study are really involved in different fields of research now. Our position is: Now a piece of the foundation is in place. If anyone else wants to follow up, that’s up to them,” says Magnussen.

Story Source:

The above post is reprinted from materials provided by University of Oslo. The original item was written by Kjerstin Gjengedal. Note: Materials may be edited for content and length.

Journal Reference:

  1. O. von Hofsten, C. von Hofsten, U. Sulutvedt, B. Laeng, T. Brennen, S. Magnussen. Simulating newborn face perception. Journal of Vision, 2014; 14 (13): 16 DOI: 10.1167/14.13.16