Java Programming  Classes and Objects  Mock Test

Instructions

Questions will be displayed one by one.
For each question, select an option, selected option will be marked with a blue circle.
Proceed to next question, answering one by one.
Once completed please click Check result button.

1. Which of the following is an invalid declaration for the main method in java program?

public static void main (String [ ] args) public static strictfp void main(String args[ ]) final static public void main (String args[ ]) All are Correct

Workspace

Discuss

2. A top level class may have which one of the following access modifiers?

package private protected public

Workspace

Discuss

3. Visualizing program components as objects is characteristics of which of the following language types?

Object-oriented programming language Machine language Command line operating system Procedural language

Workspace

Discuss

4. A subclass is also called as

inner class nested class derived class hidden class

Workspace

Discuss

5. Attribute of an object can include information about

State Method Behavior Procedures

Workspace

Discuss

6. Which of the following is not a wrapper class?

Vector Character Boolean Integer

Workspace

Discuss

7. Which of the following method is used to initialize the instance variable of a class?

Class Public Constructor Destructor

Workspace

Discuss

8. Object oriented programming method is followed in

C programming language C++ programming language C# programming language Both b and c

Workspace

Discuss

9. The last statement in a finalize method should always be

super (finalize) super finalize() finalize(method name) no restrictions

Workspace

Discuss

10. The methods defined by Thread class that help to manage threads are :

joined stop getName all of the above

Workspace

Discuss

11. Which of the following is not true about constructors?

It initializes an object immediately upon creation It is syntactically similar to a method The return type of class constructor is the class type itself All of the above

Workspace

Discuss

12. A default constructor has

has no arguments has no return type has one argument but no return type has two arguments

Workspace

Discuss

13. When a method is made static, it cannot use

this super Both a. and b. None the above

Workspace

Discuss

14. Which method of the thread class should be defined?

run() start() Both a. and b. None of these above

Workspace

Discuss

15. In Java, main() method returns a value of type

void int real string

Workspace

Discuss