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.

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) & (D)

  (A) & (C)

  Half-n-half Clue
 

2.

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

  XXX

  YYY

  XXX followed by YYY

  Error. Won't compile

  Half-n-half Clue
 

3.

Which error does the following code contain: class Class1

  Class Class1 has not been declared public

  There is no error

  Class1 should be declared as abstract

  Method func1() must be declared as static

  Half-n-half Clue
 

4.

Consider the following code:
int i = 1;
switch(c)

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

  output will be One

  output will be One followed by Two

  code is illegal and therefore will not compile

  Half-n-half Clue
 

5.

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

  @method

  @value

  @param

  @parameter

  @argument

  Half-n-half Clue
 

6.

Consider the following code:
class NewString extends java.lang.String

  Results in error because java.lang.String isfinal

  Compiles successfully

  Results in error because class body is not defined

  Results in error because String isabstract

  Results in error because the class is not declaredpublic

  Half-n-half Clue
 

7.

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
 


 
12 more pages in Java Programming


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