wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

GUI Quiz

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

A JFrame is a descendant of each of the following classes except the ________class.

a)

Component

b)

Jar

c)

Container

d)

Window

2.

The statement JFrame myFrame = new JFrame(); creates a JFrame that is _______.

a)

invisible and has no title

b)

invisible and has a title

c)

visible and has no title

d)

visible and has a title

3.

When a user closes a JFrame, the default behavior is for ______.

a)

the JFrame to close and the application to keep running

b)

the JFrame to be hidden and the application to keep running

c)

the JFrame to close and the application to exit

d)

nothing to happen

4.

Suppose that you create an application in which you instantiate a JFrame named frame1 and a JLabel named label1. Which of the following statements within the application adds label1 to frame1?

a)

label1.add(frame1);

b)

frame1.add(label1);

c)

this.add(label1);

d)

two of the above

5.

A JFrame contains a JButton named button1 that should execute an actionPerformed() method when clicked. Which statement is needed in the JFrame class?

a)

addActionListener(this);

b)

addActionListener(button1);

c)

button1.addActionListener(this);

d)

this.addActionListener(button1);

6.

Events in Java are objects that are created by Event Sources (such as JButtons, JPanels, and other Components).

a)

True

b)

False

7.

The three software parts of a GUI program are:

a)

Windows, Buttons, Mice

b)

GUI Components, Graphics, Code

c)

GUI Components, Event Listeners, Application Code

d)

Frames, Code, Events

8.

Fill in the blanks so that this program displays a Frame:

a)

Form, setVisible, setOn

b)

Frame, setSize, setVisible

c)

Frame, setVisible, setSize

d)

Window, setSize, paint

9.

Which is the container that doesn't contain title bar and MenuBars but it can have other components like button, textfield etc?

a)

Window

b)

Frame

c)

Panel

d)

Container

10.

The Java Foundation Classes (JFC) is a set of GUI components which simplify the development of desktop applications.

a)

True

b)

False