Question
Question 14 pts (TCOs 16) The column names that are displayed in a JTable can be specified by using the _____ method of the DefaultTableModel.
Question 14 pts
(TCOs 16) The column names that are displayed in a JTable can be specified by using the _____ method of the DefaultTableModel.
.formatColumns |
.setColumns |
.setColumnNames |
.setColumnIdentifiers |
Flag this Question
Question 24 pts
(TCOs 16) What is the output of the code below? double num = 56.4321; System.out.printf("%.2f", 56.4321);
%.2f |
%.2f56.4321 |
56.43 |
56.4321 |
Flag this Question
Question 34 pts
(TCOs 16) The signature of a method consists of
method name and parameter list. |
return type |
method name. |
parameter list. |
Flag this Question
Question 44 pts
(TCOs 16) Assume int[ ] t = {1, 2, 3, 4}. What is t.length?
5 |
4 |
0 |
3 |
Flag this Question
Question 54 pts
(TCOs 1 ,2, and 6) If a class contains a main method, that method is executed
automatically when the class is run. |
when another method within the class calls it. |
when an object is created from the class. |
None of the above |
Flag this Question
Question 64 pts
(TCOs 16) Invoking _____ returns the first element in an ArrayList x.
x.get(1) |
x.get() |
x.get(0) |
x.first() |
Flag this Question
Question 74 pts
(TCO 1, 4, and 6) The maximum number of radio buttons that can be selected within a ButtonGroup is
1. |
2. |
5. |
all. |
Flag this Question
Question 84 pts
(TCOs 16) Which statements are most accurate regarding the following classes? class A { private int i; protected int j; } class B extends A { private int k; protected int m; }
An object of B contains data fields j, m. |
An object of B contains data fields j, k, m. |
An object of B contains data fields k, m. |
An object of B contains data fields i, j, k, m. |
Flag this Question
Question 94 pts
(TCOs 16) Suppose ArrayList x contains two strings [Beijing, Singapore]. Which of the following methods will cause the list to become [Beijing, Chicago, Singapore]?
x.add("Chicago") |
x.add(2, "Chicago") |
x.add(0, "Chicago") |
x.add(1, "Chicago") |
Flag this Question
Question 104 pts
(TCOs 1, 5, and 6) The StringTokenizer method used to return the next field based on the delimiter character specified is
nextField. |
nextToken. |
Token. |
Field. |
Flag this Question
Question 114 pts
(TCOs 16) Which of the following statements causes the program to terminate when closing the frame?
frame.setDefaultCloseOperation(null) |
frame.setDefaultCloseOperation(JFrame.STOP_ON_CLOSE) |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) |
frame.setDefaultCloseOperation(JFrame.TERMINATE_ON_CLOSE) |
Flag this Question
Question 124 pts
(TCOs 1, 5, and 6) Which type of exception occurs if the write method of BufferedWriter cannot write data to the file?
WriteException |
IOException |
FileIOException |
FileException |
Flag this Question
Question 134 pts
(TCOs 16) What layout manager should you use so that every component occupies the same size in the container?
any layout |
a FlowLayout |
a BorderLayout |
a GridLayout |
Flag this Question
Question 144 pts
(TCOs 16) The event handler (e.g., actionPerformed) is a method in
both source and listener object. |
the EventObject class. |
a listener object. |
a source object. |
Flag this Question
Question 154 pts
(TCOs 16) The _____ method of JOptionPane is used to display a message dialog box.
showMessage |
displayMessageDialog |
showMessageDialog |
displayMessage |
Flag this Question
Question 164 pts
(TCOs 1, 4, and 6) Menus are attached to windows by calling the _____ method.
addMenuBar |
setJMenuBar |
setMenu |
addJMenuBar |
Flag this Question
Question 174 pts
(TCOs 16) Suppose you wish to provide an accessor method for a double instance variable named percent, what should the signature method be?
public static void getPercent() |
public double getPercent() |
public int getPercent() |
public void getPercent() |
Flag this Question
Question 184 pts
(TCOs 1, 4, and 6) The method used to add panels to a JTabbedPane is
newTab. |
newPanel. |
addPanel. |
addTab. |
Flag this Question
Question 194 pts
(TCOs 16) A constructor cannot
be overloaded. |
initialize variables to their defaults. |
specify return types or return values. |
have the same name as the class. |
Flag this Question
Question 204 pts
(TCOs 16) Given the declaration Circle x = new Circle(), which of the following statements is most accurate?
x contains an int value. |
You can assign an int value to x. |
x contains an object of the Circle type. |
x contains a reference to a Circle object. |
Flag this Question
Question 214 pts
(TCOs 1, 5, and 6) To add a database driver to a NetBeans project, you can add the JAR file for the driver to what folder?
The Source Packages folder |
The Libraries folder |
The Files folder |
The Services folder |
Flag this Question
Question 224 pts
(TCOs 16) _____ represents an entity in the real world that can be distinctly identified.
A class |
An object |
A data field |
A method |
Flag this Question
Question 234 pts
(TCOs 16) To execute the query "select * from Address" using the Statement object named stmt that has been properly configured with a database connection, use
stmt.executeUpdate("select * from Address");. |
stmt.execute("select * from Address");. |
stmt.executeQuery("select * from Address");. |
stmt.query("select * from Address");. |
Flag this Question
Question 244 pts
(TCOs 16) Suppose that your program accesses a MySQL database. Which of the following statements is false?
If the database is not available, the program will have a runtime error when attempting to create a connection object. |
If the driver for MySQL database is not in the classpath, the program will have a runtime error, indicating that the driver class cannot be loaded. |
If the driver for MySQL database is not in the classpath, the program will have a syntax error. |
If the database connection cannot be made, a SQLException occurs. |
Flag this Question
Question 254 pts
(TCOs 16) Which of the following statements is false?
PreparedStatement is for SQL SELECT statements only. You cannot create a PreparedStatement for SQL UPDATE statements. |
The parameters in a prepared statement are denoted using the ? sign. |
PreparedStatement is efficient for repeated executions. |
The first parameter in a perpared statement is number 1. |
Flag this Question
Question 264 pts
(TCOs 16) Which method can be used to write data to a text file opened with the BufferedWriter object outfile?
outfile.newLine(); |
outfile.existLine(); |
Write(outfile); |
outfile.write(); |
Flag this Question
Question 274 pts
(TCOs 16) Which type of exception occurs when creating a BufferedReader object for a nonexistent file?
FileNotExist |
FileNotFound |
FileNotExistException |
FileNotFoundException |
Flag this Question
Question 284 pts
(TCOs 16) Which class can be used to write data into a text file?
File |
BufferedWriter |
FileWrite |
WriteFile |
Flag this Question
Question 294 pts
(TCOs 16) Result set meta data are retrieved through
a Statement object. |
a Connection object. |
a ResultSet object. |
a PreparedStatement object. |
Flag this Question
Question 304 pts
(TCOs 16) Clicking a JCheckBox object generates _____ events.
ComponentEvent |
ContainerEvent |
ActionEvent |
JCheckBoxEvent |
Flag this Question
Question 314 pts
(TCOs 16) The method _____ gets the contents of the text field txtName.
txtName.findString() |
txtName.getText(s) |
txtName.getString() |
txtName.getText() |
Flag this Question
Question 324 pts
(TCOs 16) The method _____ appends a string s into the text area jta.
jta.appendText(s) |
jta.append(s) |
jta.setText(s) |
jta.insertText(s) |
Flag this Question
Question 334 pts
(TCOs 16) The method _____ gets the text (or caption) of the button btnAdd.
btnAdd.text() |
btnAdd.findText() |
btnAdd.retrieveText(). |
btnAdd.getText() |
Flag this Question
Question 344 pts
(TCOs 16) A JList object can be populated with data stored in a(n) _____ object.
ModelList |
DefaultListModel |
ListArray |
DefaultModelList |
Flag this Question
Question 354 pts
(TCOs 16) The _____ method of a check box returns true if that button is checked.
isSelected() |
getSelected() |
Selected() |
isChecked() |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started