Font size
WorksheetsJava AWT Swings Quiz 1
Total questions: 24
Worksheet time: 11mins
Java was originally named:
Coffee
Oak
New C++
Duke
From where did Java get its name?
Coffee
Book
TV Programme
Initials of the developers of Java
When was Java released?
1975
1985
1995
2005
2015
What is the name of the Java mascot?
Duke
Ronny
Penguin
James
Jack
What was Java originally designed for?
Interactive TV
Internet
Gaming
Cars
Which company owns Java?
Oracle
Microsoft
Apple
Intel
What is the purpose of the line of code:
import java.awt.*;
To allow you to make Random number generators
To use an interface.
To import a package
To allow you to Scan from the terminal or a file.
Which of the lines of code DOES NOT call a method?
frame.setSize()
frame.setVisible(true);
JFrame frame;
frame.setResizable(false);
JFrame, JPanel, JLabel, JButton are examples of ...
methods
classes
interfaces
packages
What code adds this JButton to this JPanel?
JPanel panel = new JPanel();
JButton button = new JButton();
panel.add(button);
button.add(panel);
frame.add(panel);
panel.add(JButton);
How would you change the text of a label to the text contained by an integer named num;
label.setText(num);
label.updateText(num);
label.setTest("num");
label.setText(num+ "");
Which of the following layouts would be good to use for GUI that resembles a computer keyboard?
Flow Layout
Border Layout
Grid Layout
Null Layout
Which of the following layouts would be good to use for GUI that adjusts the position of objects when the screen is resized?
Flow Layout
Border Layout
Grid Layout
Null Layout
Which of the following layouts would be good to use for manually placing objects on a GUI?
Flow Layout
Border Layout
Grid Layout
Null Layout
What method(s) must we include in order to implement ActionListener?
paintComponent
actionEvent
actionPerformed
keyPressed
What method(s) must we include in order to implement KeyListener?
keyTyped
keyPressed
keyReleased
keyUsed
On a 1000 x 800 pixel JFrame, when we run the line of code below what shape appears on the screen?
g.fillRect(500,400, 30, 30);
A filled in square that is 30 pixels by 30 pixels.
A filled in rectangle that is 500 pixels wide by 400 pixels in height.
A filled in rectangle that is 400 pixels wide by 500 pixels in height.
The border of a rectangle that is 500 pixels wide by 400 pixels in height.
When you run the code below, what color will the rectangle be?
g.setColor(Color.BLUE);
g.fillRect(LpaddleX, LpaddleY, paddleW, paddleH);
g.setColor(Color.RED);
RED
BLUE
You'll get an error. Those colors aren't valid.
In order to make a class that inherits characteristics of JPanel, we need to use the key word...
public
class
extends
implements
throws
Which items below are interfaces?
ActionListener
JPanel
KeyListener
IOException
Which of the following is true about AWT and Swing components.
AWT components creates a process where as swing components creates a thread
AWT components creates a thread where as swing components creates a process
Both AWT and Swing components creates a process
Both AWT and swing components creates a thread
Which class is used to represent a single line textbox with password character facility?
TextField
TextArea
Label
Checkbox
The method ___________ places a Menu m into the MenuBar mb.
mb.addMenuItem(m)
mb.addItem(m)
mb.add(m)
None of these
Which of these Components cannot be added to Frame?
Label
ScrollPane
CheckBoxGroup
None of the above
