Syvum Home Page

Home > Quiz Games > Java Programming >

Java Programming : Classes and Keywords: Multiple Choice


Answer the following questions about classes and reserved keywords as used in the Java programming language.

Formats Info Page Worksheet / Test Paper Quiz Review
Multiple choice

Your Performance  

1.

Consider the following code:
class ClassA

  Error. There is no code in the class ClassB

  Error. ClassB does not define a no-argument constructor

  Error. There is no code in the constructor ClassA(int x)

  Error. ClassA does not define a no-argument constructor

  Will compile and run successfully

  Half-n-half Clue
 

2.

Which of the following are keywords?
(A) switch
(B) integer
(C) default
(D) boolean
(E) object

  (E)

  (D)

  (A) & (C)

  (B) & (C)

  Half-n-half Clue
 

3.

A package is a collection of

  classes and interfaces

  editing tools

  classes

  interfaces

  Half-n-half Clue
 

4.

Which of the following statements are true?
(A) An abstract class may not have any final methods.
(B) A final class may not have any abstract methods.
(C) An inner class may be declared with any accessibility keyword.
(D) Transient variables must be static
.

  (A) & (C)

  (D)

  (A)

  (B) & (C)

  Half-n-half Clue
 

5.

Consider the following code:
interface Area

  Method compute() in class Room should be declared public

  All of these

  Method compute() in interface Area should be declared public

  Interface definition is incomplete

  Half-n-half Clue
 

6.

Which keyword can protect a class in a package from accessibility by the classes outside the package?

  final

  don't use any keyword at all (make it default)

  private

  protected

  Half-n-half Clue
 

7.

Which of the following defines a legal abstract class?

  abstract Vehicle {<br>
              abstract void display(); }

  class Vehicle {<br>
              abstract void display(); }

  class abstract Vehicle {<br>
              abstract void display(); }

  abstract class Vehicle {<br>
              abstract void display(); }

  abstract class Vehicle {<br>
              abstract void display(); {<br>
                System.out.println("Car"); }}

  Half-n-half Clue
 


 
12 more pages in Java Programming


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