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 value of a after execution of the following statements:
int a = 23, b = 34;
a = ((a < b) ? (b + a) : (b - a);

  34

  Error. Cannot be executed.

  57

  23

  11

  Half-n-half Clue
 

2.

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

  None of these

  (A)

  (D) & (E)

  (A) & (B)

  (D)/option>

  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), (B) & (C)

  (A), (C) & (D)

  (B) & (C)

  (A) & (D)

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

  Half-n-half Clue
 

4.

27 | 8 = ?

  27

  19

  35

  8

  Half-n-half Clue
 

5.

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
 

6.

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

  (C) & (E)

  (D) & (E)

  (A), (C) & (E)

  (C)

  (A)

  Half-n-half Clue
 

7.

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

  (A) & (B)

  (B) & (D)

  (A) & (C)

  (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
-