Deck 6: Graphical User Interface GUI and Object-Oriented Design OOD

Full screen (f)
exit full mode
Question
If lengthTF is a JTextField and pane is a container, then the statement pane.add(lengthTF); adds the text field to the content pane of a window.
Use Space or
up arrow
down arrow
to flip the card.
Question
Whenever there is a superclass-subclass relationship, the superclass inherits all data members and methods of the subclass.
Question
Every window has a title, width, and height.
Question
The class Container is included in the package java.awt.
Question
The class JFrame contains the method setSize.
Question
The GridLayout manager arranges GUI components in a list formation.
Question
In object-oriented design, the nouns found in the problem specification can be used to select the operations in the program.
Question
The height and width of a window are measured in inches.
Question
In Java, data members are also known as fields.
Question
In Java, extends is a reserved word.
Question
The method getContentPane of the class JFrame is used to access the content pane of the window.
Question
When you click a JButton, an event, known as an action event, is created.
Question
GUI components are placed in a window called JFrame.
Question
The first step in solving a problem using object-oriented design is to identify objects.
Question
JTextFields are used to get input, but not show output.
Question
An interface is a class that contains only the method headings and each method heading is terminated with a semicolon.
Question
The method addWindowListener is included in the class JFrame.
Question
In object-oriented design, the verbs in the problem specification can be used to identify the objects in the program.
Question
The class ActionListener contains only one method, actionEvent.
Question
In Java, there is one way to make an application program create a window.
Question
To create a window, which of the following classes has to be extended?

A) Container
B) JFrame
C) JButton
D) JTextField
Question
Which of the following is NOT found within the content pane?

A) labels
B) title bar
C) text areas
D) buttons
Question
To display a window, you must invoke the method ____.

A) displayWindow
B) show
C) setVisible
D) setDisplay
Question
Which of the following is NOT a required attribute of a window?

A) title
B) width
C) height
D) color
Question
Which of the following sets the window width to 100 pixels and the height to 200 pixels?

A) setSize(100, 200);
B) setSize(200, 100);
C) setDims(100, 200);
D) set(200, 100);
Question
If Shape is a class and you create a new class Rectangle that extends Shape, then Shape is a(n) ____ and Rectangle is a(n) ____.Which word goes in the first blank in the sentence above?

A) subclass
B) superclass
C) inherited class
D) package
Question
To determine whether two reference variables of the Integer type point to the same Integer object, we can use either the method equals of the class Integer or the operator ==.
Question
Which of the following methods is NOT part of the class JFrame?

A) setVisible
B) setSize
C) setTitle
D) getText
Question
Which of the following from the window above is a JButton?

A) Calculate
B) Exit
C) Both Calculate and Exit
D) Perimeter
Question
The Java class that you use to create windows is ____.

A) JTextField
B) JFrame
C) JButton
D) JLabel
Question
Wrapper class objects are mutable.
Question
Which of the following is a reserved word in Java?

A) extends
B) pane
C) event
D) inheritance
Question
A(n) ____ is a method of a class that is automatically executed when an object of the class is created.

A) inheritance
B) package
C) constructor
D) interface
Question
Given the declaration, Integer x; After executing either of the following two statements, x points to an Integer object with value 8: x = 8;x = new Integer(8);
Question
Given the declaration, Integer num; The statement num = 8; is known as autoboxing of int type.
Question
To compare the values of two Integer objects for equality, we can use the method equals of the class Integer.
Question
The white areas in the figure above are used to do which of the following?

A) Show output
B) Get input
C) Get input and show results
D) Display a prompt to the user
Question
Which class is part of the package java.awt?

A) JFrame
B) JButton
C) JOptionPane
D) Container
Question
If Shape is a class and you create a new class Rectangle that extends Shape, then Shape is a(n) ____ and Rectangle is a(n) ____.Which word goes in the second blank of the sentence above?

A) subclass
B) superclass
C) method
D) package
Question
Which of the following statements is NOT true about GUI programs?

