Set - 6

Question 21 :

How does multithreading take place on a computer with a single CPU?

Answer :

The operating system's task scheduler allocates execution time to multiple tasks. By quickly switching between executing tasks, it creates the impression that tasks execute sequentially.


Question 22 :

When does the compiler supply a default constructor for a class?

Answer :

The compiler supplies a default constructor for a class if no other constructors are provided.


Question 23 :

When is the finally clause of a try-catch-finally statement executed?

Answer :

The finally clause of the try-catch-finally statement is always executed unless the thread of execution terminates or an exception occurs within the execution of the finally clause.


Question 24 :

Which class is the immediate superclass of the Container class?

Answer :

Component


Question 25 :

If a method is declared as protected, where may the method be accessed?

Answer :

A protected method may only be accessed by classes or interfaces of the same package or by subclasses of the class in which it is declared.