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

  Will compile and run successfully

  Error. ClassA does not define a no-argument constructor

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

  Error. There is no code in the class ClassB

  Error. ClassB does not define a no-argument constructor

  Half-n-half Clue
 

2.

A package is a collection of

  editing tools

  classes and interfaces

  classes

  interfaces

  Half-n-half Clue
 

3.

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
.

  (B) & (C)

  (A)

  (A) & (C)

  (D)

  Half-n-half Clue
 

4.

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)

  (A), (C) & (E)

  (B),(C) & (D)

  All of these.

  Half-n-half Clue
 

5.

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

  (C) & (E)

  (A), (C) & (E)

  (B), (C) & (E)

  All of these.

  Half-n-half Clue
 

6.

We would like to make a member of a class visible in all subclasses regardless of what package they are in. Which one of the following keywords would achieve this?

  protected

  private OR protected

  public

  private

  Half-n-half Clue
 

7.

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

  (B) & (C)

  (D)

  (E)

  (A) & (C)

  Half-n-half Clue
 


 
12 more pages in Java Programming


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