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.

What will be the value of a after execution of the following statements:
int a = 23, b = 34;
a = ((a < b) ? (b + a) : (b - a);

  34

  Error. Cannot be executed.

  23

  11

  57

  Half-n-half Clue
 

2.

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), (B) & (C)

  (B) & (C)

  (A), (C) & (D)

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

  (A) & (D)

  Half-n-half Clue
 

3.

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

  (A) & (E)

  (C) & (E)

  (A), (C) & (E)

  (A), (C) & (D)

  (A), (B) & (C)

  Half-n-half Clue
 

4.

Choose the operations that can be performed on String objects:
(A) +
(B) + =
(C) -
(D) %
(E) ^

  (A)

  (D) & (E)

  (D)/option>

  (A) & (B)

  None of these

  Half-n-half Clue
 

5.

Which of the following is not a hexadecimal number?
(A) 999
(B) (hex)23
(C) 0x556
(D) 0x1F2

  (A) & (B)

  (A), (B) & (C)

  (A)

  (C)

  Half-n-half Clue
 

6.

(1 | 4) + (4 & 2) = ?
(in base ten)

  2

  1

  3

  8

  5

  Half-n-half Clue
 

7.

What will be the result of the expression
a % b
when a and b are of type int and their values are a = 10 and b = 6?

  1

  1.66

  4

  None of these

  Half-n-half Clue
 


 
12 more pages in Java Programming


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