Java MCQ (Multiple Choice Questions) with Answer

1. Which variables are created when an object is created with the use of the keyword ‘new’ and destroyed when the object is destroyed?

A. Static variables

B. Local variables

C. Instance variables

D. Local variables

Answer : Instance variables (C)

2. _____ is used to find and fix bugs in the Java programs?





Answer : JDB (B)

3. Who is known as father of Java Programming Language?

A. Blais Pascal

B. James Gosling

C. M. P Java

D. Charel Babbage

Answer : James Gosling (B)

4. Which of the following are not Java modifiers?

A. friendly

B. public

C. transient

D. private

Answer : friendly (A)

5. What is the full form of JVM ?

A. Java Verified Machine

B. Java Very Small Machine

C. Java Virtual Machine

D. Java Very Large Machine

Answer : Java Virtual Machine (C)

6. Modulus operator (%) can be applied to which of these?

A. Floating – point numbers

B. Integers

C. Both A and B

D. None of These

Answer : Both A and B (C)

7. The \u0031 article referred to as a

A. Octal escape

B. Hexadecimal

C. Unicode escape sequence

D. Line feed

Answer : Unicode escape sequence (C)

8. Which of the following is a valid declaration of a char?

A. char cr = \u0223;

B. char ca = ‘tea’;

C. char cc = ‘\itea’;

D. char ch = ‘\utea’;

Answer : char ch = ‘\utea’; (D)

9. Evaluate the following Java expression, if x=1, y=9, and z=11:

(++z + y – y + z + x++)

A. 23

B. 20

C. 24

D. 25

Answer : 24 (C)

10. Which of the following for loop declaration is not valid?

A. for ( int i = 7; i <= 77; i += 7 )

B. for ( int i = 99; i >= 0; i / 9 )

C. for ( int i = 2; i <= 20; i = 2* i )

D. for ( int i = 20; i >= 2; – -i )

Answer : for ( int i = 99; i >= 0; i / 9 ) (B)

11. In java control statements break, continue, return, try-catch-finally and assert belongs to?

A. Transfer statements

B. Selection statements

C. Pause Statement

D. Loop Statements

Answer : Transfer statements (A)

More Reading

Post navigation

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *