Skip to main content

Web Design and Development MCQs with Answers

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

Multiple Choice Questions

Q161: Which package contains the original GUI components in Java?
  • A: java.awt
  • B: java.swing
  • C: java.util
  • D: java.io
View Answer
A

Q162: What method is used to make a JFrame visible?
  • A: setSize
  • B: setVisible
  • C: setLayout
  • D: addComponent
View Answer
B

Q163: Which layout manager arranges components in rows and columns?
  • A: FlowLayout
  • B: GridLayout
  • C: BorderLayout
  • D: BoxLayout
View Answer
B

Q164: What does a BorderLayout divide the window into?
  • A: Four regions
  • B: Three regions
  • C: Five regions
  • D: Six regions
View Answer
C

Q165: Which of the following is a Light Weight Component in Swing?
  • A: JFrame
  • B: JButton
  • C: TextField
  • D: Container
View Answer
B

Q166: What is the purpose of the getContentPane() method in JFrame?
  • A: Get the top-level container
  • B: Get the component area
  • C: Get the layout manager
  • D: Get the window title
View Answer
B

Q167: How do you specify the layout manager for a Container?
  • A: setLayout( new FlowLayout() )
  • B: setSize(new FlowLayout())
  • C: setLayoutManager(new FlowLayout())
  • D: setComponents(new FlowLayout())
View Answer
A

Q168: Which layout manager is used to place components in a grid?
  • A: FlowLayout
  • B: GridLayout
  • C: BorderLayout
  • D: BoxLayout
View Answer
B

Q169: In BorderLayout, where does the CENTER component go?
  • A: At the top of the window
  • B: At the bottom of the window
  • C: In the center of the window
  • D: At the left of the window
View Answer
C

Q170: How do you add a JButton to a JPanel in Swing?
  • A: myPanel.add(button)
  • B: myPanel.addComponent(button)
  • C: myPanel.setComponent(button)
  • D: myPanel.insert(button)
View Answer
A

Test Your Knowledge

Take a timed quiz on Web Design and Development

🚀 Start Quiz Now