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.

Identify the statements that are correct:
(A) int a = 13, a>>2 = 3
(B) int b = -8, b>>1 = -4
(C) int a = 13, a>>>2 = 3
(D) int b = -8, b>>>1 = -4

  (A), (B) & (C)

  (A) & (B)

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

  (C) & (D)

  Half-n-half Clue
 

2.

In the code below, what data types the variable x can have?
byte b1 = 5;
byte b2 = 10;
x = b1 * b2;(A) byte
(B) int
(C) short
(D) long
(E) float
(F) double

  (B), (D), (E) & (F)

  (B), (D) & (E)

  (B), (C) & (D)

  (A), (B), (D) & (E)

  (D) & (F)

  Half-n-half Clue
 

3.

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

  (B) & (D)

  (B)

  (A) & (B)

  (A) & (C)

  Half-n-half Clue
 

4.

27 | 8 = ?

  8

  19

  35

  27

  Half-n-half Clue
 

5.

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 = 4, y = 1, z = 5

  x = 3, y = 2, z = 6

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

  x = 4, y = 2, z = 6

  Half-n-half Clue
 

6.

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

  '\u0000'

  " " (space)

  '\u0001'

  '\uffff'

  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

  None of these

  4

  Half-n-half Clue
 


 
12 more pages in Java Programming


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