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.

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

  (A)

  (D)/option>

  (A) & (B)

  (D) & (E)

  None of these

  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)

  (C)

  (C) & (E)

  (A), (C) & (E)

  (A)

  Half-n-half Clue
 

3.

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)

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

  (D) & (F)

  (B), (C) & (D)

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

  Half-n-half Clue
 

4.

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

  5

  2

  8

  3

  1

  Half-n-half Clue
 

5.

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;

  (A) & (D)

  (B) & (C)

  (A), (C) & (D)

  (A), (B) & (C)

  (A) & (C)

  Half-n-half Clue
 

6.

Given the declarations
boolean b;
short x1 = 100, x2 = 200, x3 = 300; Which of the following statements are evaluated to true?
(A) b = x1 * 2 == x2;
(B) b = x1 + x2 != 3 * x1;
(C) b = (x3 - 2*x2<0) || ((x3 = 400)<2**x2);
(D) b = (x3 - 2*x2>0) || ((x3 = 400) 2*x2);

  (A) & (D)

  (A) & (C)

  (A), (B) & (C)

  (B) & (C)

  (A), (C) & (D)

  Half-n-half Clue
 

7.

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

  (A) & (C)

  (B) & (D)

  (A) & (B)

  (B)

  Half-n-half Clue
 


 
12 more pages in Java Programming


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