ion 1 What is the name for Java classes that are provided so
ion 1
What is the name for Java classes that are provided so that values of primitive data types can be treated as objects?
interfaces
extensions
wrappers
event handlers
1 points
Question 2
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?
input, calculate, print
cylinder, program, volume
height, cylinder, radius
radius, cylinder, print
1 points
Question 3
Which of the following is not a method of the class JTextField?
setText
setEditable
addActionListener
setVisible
1 points
Question 4
Which of the following methods is NOT part of the class JFrame?
setVisible
setSize
setTitle
getText
1 points
Question 5
Show output
Get input
Get input and show results
Display a prompt to the user
1 points
Question 6
To create a window, which of the following classes has to be extended?
Container
JFrame
JButton
JTextField
1 points
Question 7
To display a window, you must invoke the method ____.
displayWindow
show
setVisible
setDisplay
1 points
Question 8
The Java class that you use to create windows is ____.
JTextField
JFrame
JButton
JLabel
1 points
Question 9
Which method is used to register a listener object to a button object?
addActionListener
registerButton
eventButton
buttonListener
1 points
Question 10
A(n) ____ is a method of a class that is automatically executed when an object of the class is created.
inheritance
package
constructor
interface
1 points
Question 11
Which package will you most likely have to import in order to write a GUI program?
java.awt.*
java.io.*
java.text.*
java.net.*
1 points
Question 12
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?
Pay_Rate
Hours_Worked
Employee
Pay
1 points
Question 13
Which method contains the code that the program executes when a specific event is generated?
buttonListener
GUIListener
actionPerformed
windowListener
1 points
Question 14
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?
subclass
superclass
method
package
1 points
Question 15
Which class is part of the package java.awt?
JFrame
JButton
JOptionPane
Container
1 points
Question 16
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?
hoursWorked
employee
pay
job
1 points
Question 17
Calculate
Exit
Both Calculate and Exit
Perimeter
1 points
Question 18
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?
Radius of the base
Surface area
Volume
Input
1 points
Question 19
Which of the following sets the window width to 100 pixels and the height to 200 pixels?
setSize(100, 200);
setSize(200, 100);
setDims(100, 200);
set(200, 100);
1 points
Question 20
Which of the following is NOT a required attribute of a window?
title
width
height
color
| interfaces | ||
| extensions | ||
| wrappers | ||
| event handlers |
Solution
Hi, I have answered frist 6 questions.
Please repost others in separate post.
Please let me knwo in case of any issue in answered part.
Q1.
wrapper
Wrappers are the classes that provides the object for each primitive type
Q2.
height, cylinder, radius
First we need container information, here is cylinder
THen to calculate volume and area, we need radius and height
Q3.
setVisible : it is part of JComponent
Q4.
getText is not part of JFrame
Q5.
Image is not visible
Q6.
JFrame : you need to extend this class to create your own Frame class
Q7.
setVisible : you need to make setVisible(true)





