Web Design and Development MCQs with Answers

Practice important Web Design and Development MCQs with answers and explanations.

Multiple Choice Questions

Q41: Which class is used to take input from a GUI in Java?
  • A: Scanner
  • B: JOptionPane
  • C: InputStream
  • D: BufferedReader
View Answer
B

Q42: In the InputOutputTest class, what method is used to display a message in a dialog box?
  • A: showInputDialog
  • B: showMessageDialog
  • C: printMessage
  • D: displayMessage
View Answer
B

Q43: What does the parseInt method do in Java?
  • A: Converts String to int
  • B: Converts int to String
  • C: Converts String to double
  • D: Converts double to int
View Answer
A

Q44: Which Java data type is used to store true or false values?
  • A: int
  • B: boolean
  • C: char
  • D: float
View Answer
B

Q45: How do you convert a String to a double in Java?
  • A: Double.parseDouble(value)
  • B: Float.parseFloat(value)
  • C: Integer.parseInt(value)
  • D: Boolean.parseBoolean(value)
View Answer
A

Q46: What does a class in Java represent?
  • A: A blueprint for objects
  • B: A method for calculations
  • C: A type of variable
  • D: A static method
View Answer
A

Q47: What is the purpose of a constructor in Java?
  • A: To initialize an object
  • B: To destroy an object
  • C: To print object data
  • D: To define static variables
View Answer
A

Q48: How are object attributes typically accessed outside the class?
  • A: Directly
  • B: Through getters and setters
  • C: Using public access
  • D: Through static methods
View Answer
B

Q49: What keyword is used to restrict access to a class member only within the same class?
  • A: protected
  • B: private
  • C: public
  • D: default
View Answer
B

Q50: In Java, which method is automatically called to initialize an object?
  • A: finalize()
  • B: toString()
  • C: constructor
  • D: init()
View Answer
C

Test Your Knowledge

Take a timed quiz on Web Design and Development

🚀 Start Quiz Now