CS506 Midterm New
CS506 Midterm New
All java files in a directory are compiled using ________ command in command prompt
javac *.java <-Riz
javac all
java *.java
javac all.java
Given code is showing result of addition of two integer type numbers. Choose
correct output of this code.
Int i = y; int j = 8; int k = i+j;
System.out.println("Seven " + i + " plus Eight " + j + " is " + k);
Seven i plus Eight j is +15
Seven 7 plus Eight 8 is 15 <-
Seven plus Eight is k
Seven i plus Eight j is k
Which of the following statements is true about pmitive data types and reference
data types?
Primitive data types are created on stack whereas references are created on heap <-
Riz
Both primitive data types and references are are created on heap
Primitive data types are created on heap whereas references are created on stack
Both primitive data types and references are created on stack
The classes which contain the word ________ in their names are byte oriented
streams
Stream <-Riz
Reader
Writer
Byte
Which of the following method is used to determine whether a database is read only
or not?
isReadOnly() <-Riz
IsReadOnly()
isReadonly
isreadonly()
A scrollable and updatable ResultSet object has the following capabilities except
________
insert new rows
insert new columns <-Riz
delete rows
update rows
An applet is typically embedded in a Web page and can be run from a browser.
True <-Riz
False
Which command of the following commands is used to run "JavaTest" java file's
program?
javac JavaTest
java JavaTest.java
javac JavaTest.java
java JavaTest <-Riz
Following are the code statements used in java event handling. Identify the code
statement that is used for generating an event.
frame.setSize(150, 150)
b1 = new JButton("OK") <-Riz
b1.addActionListener(this) <-Me
frame = new JFrame
In the context of Socket Programming, the client does NOT know about the hostname
of the machine on which the server is running.
True
False <-Riz
Following are the code statements used in java event handling. Identify the code
statement that is used for handling an event.
public void actionPerformed(ActionEvent e) <-Riz
container.setLayout(new FlowLayout());
button = new JButton("Reset")
button.addActionListener(this)
==========================
Suppose strings are stored in a collection "arraylist". Get one string element and
store in element variable. Choose correct line of code for this requirement.
String element = String arraylist.get(i);
String element = element arraylist.get(i);
String element = (String)arraylist.get(i); <-AMK
________ is correct syntax to get component area of "myFrame" top level container.
Container c = myFrame.getContentArea();
Container c = myFrame.getContextPane(); <-AMK
Container c = myFrame.getComponentPane();
Container c = myFrame->getContentArea();
Following are the code statements used in java event hadling. Identify the code
statement that is used for registering event handler with event generator.
b1 = new JButton("OK")
frame = new JFrame()
b1 addActionListener(this) <-AMK
frame setSize(150,150)
Result Meta Data will help you in answering the following questions except:
How many columns are in ResultSet?
What is the name of given columns?
How many rows are in ResultSet?
Are the column name is case sensitive?
Teacher class wants to inherit from Employee java class, ________ keyword should be
used in blank space in given code to apply inheritance.
class Teacher ________ Employee{ public static void main (String args[]) { }}
inherit
implement
override
extends <-AMK