Syvum Home Page

Home > Quiz Games > Java Programming >

Java Programming : Compilation and Execution: Multiple Choice


Answer the following questions about Java syntax and mistakes which can cause compilation errors, as well as the output generated by sample programs.

Formats Info Page Worksheet / Test Paper Quiz Review
Multiple choice

Your Performance  

1.

What is java_g used for?

  Using the jdb tool

  Executing a class with optimization turned off

  None of these

  To provide information about deprecated methods

  Half-n-half Clue
 

2.

Which javadoc tag is used to denote a comment for a method parameter?

  @value

  @method

  @param

  @parameter

  @argument

  Half-n-half Clue
 

3.

Which of the following expressions will produce errors upon compilation?
(A) boolean a = (boolean) 1;
(B) boolean b = (false && true);
(C) float y = 22.3;

  (A), (B) & (D)

  (A)

  (A) & (C)

  (A), (C) & (D)

  Half-n-half Clue
 

4.

Examine the following code snippets to identify the legal loop constructs:
(A) for (int i = 22, int j = 0; i + j > 11; i = i-3, j++)

  (A) & (C)

  (A) & (D)

  (B)

  (A)

  Half-n-half Clue
 

5.

Which lines of the following will produce an error?
1. byte a1 = 2, a2 = 4, a3;
2. short s = 16;
3. a2 = s;
4. a3 = a1 * a2;
(The lines are numbered only for illustration in this question.)

  Line 1 only

  Line 1 and Line 4

  Line 3 and Line 4

  Line 3 only

  Line 4 only

  Half-n-half Clue
 

6.

Determine the output when the value of x is zero:
if(x >= 0)
if(x > 0)
System.out.println("x is positive");
else
System.out.println("x is negative");

  "x is positive"

  "x is positive" and "x is negative"

  None of these

  "x is negative"

  Half-n-half Clue
 

7.

The control expression in an "if" statement must be:

  an expression with type boolean

  an expression with type integer

  an expression with either the type boolean or integer with value 0 or 1

  an expression with either the type boolean or integer

  Half-n-half Clue
 


 
12 more pages in Java Programming


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