A) Every GUI program requires a window.
B) Every window has a title, width, and height.
C) All components are added directly to the GUI window.
D) A layout must be created before components can be added to a content pane.
Question
Which of the following is not a method of the class JTextField?

A) setText
B) setEditable
C) addActionListener
D) setVisible
Question
Write a program that takes as input the pay rate and hours worked of an employee and calculates the pay of the employee.Based on the problem statement above, which of the following would most likely be chosen as the class?

A) Pay_Rate
B) Hours_Worked
C) Employee
D) Pay
Question
Which method is used to register a listener object to a button object?

A) addActionListener
B) registerButton
C) eventButton
D) buttonListener
Question
Write a program to input the radius of the base and height of a cylinder, and calculate and print the surface area, volume, and area of the base of the cylinder.Which words from the problem statement above could we use to determine the operations for this program?

A) input, calculate, print
B) cylinder, program, volume
C) height, cylinder, radius
D) radius, cylinder, print
Question
What is the name for Java classes that are provided so that values of primitive data types can be treated as objects?

A) interfaces
B) extensions
C) wrappers
D) event handlers
Question
Which modifier is used to build classes on top of classes that are interfaces?

A) private
B) public
C) new
D) implements
Question
Which method contains the code that the program executes when a specific event is generated?

A) buttonListener
B) GUIListener
C) actionPerformed
D) windowListener
Question
Write a program that takes as input the pay rate and hours worked of an employee and calculates the pay of the employee.Based on the problem statement above, which of the following would be a data member?

A) hoursWorked
B) employee
C) pay
D) job
Question
Which package will you most likely have to import in order to write a GUI program?

A) java.awt.*
B) java.io.*
C) java.text.*
D) java.net.*
Question
Write a program to input the radius of the base and height of a cylinder, and calculate and print the surface area, volume, and area of the base of the cylinder.According to the problem statement above, which of the following would be a data member?

A) Radius of the base
B) Surface area
C) Volume
D) Input
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/50
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 6: Graphical User Interface GUI and Object-Oriented Design OOD
1
If lengthTF is a JTextField and pane is a container, then the statement pane.add(lengthTF); adds the text field to the content pane of a window.
True
2
Whenever there is a superclass-subclass relationship, the superclass inherits all data members and methods of the subclass.
False
3
Every window has a title, width, and height.
True
4
The class Container is included in the package java.awt.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
5
The class JFrame contains the method setSize.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
6
The GridLayout manager arranges GUI components in a list formation.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
7
In object-oriented design, the nouns found in the problem specification can be used to select the operations in the program.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
8
The height and width of a window are measured in inches.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
9
In Java, data members are also known as fields.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
10
In Java, extends is a reserved word.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
11
The method getContentPane of the class JFrame is used to access the content pane of the window.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
12
When you click a JButton, an event, known as an action event, is created.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
13
GUI components are placed in a window called JFrame.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
14
The first step in solving a problem using object-oriented design is to identify objects.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
15
JTextFields are used to get input, but not show output.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
16
An interface is a class that contains only the method headings and each method heading is terminated with a semicolon.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
17
The method addWindowListener is included in the class JFrame.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
18
In object-oriented design, the verbs in the problem specification can be used to identify the objects in the program.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
19
The class ActionListener contains only one method, actionEvent.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
20
In Java, there is one way to make an application program create a window.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
21
To create a window, which of the following classes has to be extended?

A) Container
B) JFrame
C) JButton
D) JTextField
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
22
Which of the following is NOT found within the content pane?

A) labels
B) title bar
C) text areas
D) buttons
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
23
To display a window, you must invoke the method ____.

A) displayWindow
B) show
C) setVisible
D) setDisplay
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
24
Which of the following is NOT a required attribute of a window?

A) title
B) width
C) height
D) color
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
25
Which of the following sets the window width to 100 pixels and the height to 200 pixels?

