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.

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

  '\u0001'

  '\uffff'

  " " (space)

  '\u0000'

  Half-n-half Clue
 

2.

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?

  None of these

  -5

  -23

  5

  Half-n-half Clue
 

3.

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

  Division by zero

  Division by zero
Catch block

  Error. Won't compile

  Catch block

  Half-n-half Clue
 

4.

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

  (A)

  (D)/option>

  None of these

  (D) & (E)

  (A) & (B)

  Half-n-half Clue
 

5.

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

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

  (A), (C) & (D)

  (A), (B) & (C)

  (B) & (C)

  Half-n-half Clue
 

6.

Given the declarations
int x , m = 2000;
short y;
byte b1 = -40, b2;
long n;
Which of the following assignment statements will evaluate correctly?
(A) x = m * b1;
(B) y = m * b1;
(C) n = m * 3L;
(D) x = m * 3L;

  (B) & (C)

  (A), (C) & (D)

  (A), (B) & (C)

  (A) & (C)

  (A) & (D)

  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?

  4

  1

  1.66

  None of these

  Half-n-half Clue
 


 
12 more pages in Java Programming


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