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

  None of these

  5

  -23

  Half-n-half Clue
 

2.

Of the following functions from the class java.lang.Math, select those that produce a value of 25, when a = 25.7.

  (D) & (E)

  (A)

  (A), (C) & (E)

  (C) & (E)

  (C)

  Half-n-half Clue
 

3.

The type long can be used to store values in the following range:

  -264 to 264

  -232 to 232 - 1

  -263 to 263 - 1

  -231 to 231 - 1

  Half-n-half Clue
 

4.

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

  '\u0000'

  '\uffff'

  '\u0001'

  " " (space)

  Half-n-half Clue
 

5.

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

  (D) & (F)

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

  (B), (C) & (D)

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

  (B), (D) & (E)

  Half-n-half Clue
 

6.

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
 

7.

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

  (D) & (E)

  (A)

  None of these

  (D)/option>

  (A) & (B)

  Half-n-half Clue
 


 
12 more pages in Java Programming


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