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:
- Java is object oriented and interpreted
- Java is efficient and faster than C
- Java is the choice of everyone.
- 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:
- Checked Exception
- Unchecked Exception
- Error
- 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:
- By Input Validation
- By Ajax Validation
- By Custom Validation
- None of the above
Correct Option: By Custom Validation
Abbreviate the term DGC?
Question 4 options:
- Digital Garbage Collection
- Distributed Garbage Collection
- Distributed Garbage Connection
- None of the above
Correct Option: Distributed Garbage Collection
What is function overriding?
Question 5 options:
- If a subclass uses a method that is already provided by its parent class, it is known as Method Overriding.
- If a subclass provides a specific implementation of a method that is already provided by its parent class, it is known as Method Overriding
- Both of the above.
- 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:
- C programming language
- PERRL
- COBOL
- 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:
- This method is only accessible from inside the class itself and from inside all subclasses.
- In a class, you cannot declare methods with a lower visibility than the visibility of the class in which it is defined.
- From within protected methods you do not have access to public methods.
- 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:
- StringBuffer()
- StringBuffer(String str)
- StringBuffer(int capacity)
- 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:
- This method is only accessible from inside the class itself and from inside all subclasses.
- In a class, you cannot declare methods with a lower visibility than the visibility of the class in which it is defined.
- From within protected methods you do not have access to public methods
- 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:
- StringBuffer()
- StringBuffer(String str)
- StringBuffer(int capacity)
- None of the above
Correct Option: StringBuffer(int capacity)