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.

The method int func(int i, int j)

  (B) & (C)

  (C) & (D)

  (A), (B), (C) & (E)

  (A), (B) & (E)

  None of these

  Half-n-half Clue
 

2.

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

  XXX

  XXX followed by YYY

  YYY

  Error. Won't compile

  Half-n-half Clue
 

3.

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

  (A)

  (C) & (E)

  (A) & (B)

  (C) & (D)

  None of the above

  Half-n-half Clue
 

4.

Which error does the following code contain: class Class1

  Class Class1 has not been declared public

  Method func1() must be declared as static

  There is no error

  Class1 should be declared as abstract

  Half-n-half Clue
 

5.

Which of the following command lines options generates documentation for all classes and methods?

  -verbose

  -public

  -encoding

  -private

  -protected

  Half-n-half Clue
 

6.

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

  (C) and (D)

  (B), (C) and (D)

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

  (B) and (D)

  Half-n-half Clue
 

7.

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

  @argument

  @param

  @parameter

  @value

  @method

  Half-n-half Clue
 


 
12 more pages in Java Programming


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