Java Programming Questions & Answers: part2



Software Programming : Java Programming QUESTIONS AND ANSWERS :: part2 : 11 to 15

Following Software Programming language Entrance Multiple choice objective type questions and answers will help you in Software Programming 2024 examinations :

11.What is garbage collection in the context of Java?

The operating system periodically deletes all the java files available on the system.
Any package imported in a program and not used is automatically deleted.
When all references to an object are gone, the memory used by the object is automatically reclaimed.
The JVM checks the output of any Java program and deletes anything that doesn't make sense.
Janitors working for Sun Micro Systems are required to throw away any Microsoft documentation found in the employees' offices.

12.Which of the following is TRUE? #18. Which of the following is TRUE?

In java, an instance field declared public generates a compilation error.
int is the name of a class available in the package java.lang
Instance variable names may only contain letters and digits.
A class has always a constructor (possibly automatically supplied by the java compiler).
The more comments in a program, the faster the program runs.

13.Consider, public class MyClass { public MyClass(){/*code*/} // more code... } To instantiate MyClass, you would write?

MyClass mc = new MyClass();
MyClass mc = MyClass();
MyClass mc = MyClass;
MyClass mc = new MyClass;
The constructor of MyClass should be defined as, public void MyClass(){/*code*/}.

14.All exception types are subclasses of the built-in class

Exception
RuntimeException
Error
Throwable
None of the above.

More Java Programming QUESTIONS AND ANSWERS available in next pages

    Health is the greatest gift, contentment is the greatest wealth -Buddha
A real entrepreneur is somebody who has no safety net underneath them. Henry Kravis