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 statements about abstract methods/classes in Java are true?
1. An abstract class cannot be instantiated.
2. Constructors cannot be abstract.
3. A subclass of an abstract class must defined the abstract methods.
4. Static methods may be declared abstract.

  Line 1, line 2 and line 3 only

  Line 1 only

  Line 1 and line 2 only

  Line 2 only

  All are true

  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

  (C) & (E)

  All of these.

  (B),(C) & (D)

  (A), (C) & (E)

  Half-n-half Clue
 

3.

Consider the following code:
class ClassA

  Error. ClassA does not define a no-argument constructor

  Error. ClassB does not define a no-argument constructor

  Will compile and run successfully

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

  Error. There is no code in the class ClassB

  Half-n-half Clue
 

4.

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

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

  final

  protected

  private

  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.

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

  (D)

  (A)

  (A) & (C)

  (B) & (C)

  Half-n-half Clue
 

7.

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)

  (A)

  (D)

  (B) & (C)

  Half-n-half Clue
 


 
12 more pages in Java Programming


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