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  


With javadoc, which of the following denotes a javadoc comment?





  Half-n-half Clue


To print the value of a variable "x" of type int, which of the following expressions can be used:
(A) System.out.println("x = " + x);
(B) System.out.println("x = " + String.valueOf(x));
(C) System.out.println("x = " + Integer.toString(x));
(D) System.out.println("x = " + (new Integer(x)).toString());

  (B), (C) and (D)

  (A), (B), (C) and (D)

  (B) and (D)

  (C) and (D)

  Half-n-half Clue


What will be the output of the following program?
class Main2



  XXX followed by YYY

  Error. Won't compile

  Half-n-half Clue


For the following class definition, which is a legal statement to construct an object of type Class1:
class Class1 extends Class2


  (C) & (E)

  (A) & (B)

  (C) & (D)

  None of the above

  Half-n-half Clue


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

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

  Half-n-half Clue


Consider the following code:
int i = 1;

  code is illegal and therefore will not compile

  output will be One

  output will be One followed by Two

  output will be One, followed by Two, and then followed by Three

  Half-n-half Clue


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)


  Half-n-half Clue

12 more pages in Java Programming

Contact Info © 1999-2021 Syvum Technologies Inc. Privacy Policy Disclaimer and Copyright