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  


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

  (A), (B) & (D)

  (A), (C) & (D)


  Half-n-half Clue


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






  Half-n-half Clue


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


  Error. Won't compile


  XXX followed by YYY

  Half-n-half Clue


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 3 only

  Line 1 and Line 4

  Line 1 only

  Line 4 only

  Line 3 and Line 4

  Half-n-half Clue


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

  Results in error because String isabstract

  Results in error because the class is not declaredpublic

  Results in error because class body is not defined

  Results in error because java.lang.String isfinal

  Compiles successfully

  Half-n-half Clue


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





  Half-n-half Clue


Examine the following class definitions to detect errors, if any.
abstract class MyPanel

  1 Error. Method show() should have a return type

  1 Error. Method show() is not implemented in MyDisplay

  1 Error. MyDisplay does not contain any members

  No errors

  Half-n-half Clue

12 more pages in Java Programming

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