Syvum Home Page

Home > Quiz Games > Java Programming >

Java Programming : Basic Operations : Multiple Choice


Answer the following questions about basic operations in the Java programming language.

Formats Info Page Worksheet / Test Paper Quiz Review
Multiple choice

Your Performance  

1.

Which of the following represent legal flow control statements?
(A) break;
(B) break();
(C) continue outer;
(D) continue(inner);
(E) return;
(F) exit();

  (C) & (E)

  (A), (C) & (E)

  (A) & (E)

  (A), (C) & (D)

  (A), (B) & (C)

  Half-n-half Clue
 

2.

Given the declarations
boolean b;
short x1 = 100, x2 = 200, x3 = 300; Which of the following statements are evaluated to true?
(A) b = x1 * 2 == x2;
(B) b = x1 + x2 != 3 * x1;
(C) b = (x3 - 2*x2<0) || ((x3 = 400)<2**x2);
(D) b = (x3 - 2*x2>0) || ((x3 = 400) 2*x2);

  (A) & (D)

  (A) & (C)

  (A), (C) & (D)

  (B) & (C)

  (A), (B) & (C)

  Half-n-half Clue
 

3.

Select the invalid assignment statements from the following:
(A) float x = 238.88;
(B) double y = 0x443;

  (B) & (D)

  (A) & (B)

  (A) & (C)

  (B)

  Half-n-half Clue
 

4.

In which of the following code fragments, is the variable x evaluated to 8?
(A) int x = 32;
x = x>>2;
(B) int x = 33;
x = x>>2;
(C) int x = 35;
x = x>>2;
(D) int x = 16;
x = x>>1;

  (A), (C) & (D)

  (A), (B), (C) & (D)

  (B) & (C)

  (A) & (D)

  (A), (B) & (C)

  Half-n-half Clue
 

5.

Consider the following code snippet:
.....
.....
try

  Division by zero
Catch block

  Error. Won't compile

  Division by zero

  Catch block

  Half-n-half Clue
 

6.

The type long can be used to store values in the following range:

  -263 to 263 - 1

  -264 to 264

  -232 to 232 - 1

  -231 to 231 - 1

  Half-n-half Clue
 

7.

27 | 8 = ?

  27

  19

  8

  35

  Half-n-half Clue
 


 
12 more pages in Java Programming


Contact Info © 1999-2025 Syvum Technologies Inc. Privacy Policy Disclaimer and Copyright
Previous
-
Next
-