प्रश्न और उत्तर का अभ्यास करें
8प्र: What are pass by reference and pass by value ? 1058 05b5cc7cee4d2b41977751107
5b5cc7cee4d2b41977751107- उत्तर देखेंउत्तर छिपाएं
- Workspace
- SingleChoice
उत्तर :
व्याख्या :
When an object is passed by value, this means that a copy of the object is passed. Thus, even if changes are made to that object, it doesn’t affect the original value. When an object is passed by reference, this means that the actual object is not passed, rather a reference of the object is passed. Thus, any changes made by the external method, are also reflected in all places.
प्र: Explain different ways of creating a thread. Which one would you prefer and why ? 1137 05b5cc7cee4d2b41977751106
5b5cc7cee4d2b41977751106- उत्तर देखेंउत्तर छिपाएं
- Workspace
- SingleChoice
उत्तर :
व्याख्या :
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.
प्र: What is the difference between processes and threads ? 2197 05b5cc7cee4d2b41977751105
5b5cc7cee4d2b41977751105- उत्तर देखेंउत्तर छिपाएं
- Workspace
- SingleChoice
उत्तर :
व्याख्या :
- 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.
प्र: What are the basic interfaces of Java Collections Framework ? 1514 05b5cc7cee4d2b41977751104
5b5cc7cee4d2b41977751104- उत्तर देखेंउत्तर छिपाएं
- Workspace
- SingleChoice
उत्तर :
व्याख्या :
Java Collections Framework provides a well designed set of interfaces and classes that support operations on a collections of objects. The most basic interfaces that reside in the Java Collections Framework are: Collection, which represents a group of objects known as its elements. Set, which is a collection that cannot contain duplicate elements. List, which is an ordered collection and can contain duplicate elements. Map, which is an object that maps keys to values and cannot contain duplicate keys.
प्र: What do you know about the big-O notation and can you give some examples with respect to different data structures ? 1006 05b5cc7cee4d2b41977751103
5b5cc7cee4d2b41977751103- उत्तर देखेंउत्तर छिपाएं
- Workspace
- SingleChoice
उत्तर :
व्याख्या :
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.
प्र: What’s the difference between Enumeration and Iterator interfaces ? 2044 05b5cc7cee4d2b41977751102
5b5cc7cee4d2b41977751102- उत्तर देखेंउत्तर छिपाएं
- Workspace
- SingleChoice
उत्तर :
व्याख्या :
Enumeration is twice as fast as compared to an Iterator and uses very less memory. However, the Iterator is much safer compared to Enumeration, because other threads are not able to modify the collection object that is currently traversed by the iterator. Also, Iteratorsallow the caller to remove elements from the underlying collection, something which is not possible with Enumerations.
प्र: What is the purpose of garbage collection in Java, and when is it used ? 1911 05b5cc7cee4d2b41977751101
5b5cc7cee4d2b41977751101- उत्तर देखेंउत्तर छिपाएं
- Workspace
- SingleChoice
उत्तर :
व्याख्या :
The purpose of garbage collection is to identify and discard those objects that are no longer needed by the application, in order for the resources to be reclaimed and reused.
प्र: When is the finalize() called ? What is the purpose of finalization ? 968 05b5cc7cee4d2b41977751100
5b5cc7cee4d2b41977751100- उत्तर देखेंउत्तर छिपाएं
- Workspace
- SingleChoice
उत्तर :
व्याख्या :
The finalize method is called by the garbage collector, just before releasing the object’s memory. It is normally advised to release resources held by the object inside the finalize method.

