Java Programming MCQ (Multiple Choice Questions) - SchoolingAxis

Java Programming MCQ (Multiple Choice Questions)

 Que-  Which annotation is used to represent command line input and assigned to correct data type?

a. @Input

b. @Variable

c. @Command Line

d. @Parameter


Answer- @Parameter


Que-  What is the use of @syntax?

a. Allows multiple parameters to be passed

b. Allows one to put all your options into a file and pass this file as a parameter

c. Allows one to pass only one parameter

d. Allows one to pass one file containing only one parameter


Answer- Allows one to put all your options into a file and pass this file as a parameter


Que-  What is Recursion in Java?

a. Recursion is a class

b. Recursion is a process of defining a method that calls other methods repeatedly

c. Recursion is a process of defining a method that calls itself repeatedly

d. Recursion is a process of defining a method that calls other methods which in turn call again this method


Answer- Recursion is a process of defining a method that calls other methods repeatedly


Que-  Which of these data types is used by operating system to manage the Recursion in Java?

a. Array

b. Stack

c. Queue

d. Tree


Answer- Stack


Que-  Which of these will happen if recursive method does not have a base case?

a. An infinite loop occurs

b. System stops the program after some time

c. After 1000000 calls it will be automatically stopped

d. None of the mentioned


Answer- An infinite loop occurs


Que-  Which of these is not a correct statement?

a. A recursive method must have a base case

b. Recursion always uses stack

c. Recursive methods are faster that programmers written loop to call the function repeatedly using a stack

d. Recursion is managed by Java Runtime environment


Answer- Recursion is managed by Java Runtime environment


Que-  Which of these packages contains the exception Stack Overflow in Java?

a. java.lang

b. java.util

c. java.io

d. java.system


Answer- java.lang


Que-  Which of this keyword can be used in a subclass to call the constructor of superclass?

a. super

b. this

c. extent

d. extends


Answer- super


Que-  What is the process of defining a method in a subclass having same name & type signature as a method in its superclass?

a. Method overloading

b. Method overriding

c. Method hiding

d. None of the mentioned


Answer- Method overriding


Que-  Which of these keywords can be used to prevent Method overriding?

a. static

b. constant

c. protected

d. final


Answer- final


Que-  Which of these is correct way of calling a constructor having no parameters, of superclass A by subclass B?

a. super(void);

b. superclass.();

c. super.A();

d. super();


Answer- super();


Que-  Which of these class is superclass of every class in Java?

a. String class

b. Object class

c. Abstract class

d. ArrayList class


Answer- Object class


Que-  Which of these method of Object class can clone an object?

a. Objectcopy()

b. copy()

c. Object clone()

d. clone()


Answer- Object clone()


Que-  Which of these method of Object class is used to obtain class of an object at run time?

a. get()

b. void getclass()

c. Class getclass()

d. None of the mentioned


Answer- Class getclass()


Que-  Which of these keywords can be used to prevent inheritance of a class?

a. super

b. constant

c. class

d. final


Answer- final


Que-  Which of these keywords cannot be used for a class which has been declared final?

a. abstract

b. extends

c. abstract and extends

d. none of the mentioned


Answer- abstract


Que-  Which of these class relies upon its subclasses for complete implementation of its methods?

a. Object class

b. abstract class

c. ArrayList class

d. None of the mentioned


Answer- abstract class


Que-  Which of these keywords are used to define an abstract class?

a. abst

b. abstract

c. Abstract

d. abstract class


Answer- abstract


Que-  Which of these is not abstract?

a. Thread

b. AbstractList

c. List

d. None of the Mentioned


Answer- Thread


Que-  If a class inheriting an abstract class does not define all of its function then it will be known as?

a. Abstract

b. A simple class

c. Static class

d. None of the mentioned


Answer- Abstract


Que-  Which of these is not a correct statement?

a. Every class containing abstract method must be declared abstract

b. Abstract class defines only the structure of the class not its implementation

c. Abstract class can be initiated by new operator

d. Abstract class can be inherited


Answer- Abstract class can be initiated by new operator

Previous Post Next Post