NEW
Font size
WorksheetsPOST QUIZ JAVA
Total questions: 10
Worksheet time: 30mins
Identify the abbreviation of AWT.
Applet Windowing Toolkit
Abstract Windowing Toolkit
Absolute Windowing Toolkit
None of the above
Identify a method that can set or change the text in a Label.
setText();
getText();
getEditableText();
setSelectedText();
Choose a CORRECT component in AWT that can refer to Figure 1.
Label
Frame
TextField
TextArea
The following is NOT a valid button declaration
JButton b = new JButton( );
JButton b[ ] = new Jbutton[ ];
ButtonTest application = new ButtonTest();
Private JButton btnclose = new JButton(“Close”);
Choose the TRUE statement to create CheckBox component by referring to Figure 2.
Checkbox checkbox1 = new Checkbox(“Nasi Goreng”);
Checkbox checkbox2 = new Checkbox(“Roti Bakar”, true);
Checkbox checkbox1 = new Checkbox(‘Nasi Goreng’);
Checkbox checkbox2 = new Checkbox(‘Roti Bakar’, true);
Checkbox checkbox1 = new Checkbox[“Nasi Goreng”];
Checkbox checkbox2 = new Checkbox[“Roti Bakar”, true];
Checkbox checkbox1 = new Checkbox[‘Nasi Goreng’];
Checkbox checkbox2 = new Checkbox[‘Roti Bakar’, true];
Choose which of the following code snippets correctly changes the background color of a JFrame to blue?
getContentPane().setColor(Color.BLUE);
getContentPane().setBackground(Color.BLUE);
setBackColor(Color.BLUE);
setBackground(Color.BLUE);
The name of the Swing class that is used for frames is called
Frame
JFrame
Window
SwingFrame
Which of the following code snippets correctly sets the bounds of a JLabel named emailLabel to be at position (50, 250) with a width of 80 and a height of 25?
A. emailLabel.setBounds(250, 50, 80, 25);
A. emailLabel.setBounds(50, 250, 25, 80);
A. emailLabel.setBounds(50, 250, 80, 25);
A. emailLabel.setBounds(80, 25, 50, 250);
Choose the BEST answer to load the MySQL driver.
Class.forName(com.mysql.jdbc.Driver);
Class.forName(“com.mysql.jdbc.Driver”);
Class.loadClass(com.mysql.jdbc.Driver);
Class.loadClass(“com.mysql.jdbc.Driver);
Refering to Figure 3, choose the method to execute the staement if PreparedStatement preparedStatement = PreparedStatement(); is given.
preparedStatement.query()
preparedStatement.execute()
preparedStatement.executeUpdate()
preparedStatement.executeQuery()
