Searching for "If"

Q:

What do you know about the big-O notation and can you give some examples with respect to different data structures ?

Answer

The Big-O notation simply describes how well an algorithm scales or performs in the worst case scenario as the number of elements in a data structure increases. The Big-O notation can also be used to describe other behavior such as memory consumption. Since the collection classes are actually data structures, we usually use the Big-O notation to chose the best implementation to use, based on time, memory and performance. Big-O notation can give a good indication about performance for large amounts of data.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

Q:

What is the difference between processes and threads ?

Answer

- A process is an execution of a program, while a Thread is a single execution sequence within a process.


- A process can contain multiple threads. A Thread is sometimes called a lightweight process.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

Q:

Explain different ways of creating a thread. Which one would you prefer and why ?

Answer

There are three ways that can be used in order for a Thread to be created:


A class may extend the Thread class.


A class may implement the Runnable interface.


An application can use the Executor framework, in order to create a thread pool.


The Runnable interface is preferred, as it does not require an object to inherit the Thread class. In case your application design requires multiple inheritance, only interfaces can help you. Also, the thread pool is very efficient and can be implemented and used very easily.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

Q:

What is the difference between an Interface and an Abstract class ?

Answer

1.Main difference is methods of a Java interface are implicitly abstract and cannot have implementations. A Java abstract class can have instance methods that implements a default behavior.


2.Variables declared in a Java interface is by default final. An abstract class may contain non-final variables.


3.Members of a Java interface are public by default. A Java abstract class can have the usual flavors of class members like private, protected, etc..


4.Java interface should be implemented using keyword “implements”; A Java abstract class should be extended using keyword “extends”.


5.An interface can extend another Java interface only, an abstract class can extend another Java class and implement multiple Java interfaces.


6.A Java class can implement multiple interfaces but it can extend only one abstract class.


7.Interface is absolutely abstract and cannot be instantiated; A Java abstract class also cannot be instantiated, but can be invoked if a main() exists.


8.In comparison with java abstract classes, java interfaces are slow as it requires extra indirection.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

Q:

If people sleep in closed rooms where charcoal fire is burning , they die due to 

A) carbon monoxide B) carbon dioxide
C) methane D) phosgene
 
Answer & Explanation Answer: A) carbon monoxide

Explanation:

A closed room is aplace where charcoal is burnt in limited supply of air. There is every chance for the formation of the deadly poisonous carbon monoxide, which when inhaled, reacts with the iron in haemoglobin of blood and prevents the supply of oxygen. It is said to be treacherous as there can be no previous warning of its presence because it is an odourless and colourless gas.

Report Error

View Answer Report Error Discuss

Filed Under: Chemistry

Q:

If a band is played on the moon the sound will

A) reverberate B) be heard by us faintly
C) be heard upto 10km from it D) not be heard at any distance at all from it
 
Answer & Explanation Answer: D) not be heard at any distance at all from it

Explanation:

As there is no atmosphere surrounding the moon, the sound from any band that is played there cannot travel outwards there is no material medium  surrounding it for its propagation.

Report Error

View Answer Report Error Discuss

Filed Under: Physics

Q:

A boy sitting in a train moving with a uniform velocity drops a coin outside. A man standing outside the train will find the trajectory of the coin to be 

A) a parabola B) a horizontal straight line
C) a vertical straight line D) a circle
 
Answer & Explanation Answer: A) a parabola

Explanation:

Parabola, because when the coin is dropped at a particular point, it has the same velocity as the running train. So, by Newton's first law, it continues its motion horizontally with that velocity. But then, it is also pulled down by earth's gravity continuously. In this situation its horizontal motion gives way to the parabolic motion until it reaches the ground.

Report Error

View Answer Report Error Discuss

Filed Under: Physics

Q:

Hot water is poured simultaneously in four metallic tumblers painted outside with different points. After some time the water will be found to have cooled most in the tumbler painted.

A) rough white B) rough black
C) shining white D) shining black
 
Answer & Explanation Answer: B) rough black

Explanation:

Black  surfaces are good emitters of heat ( They are also good absorbers of heat). If the black surface is rough too, the emitting will be better. So (b) is the correct answer. Shining surfaces reflect back radiation. So if the black surface is also shining the effectiveness of emitting heat is lessened.

Report Error

View Answer Report Error Discuss

Filed Under: Physics