Programming Using Java Unit 2 MCQ


Programming Using Java

Unit 2 MCQ


Programming Using Java Unit 2 MCQ


UNIT 2 MCQ OF PROGRAMMING USING JAVA


Which one of the following is true for Java. 


Question 1 options:

  1. Java is object oriented and interpreted
  2. Java is efficient and faster than C
  3. Java is the choice of everyone.
  4. Java is not robust.

Correct Option: Java is object oriented and interpreted


What is known as the classes that extend Throwable class except RuntimeException and Error?


Question 2 options:

  1. Checked Exception
  2. Unchecked Exception
  3. Error
  4. None of the above

Correct Option: Checked Exception


Which type of validation we must implement the Validateable interface (or extend ActionSupport class) and provide the implementation of validate method?


Question 3 options:

  1. By Input Validation
  2. By Ajax Validation
  3. By Custom Validation
  4. None of the above

Correct Option: By Custom Validation


Abbreviate the term DGC?


Question 4 options:

  1. Digital Garbage Collection
  2. Distributed Garbage Collection 
  3. Distributed Garbage Connection
  4. None of the above

Correct Option: Distributed Garbage Collection 


What is function overriding?


Question 5 options:

  1. If a subclass uses a method that is already provided by its parent class, it is known as Method Overriding.
  2. If a subclass provides a specific implementation of a method that is already provided by its parent class, it is known as Method Overriding
  3. Both of the above.
  4. None of the above.

Correct Option: If a subclass provides a specific implementation of a method that is already provided by its parent class, it is known as Method Overriding


Java has its origin in.


Question 6 options:

  1. C programming language
  2. PERRL
  3. COBOL
  4. Oak programming language

Correct Option: Oak programming language


Suppose a class has public visibility. In this class we define a protected method. Which of the following statements is correct?


Question 7 options:

  1. This method is only accessible from inside the class itself and from inside all subclasses.
  2. In a class, you cannot declare methods with a lower visibility than the visibility of the class in which it is defined.
  3. From within protected methods you do not have access to public methods.
  4. This method is accessible from within the class itself and from within all classes defined in the same package as the class itself.

Correct Option: This method is accessible from within the class itself and from within all classes defined in the same package as the class itself.


Which constructor creates an empty string buffer with the specified capacity as length.


Question 8 options:

  1. StringBuffer()
  2. StringBuffer(String str)
  3. StringBuffer(int capacity)
  4. None of the above

Correct Option: StringBuffer(int capacity)


Suppose a class has public visibility. In this class we define a protected method. Which of the following statements is correct?


Question 9 options:

  1. This method is only accessible from inside the class itself and from inside all subclasses.
  2. In a class, you cannot declare methods with a lower visibility than the visibility of the class in which it is defined.
  3. From within protected methods you do not have access to public methods
  4. This method is accessible from within the class itself and from within all classes defined in the same package as the class itself.

Correct Option: This method is accessible from within the class itself and from within all classes defined in the same package as the class itself.


Which constructor creates an empty string buffer with the specified capacity as length.


Question 10 options:

  1. StringBuffer()
  2. StringBuffer(String str)
  3. StringBuffer(int capacity)
  4. None of the above

Correct Option: StringBuffer(int capacity)



Post a Comment