Top 250+ Solved Java Programming MCQ Questions Answer

From 151 to 165 of 285

Q. Which of these methods can be used to obtain the command name for invoking ActionEventobject?

a. getCommand()

b. getActionCommand()

c. getActionEvent()

d. getActionEventCommand()

  • b. getActionCommand()

Q. Which of the following is a valid declaration of an object of class Box?

a. Box obj = new Box();

b. Box obj = new Box;

c. obj = new Box();

d. new Box obj;

  • a. Box obj = new Box();

Q. Variables declared with in a class are called

a. Identifier

b. local variable

c. instance variable

d. global variable

  • c. instance variable

Q. Variables declared within a method or block are called

a. Static variable

b. local variable

c. instance variable

d. global variable

  • b. local variable

Q. Defining methods with same name and different no. of parameters are called

a. Method overriding

b. method overloading

c. Dynamic method dispatch

d. none of the above

  • b. method overloading

Q. _________ is used to initialize objects.

a. Methods

b. arguments

c. constructors

d. new keyword

  • c. constructors

Q. What is the return type of Constructors?

a. int

b. float

c. void

d. None of the mentioned

  • d. None of the mentioned

Q. Which of the following is a method having same name as that of its class?

a. finalize

b. delete

c. class

d. constructor

  • d. constructor

Q. Which operator is used by Java run time implementations to free the memory of an object when it is no longer needed?

a. delete

b. free

c. new

d. None of the mentione

  • d. None of the mentione

Q. Which of these access specifiers must be used for main() method?

a. private

b. public

c. protected

d. None of the mentioned

  • b. public

Q. Which of these is used to access member of class before object of that class is created?

a. public

b. private

c. static

d. protected

  • c. static

Q. The keyword used to create an object

a. class

b. this

c. new

d. malloc

  • c. new

Q. The keyword used to refer the current object

a. class

b. this

c. new

d. malloc

  • b. this

Q. The method which is automatically invoked during garbage collection.

a. destructor

b. terminate()

c. finalize()

d. destroy()

  • c. finalize()
Subscribe Now

Get All Updates & News