java question 5

By | October 22, 2019

1 What is the output of below code snippet?

Options:

A. “123451234512345”

B. Prints a negative integer value

C. “12345100000”

D. Compilation error

D

Explanation: Exception in thread “main” java.lang.Error: Unresolved compilation problem:
The literal 123451234512345 of type int is out of range

2. Given the following definitions, which of these expressions will NOT evaluate to true?

Options:

A. b1 | !b2

B. (i1 ^ 12) < 4

C. i2 & b1

D. (i1 | i2) == 3

C

Explanation:

3. What is the output of this code?

Options:

A. truefalse

B. Compilation error

C. truetrue

D. falsetrue

C

4 What is the output of below code?

Options:

A. HelloHello

B. Hello!Hello!

C. Runtime error

D. Hello!Hello

B

5. Predict the output of below program.

Options:

A. CDE

B. CD

C. C

D. “abcde”

D

6. Which method(s) compile properly from the below code snippet.

Options:

A. P1

B. P1 and P2

C. P2, P3 and P4

D. P1 and P4

E. No method compiles

D

Explanation:

Other reads: 

How to find common elements in arraylists java

Leave a Reply

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