Test 1 Java Swings

This quiz tests knowledge of Java Swing GUI framework including components, event handling, imports, and layout management.

14 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which of the following classes in Java contains swing version of an applet?

  1. JButton
  2. JCheckBox
  3. JApplet
  4. AbstractButton
  5. JLabel
Question 2 Multiple Choice (Single Answer)

Which of the following statements is must in a Java program for creating a frame?

  1. import java.awt.*;
  2. import java.awt.event.*;
  3. import java.awt.frame;
  4. 1, 2 and 3
  5. only 1 and 2
Question 3 Multiple Choice (Single Answer)

Which of the following align arguments is not available in Java to be used in SwingConstants interface?

  1. Left
  2. Right
  3. Middle
  4. Leading
  5. Trailing
Question 4 Multiple Choice (Single Answer)

Which of the following classes of Java swing extends Applet class?

  1. JButton
  2. JApplet
  3. AbstractButton
  4. None of these
Question 5 Multiple Choice (Single Answer)

In Java swing, which of the following components is/are represented by a rectangular area in which a component may be viewed?

  1. Scroll pane
  2. Tabbed pane
  3. Combo boxes
  4. None of these
Question 6 Multiple Choice (Single Answer)

Which of the following classes in java.awt package describes a graphics device such as a screen or printer?

  1. Canvas
  2. GraphicsDevice
  3. Frame
  4. None of these
Question 7 Multiple Choice (Single Answer)

What is not true for a Java bean?

  1. There are no public instance variables.
  2. All persistent values are accessed using getxxx and setxxx methods.
  3. It may have many constructors as necessary.
  4. All of the above are true of a Java bean.
Question 8 Multiple Choice (Single Answer)

Which component of an event is the object that generates the event?

  1. Event object
  2. Event source
  3. Event handler
  4. None of these
Question 9 Multiple Choice (Single Answer)

_________ is generated when a button is pressed, a list item is double-clicked or a menu item is selected.

  1. Action Event
  2. Adjustment Event
  3. Component Event
  4. Container Event
Question 10 Multiple Choice (Single Answer)

Which of the following events is generated when the size, position or visibility of a component is changed?

  1. Adjustment Event
  2. Component Event
  3. Container Event
  4. Item Event
Question 11 Multiple Choice (Single Answer)

To create swing components, which of the following is imported?

  1. javax.awt.*
  2. java.awt.*
  3. javax.swing.*
  4. java.swing.*
Question 12 Multiple Choice (Single Answer)

Which event is generated when a checkbox or a list item is clicked or when a check menu item is selected or deselected?

  1. Container Event
  2. Component Event
  3. Focus Event
  4. Item Event
Question 13 Multiple Choice (Single Answer)

Swing elements are preceded by the letter

  1. S
  2. A
  3. X
  4. J
Question 14 Multiple Choice (Single Answer)

Which of the following user interfaces defines how should components be arranged in a container?

  1. Component
  2. Container
  3. Layout manager
  4. None of these