A) setSize(100, 200);
B) setSize(200, 100);
C) setDims(100, 200);
D) set(200, 100);
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
26
If Shape is a class and you create a new class Rectangle that extends Shape, then Shape is a(n) ____ and Rectangle is a(n) ____.Which word goes in the first blank in the sentence above?

A) subclass
B) superclass
C) inherited class
D) package
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
27
To determine whether two reference variables of the Integer type point to the same Integer object, we can use either the method equals of the class Integer or the operator ==.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
28
Which of the following methods is NOT part of the class JFrame?

A) setVisible
B) setSize
C) setTitle
D) getText
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
29
Which of the following from the window above is a JButton?

A) Calculate
B) Exit
C) Both Calculate and Exit
D) Perimeter
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
30
The Java class that you use to create windows is ____.

A) JTextField
B) JFrame
C) JButton
D) JLabel
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
31
Wrapper class objects are mutable.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
32
Which of the following is a reserved word in Java?

A) extends
B) pane
C) event
D) inheritance
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
33
A(n) ____ is a method of a class that is automatically executed when an object of the class is created.

A) inheritance
B) package
C) constructor
D) interface
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
34
Given the declaration, Integer x; After executing either of the following two statements, x points to an Integer object with value 8: x = 8;x = new Integer(8);
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
35
Given the declaration, Integer num; The statement num = 8; is known as autoboxing of int type.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
36
To compare the values of two Integer objects for equality, we can use the method equals of the class Integer.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
37
The white areas in the figure above are used to do which of the following?

A) Show output
B) Get input
C) Get input and show results
D) Display a prompt to the user
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
38
Which class is part of the package java.awt?

A) JFrame
B) JButton
C) JOptionPane
D) Container
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
39
If Shape is a class and you create a new class Rectangle that extends Shape, then Shape is a(n) ____ and Rectangle is a(n) ____.Which word goes in the second blank of the sentence above?

A) subclass
B) superclass
C) method
D) package
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
40
Which of the following statements is NOT true about GUI programs?

A) Every GUI program requires a window.
B) Every window has a title, width, and height.
C) All components are added directly to the GUI window.
D) A layout must be created before components can be added to a content pane.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
41
Which of the following is not a method of the class JTextField?

A) setText
B) setEditable
C) addActionListener
D) setVisible
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
42
Write a program that takes as input the pay rate and hours worked of an employee and calculates the pay of the employee.Based on the problem statement above, which of the following would most likely be chosen as the class?

A) Pay_Rate
B) Hours_Worked
C) Employee
D) Pay
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
43
Which method is used to register a listener object to a button object?

A) addActionListener
B) registerButton
C) eventButton
D) buttonListener
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
44
Write a program to input the radius of the base and height of a cylinder, and calculate and print the surface area, volume, and area of the base of the cylinder.Which words from the problem statement above could we use to determine the operations for this program?

A) input, calculate, print
B) cylinder, program, volume
C) height, cylinder, radius
D) radius, cylinder, print
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
45
What is the name for Java classes that are provided so that values of primitive data types can be treated as objects?

A) interfaces
B) extensions
C) wrappers
D) event handlers
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
46
Which modifier is used to build classes on top of classes that are interfaces?

A) private
B) public
C) new
D) implements
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
47
Which method contains the code that the program executes when a specific event is generated?

A) buttonListener
B) GUIListener
C) actionPerformed
D) windowListener
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
48
Write a program that takes as input the pay rate and hours worked of an employee and calculates the pay of the employee.Based on the problem statement above, which of the following would be a data member?

A) hoursWorked
B) employee
C) pay
D) job
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
49
Which package will you most likely have to import in order to write a GUI program?

A) java.awt.*
B) java.io.*
C) java.text.*
D) java.net.*
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
50
Write a program to input the radius of the base and height of a cylinder, and calculate and print the surface area, volume, and area of the base of the cylinder.According to the problem statement above, which of the following would be a data member?

A) Radius of the base
B) Surface area
C) Volume
D) Input
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 50 flashcards in this deck.