Java - Java.lang Class Questions and Answers

Practice Mode
Showing 10 of 24 questions
Q21
Which class is used for dynamic string manipulation?
  • A StringBuilder
  • B String
  • C StringBuffer
  • D Both StringBuilder and StringBuffer
Answer: Option D
Explanation: StringBuilder allows mutable sequence of characters
Q22
What does the instanceof operator check?
  • A Object type
  • B Object value
  • C Object size
  • D Object class
Answer: Option A
Explanation: instanceof checks if object is instance of specific class/interface
Q23
Which package contains the Object class?
  • A java.lang
  • B java.util
  • C java.io
  • D java.core
Answer: Option A
Explanation: Object class is in java.lang package
Q24
What is the purpose of the Class class?
  • A Runtime class information
  • B Object creation
  • C Memory management
  • D String operations
Answer: Option A
Explanation: Class objects represent classes and interfaces in running Java application
Questions and Answers for Competitive Exams Various Entrance Test