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.

Which of the following keywords are used to control access to a class member?
(A) default
(B) abstract
(C) protected
(D) interface
(E) public

  (A), (C) & (E)

  All of these.

  (C) & (E)

  (B), (C) & (E)

  Half-n-half Clue
 

2.

The keywords reserved but not used in the initial version of Java are:
(A) union
(B) const
(C) inner
(D) goto
(E) boolean
(F) synchronized

  All of these.

  (C) & (E)

  (A), (C) & (E)

  (B),(C) & (D)

  Half-n-half Clue
 

3.

Package p1 contains the following code:
package p1;
public class Student

  Test class is not available.

  Class result should be declared public.

  Result body is not fully defined.

  Student class is not available.

  Half-n-half Clue
 

4.

The concept of multiple inheritance is implemented in Java by
(A) extending two or more classes
(B) extending one class and implementing one or more interfaces
(C) implementing two or more interfaces
(D) all of these

  (A)

  (B) & (C)

  (D)

  (A) & (C)

  Half-n-half Clue
 

5.

Which of the following defines a legal abstract class?

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

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

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

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

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

  Half-n-half Clue
 

6.

Consider the following code:
interface Area

  All of these

  Method compute() in class Room should be declared public

  Interface definition is incomplete

  Method compute() in interface Area should be declared public

  Half-n-half Clue
 

7.

Consider the following code:
class ClassA

  Error. ClassB does not define a no-argument constructor

  Error. ClassA does not define a no-argument constructor

  Error. There is no code in the class ClassB

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

  Will compile and run successfully

  Half-n-half Clue
 


 
12 more pages in Java Programming


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