Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 5

The keyword "this" is used to ________

invoke constructor of the another class


invoke constructor of super class from sub class
invoke alternate constructor of the same class <-Riz

HashMap takes key as a/an ________


Array
FunctionPrimitive value
Object <-Riz

CREATE, ALTER, DROP are ________ SQL statements


None of given
DCL
DML
DDL <-Riz

In Java, if a super class method is protected then overriding method ________


must be public
may be either protected or public <-Riz
must be protected
must be private

All java files in a directory are compiled using ________ command in command prompt
javac *.java <-Riz
javac all
java *.java
javac all.java

It is verified by ________ that not all bytecodes violate java security


restrictions.
editor
bytecode verifier
class loader
compiler

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()

AWT is also called ________


Heavy weight components <-Riz
Light weight components
Both Light weight and heavy weight components
Neither Light weight nor heavy weight

Static methods can only access ________


Instance methods
Instance variables
Both static and instance members
Static variables and methods <-Riz

Assume that we do not want to serialize phoneNum attribute of PersonInfo class.


this can be done by:
server String phoneNum;
transient String phoneNum; <-Riz
client String phoneNum;
serialize String phoneNum;

Which of the following packages needs to import while handling files?


java.awt
java.util
java.io <-Riz
javax.swing

A scrollable and updatable ResultSet object has the following capabilities except
________
insert new rows
insert new columns <-Riz
delete rows
update rows

previous() is a method of ________ object.


ResultSetMetaData
Statement
ResultSet <-Riz
Connection

To compile "Test.java" class ________ command is used in java.


java Test.java
java Test
javac Test.java <-Riz
javac Test

TELNET works on ________ port.


23 <-Riz
21
84
80

Which of the following code statement is used to define a connection URL?


Class forName("sun.jdbc.odbc.JdbcOdbcDriver)
String asd = “jdbc:odbc:DSNname” <-Riz
Statement xyz = abc.createStatement()
Connection abc = DriverManager.getConnection(conURL)

The "MouseDragged" and "mouseMoved" methods are defined in ________ interface.


ItemListener
MouseMotionListener <-Riz
MouseListener
ActionListener

An applet is typically embedded in a Web page and can be run from a browser.
True <-Riz
False

________ understands the byte code?


Java Virtual Machine <-Riz
Java Interpreter
Operating system
Java compiler

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)

The ________ is directly connected with keyboard.


Filter stream
Node stream <-Riz
Character oriented stream
File stream

All AWT and swing components generate events.


False <-Riz
True

Which of the following is called "pure abstract class"?


Wrapper class
Interface <-Riz
Abstract class with no abstract method
Concrete class

getColumnCount() is a method of ________ object


Statement
DataBaseMetaData
ResultSet
ResultSetMetaData <-Riz

==========================

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

An applet can be defined as:


A small program written in JSP and included in an HTML page
A small program written in Java and included in an HTML page <-AMK
A small program written in Serverlet and included in an HTML page
A small program written inn JSF and included in an HTML page

Which of the following statements is used to attach an input stream to console?


FileReader fr = new FileReader(FileDescriptor in);
FileReader fr = new FileReader("input.txt"); <-AMK
FileReader fr = new FileReader(File Descriptor);
FileReader fr = new FileReader(console);

________ 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();

Which of the following syntax is used to create a client socket?


Socket s = new Socket("serverName");
Socket s = new Socket(serverport);
Socket s = new Socket("serverName", serverPort); <-AMK
Socket s = new Socket(serverPort."serverName");

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

You might also like