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.

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

  5

  1

  3

  2

  8

  Half-n-half Clue
 

2.

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

  Catch block

  Division by zero

  Error. Won't compile

  Division by zero
Catch block

  Half-n-half Clue
 

3.

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

  (B) & (C)

  (A), (B) & (C)

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

  Half-n-half Clue
 

4.

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

  -5

  None of these

  -23

  Half-n-half Clue
 

5.

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

  '\uffff'

  '\u0000'

  " " (space)

  '\u0001'

  Half-n-half Clue
 

6.

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

  11

  23

  57

  Error. Cannot be executed.

  Half-n-half Clue
 

7.

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

  (A)

  (A) & (B)

  (D)/option>

  None of these

  (D) & (E)

  Half-n-half Clue
 


 
12 more pages in Java Programming


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