Home / Programming Questions / JAVA MCQs / Page 3

JAVA MCQs with answers Page - 3

Dear candidates you will find MCQ questions of JAVA here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
Share your questions by clicking Add Question

M

Manisha Agrawal • 9.32K Points
Tutor III

Q. The smallest integer type is ......... and its size is ......... bits. 

(A) short, 8
(B) byte, 8
(C) short, 16
(D) short, 16

M

Manisha Agrawal • 9.32K Points
Tutor III

Q. Which is the Parent class of annotation class?

(A) Super
(B) Main
(C) Object
(D) Class

M

Manisha Agrawal • 9.32K Points
Tutor III

Q. Which of the following annotation is used to avoid execution of Junits?

(A) @ignore
(B) @avoid
(C) @explicit
(D) @NoTest

M

Manisha Agrawal • 9.32K Points
Tutor III

Q. Size of float and double in Java is 

(A) 32 and 64
(B) 64 and 64
(C) 32 and 32
(D) 64 and 32

M

Manisha Agrawal • 9.32K Points
Tutor III

Q. Determine output:

Code:
class A{
        public static void main(String args[]){
	        int x;
 	        x = 10;
	        if(x == 10){
		        int y = 20;
		        System.out.print("x and y: "+ x + " " + y);
		        y = x*2;
	        }
	        y = 100;
	        System.out.print("x and y: " + x + " " + y);
        }
}
(A) 10 20 10 100
(B) 10 20 10 20
(C) 10 20 10 10
(D) Error

M

Manisha Agrawal • 9.32K Points
Tutor III

Q. Using which annotation non visible or private method can be tested?

(A) @NonVisible
(B) @Visible
(C) @VisibleForTesting
(D) @NonVisibleForTesting

M

Manisha Agrawal • 9.32K Points
Tutor III

Q. Which one of the following is not an annotation used by Junit with Junit4?

(A) @Ignored
(B) @AfterClass
(C) @BeforeClass
(D) @Test

M

Manisha Agrawal • 9.32K Points
Tutor III

Q. Which one of the following is not ID generating strategy using @GeneratedValue annotation?

(A) Sequence
(B) Identity
(C) Manual
(D) Auto

Login

Forgot username? click here

Forgot password? Click here

Don't have account? Register here.