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 result of the expression
a % b
when a and b are of type int and their values are a = -17 and b = -6?

  5

  -23

  None of these

  -5

  Half-n-half Clue
 

2.

If not assigned a value, a variable of type char has the following default value:

  " " (space)

  '\u0000'

  '\u0001'

  '\uffff'

  Half-n-half Clue
 

3.

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

  23

  Error. Cannot be executed.

  11

  57

  Half-n-half Clue
 

4.

Consider the following code: int x, y, z;
y = 1;
z = 5;
x = 0 - (++y) + z++;

After execution of this, what will be the values of x, y and z?

  x = 3, y = 2, z = 6

  x = -7, y = 1, z = 5

  x = 4, y = 2, z = 6

  x = 4, y = 1, z = 5

  Half-n-half Clue
 

5.

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

  (A) & (B)

  (A)

  (D)/option>

  (D) & (E)

  None of these

  Half-n-half Clue
 

6.

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

  (A), (C) & (D)

  (C) & (E)

  (A), (B) & (C)

  (A) & (E)

  (A), (C) & (E)

  Half-n-half Clue
 

7.

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) & (D)

  (A), (B) & (C)

  (A), (C) & (D)

  (B) & (C)

  (A) & (D)

  Half-n-half Clue
 


 
12 more pages in Java Programming


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