0% found this document useful (0 votes)
143 views762 pages

java mcq

mcq practice for java

Uploaded by

Apurva Chaudhari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
143 views762 pages

java mcq

mcq practice for java

Uploaded by

Apurva Chaudhari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 762

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material

A. WindowAdapter

B. KeyAdapter

C. MouseAdapter

D. All the above

Answer optiond

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
What is the output of following code?

import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class FrameClosing2 extends Frame


{
public FrameClosing2()
{
CloseMe cm = new CloseMe();
addWindowListener(cm);

setTitle("Frame closing Style 2");


4 setSize(300, 300);
setVisible(true);
}
public static void main(String args[])
{
new FrameClosing2();
}
}
class CloseMe extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}

A.

B.

C.

D.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionc

Marks: 2

5 _________ class have the KeyListerner interface.

A. KeyListernerAdapter

B. KeyAdapter

C. Adapter

D. None

Answer optionb

Marks: 1

Write correct word at blank spaces.

f.addWindowListener(new _____________
{
6 public void windowClosing(WindowEvent e)
{
System.exit(0);
}
________

A. } and );

B. WindowAdapter() and });

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. KeyAdapter() and });

D. Window and ;

Answer optionb

Marks: 2

Identify the correct adapter name and event name.

public class MyFocusListener extends _______________


{
public void focusGained(_________________ fe)
7
{
Button button = (Button) fe.getSource();
label.setText(button.getLabel());
}
}

A. Focusevent, Focusadapter

B. FocusAdapter, Event

C. FocusAdapter, FocusEvent

D. Adapter, FocusEvent

Answer optionc

Marks: 2

Adapter classes are an ____________class for receiving various


8 events.

A. Abstract

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Inner

C. Inline

D. Inherited

Answer optiona

Marks: 1

9 Adapter classes are used to create _________objects.

A. Class

B. Method

C. Package

D. Listener

Answer optiond

Marks: 1

10 Identify the class which is not an adapter class?

A. KeyAdapter

B. FocusAdapter

C. ItemAdapter

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. MouseMotionAdapter

Answer optionc

Marks: 1

Adapter classes are used to ___________ the process of event


11 handling.

A. solve

B. simplify

C. avoid

D. create

Answer optionb

Marks: 1

An _________ class listener interface and Event class Listener


12 interfa

A. adapter

B. Static

C. Inner

D. Super

Answer optiona

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

13 ____________is a subclass of ComponentEvent.

A. InputEvent

B. ContainerEvent

C. TextEvent

D. WindowEvent

Answer optionb

Marks: 1

An adapter class provides an _________ implementation of all methods


14 i interface.

A. pluggable

B. simple

C. empty

D. Interface

Answer optionc

Marks: 1

Which of the following method does not belongs to WindowListerner


15 in

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. windowActivated

B. windowClosed

C. windowClosing

D. windowReactivated

Answer optiond

Marks: 1

Which of the following method is invoked when a window is changed


16 fro minimized state?

A. windowActivated()

B. windowClosed()

C. windowClosing()

D. windowIconified()

Answer optiond

Marks: 1

17 What is adapter class for component listener interface?

A. Component

B. ComponentAdapter

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. ComponentListenerAdapter

D. None

Answer optionb

Marks: 1

18 Whether adapter classes use the methods of event classes?

A. Yes

B. No

C. Sometimes

D. Depends on some requirement

Answer optiona

Marks: 1

Which of these methods is defined in MouseMotionAdapter


19 class?

A. mouseDragged()

B. mousePressed()

C. mouseReleased()

D. mouseClicked()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 1

20 Which of these is a superclass of all Adapter classes?

A. Applet

B. ComponentEvent

C. Event

D. InputEvent

Answer optiona

Marks: 1

If an adapter class is inherited , there is no need of implementing


21 a listener interfaces .

A. Sometimes

B. Never

C. always

D. None

Answer optionc

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Adapter class can be also used for incorporating ___________property
22 o

A. Inheritance

B. Polymorphism

C. Encapsulation

D. All of the above

Answer optionc

Marks: 1

In Adapter class it is sufficient to include only the methods


23 required

A. True

B. False

C. Sometimes

D. Never

Answer optiona

Marks: 1

24 Adapter class makes programmers task easier .

A. Sometime

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. True

C. False

D. Never

Answer optionb

Marks: 1

25 Filling the blank.

this.addComponentListener(new ______________________ {
public void componentShown(ComponentEvent evt) {
System.out.println("componentShown");
}
});

A. Component()

B. componentadapter()

C. ComponentAdapter()

D. ContainerAdapter()

Answer optionc

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
What is the output of following code?

import java.awt.*;
import java.awt.event.*;
import java.applet.*;
/*<applet code="AdapterDemo" width=300 height=100>
</applet>
*/
public class AdapterDemo extends Applet {
public void init() {
addMouseListener(new MyMouseAdapter(this));
26 }
}
class MyMouseAdapter extends MouseAdapter {
AdapterDemo adapterDemo;
public MyMouseAdapter(AdapterDemo adapterDemo) {
this.adapterDemo = adapterDemo;
}
// Handle mouse clicked. public void
mouseClicked(MouseEvent me) {
adapterDemo.showStatus("Mouse clicked");
}
}

A. Mouse moved

B. Mouse dragged

C. Mouse pressed

D. Mouse clicked

Answer optiond

Marks: 2

27 _____________is a superclass of ContainerEvent .

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. ComponentEvent

B. WindowEvent

C. InputEvent

D. MouseMotionEvent

Answer optiona

Marks: 1

In an adapter class program, if it contains 5 methods, how many


28 method overriden?

A. 1

B. 2

C. 4

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. 5

Answer optiond

Marks: 1

Which is the abstract adapter class for receiving keyboardÂ


29 f

A. FocusListener

B. FocusAdapter

C. AdapterFocus

D. AdapterListerner

Answer optionb

Marks: 1

30 Adapter Class and interfaces are same.

A. Sometimes

B. Never

C. True

D. False

Answer optiond

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
ocusÂ
ev

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
31 Adapter class saves _________.

A. Time

B. Code

C. Space

D. All of the above

Answer optiond

Marks: 1

Following are the integer constants which does not belong to


32 ComponentEvent class .

A. COMPONENT_HIDDEN

B. COMPONENT_ICONIFIED

C. COMPONENT_MOVED

D. COMPONENT_SHOWN

Answer optionb

Marks: 1

__________ is a superclass of all AWT events that are handled by


33 the model.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. AWTEvent

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Event

C. UtilityEvent

D. AWT

Answer optiona

Marks: 1

A class which adapts methods of anoth


34 the same methods is called as
__________.

A. Inner Class

B. Simple Class

C. Adapter Class

D. Inherited Class

Answer optionc

Marks: 1

If a class MyWindowAdapter extends WindowAdapter and implements


35 wi method. How to register this class?

A. this.addWindowListener(new MyWindowAdapter());

B. this.addWindow(new MyWindowAdapter());

C. this.addWindowAdapter(new MyWindowAdapter());

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
er class by giving different
name

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. this.addWindowWindow(new MyWindowAdapter());

Answer optiona

Marks: 2

36 Commonly used methods of CardLayout class are____________

A. public void next(Container parent)

B. public void previous(Container parent)

C. public void first(Container parent)

D. all the above

Answer optiond

Marks: 1

Java allows a programmer to write a class within another class,is


37 call _______________ .

A. Abstract Class

B. Inner Class

C. Derived Class

D. Simple Class

Answer optionb

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

38 What are the different types of inner classes ?

A. Local

B. Anonymous

C. Both A & B

D. None

Answer optionc

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Fill the proper name of class.

import java.awt.*;
import java.awt.event.*;
import java.applet.*;
/*<applet code="AdapterDemo" width=300 height=100>
</applet>
*/
public class AdapterDemo extends Applet {
public void init() {
addMouseListener(new MyMouseAdapter(this));
39 }
}
class MyMouseAdapter extends MouseAdapter {
_________________ adapterDemo;
public MyMouseAdapter(AdapterDemo adapterDemo) {
this.adapterDemo = adapterDemo;
}
// Handle mouse clicked. public void
mouseClicked(MouseEvent me) {
adapterDemo.showStatus("Mouse clicked");
}
}

A. AdapterDemo

B. adapterdemo

C. AdapterDemo1

D. Adapter

Answer optiona

Marks: 2

40 Generates _____________ when the user enters a character.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. Text Event

B. Character Event

C. Label Event

D. TextField Event

Answer optiona

Marks: 1

41 MouseWheelEvent defines integer constants.

A. WHEEL_BLOCK_SCROLL,WHEEL_UNIT_SCROLL

B. BLOCK_SCROLL,UNIT_SCROLL

C. WHEEL_SCROLL,BLOCK_SCROLL

D. WHEEL_PAGE_SCROLL,WHEEL_TRACK_SCROLL

Answer optiona

Marks: 1

42 What is the return type of isTemporary( ) method?

A. int

B. Long

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. String

D. boolean

Answer optiond

Marks: 1

The abstract class ______________ is a subclass of ComponentEvent


43 and for component input events.

A. FocusEvent

B. InputEvent

C. WindowEvent

D. TextEvent

Answer optionb

Marks: 1

Inner class can access all the members of outer class


44 including_______

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
methods.

A. Private

B. Public

C. Protected

D. Static

Answer optiona

Marks: 1

45 ____________________can be achieved by using Inner Class.

A. Code Extension

B. Code Inheritance

C. Code Optimization

D. Code Development

Answer optionc

Marks: 1

The __________method returns the object that generated the


46 eve

A. Adjustable( )

B. getModifiers( )

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
nt.

C. getAdjustable( )

D. getAdjust( )

Answer optionc

Marks: 1

________ is a class which is declared inside the class or


47 interface.

A. Inner Class

B. Inherited Class

C. Nested Interfaces

D. Static Class

Answer optiona

Marks: 1

To handle any events of mouse, you must implement following


48 interfaces

A. MouseListener, MouseMotionListener, MouseWheelListener

B. MouseListener, MouseWheelListener

C. MouseMotionListener, MouseWheelListener

D. MouseListener

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 1

The _________method returns a reference to the component that was


49 adde from the container.

A. getParent( )

B. get( )

C. getTime( )

D. getChild( )

Answer optiond

Marks: 1

A class that have no name is known as_______________ inner class in


50 ja

A. Anonymous

B. Local

C. Nested

D. Static

Answer optiona

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
51 Which are two ways to create Java Anonymous inner class ?

A. Class,Interface

B. Class,Object

C. Interface,Object

D. Class,Constructor

Answer optiona

Marks: 1

52 Which event is generates, when button is pressed?

A. TextEvent

B. ItemEvent

C. InputEvent

D. ActionEvent

Answer optiond

Marks: 1

Which event is generates when checkable menu item is selected or


53 desel

A. ActionEvent

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. InputEvent

C. ItemEvent

D. TextEvent

Answer optionc

Marks: 1

If you compile a file containing inner class how many .class files
54 are

A. 1

B. 4

C. 3

D. 2

Answer optiond

Marks: 1

When a component is added to and removed from a container,


55 _________ generates.

A. ComponentEvent

B. WindowEvent

C. FrameEvent

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. ContainerEvent

Answer optiond

Marks: 2

56 What is the output of the following code :-

class TestMemberOuter1
{
private int data=30;
class Inner{
void msg(){System.out.println("data is "+data);}
}
void display()
{
Inner in=new Inner();
in.msg();
}
public static void main(String args[])
{
TestMemberOuter1 obj=new TestMemberOuter1();
obj.display();
}
}

A. error

B. data is Null

C. data is 30

D. data is 0

Answer optionc

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 2

57 The AdjustmentEvent class defines integer constants.

A. ALT, CTRL, META, and/or SHIFT

B. BLOCK_DECREMENT, BLOCK_INCREMENT,TRACK

C. ALT, CTRL, UNIT_INCREMENT,UNIT_DECREMENT

D. UNIT_INCREMENT,UNIT_DECREMENT,SHIFT

Answer optionb

Marks: 1

Since Nested class is a member of its enclosing class Outer, you


58 can notation to access Nested class and its members.

A. ->(arrow)

B. .(dot)

C. * (asterisk)

D. &(ampersand)

Answer optionb

Marks: 1

59 Inner classes provides______________ mechanism in Java.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. Safety

B. Protection

C. Security

D. Risk Handling

Answer optionc

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
60 ItemEvent class defines the integer constants.

A. DESELECT,SELECT

B. DESELECTED,SELECTED

C. ENABLED,NOTENABLED

D. CHECKED, UNCHECKED

Answer optionb

Marks: 1

The non-static nested classes are also known as


61 ______________

A. event class

B. class

C. adapter classes

D. inner classes

Answer optiond

Marks: 1

62 Inner class mainly used for _________________ .

A. for Code Optimization

B. to access all the members

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
_ .

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. to develop more readable and maintainable code

D. all of these

Answer optiond

Marks: 1

63 Can outer Java classes access inner class private members?

A. No

B. Sometimes

C. Yes

D. Never

Answer optionc

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
What is the output of following?

import java.applet.*;
import java.awt.event.*;
/*
<applet code="InnerClassDemo" width=200 height=100>
</applet>
64 */
public class InnerClassDemo extends Applet {
public void init() {
addMouseListener(new MyMouseAdapter());
} class MyMouseAdapter extends
MouseAdapter { public void
mousePressed(MouseEvent me) {
showStatus("Mouse Pressed"); }

}
}

A. Mouse Clicked

B. Mouse Moved

C. Mouse Dragged

D. Mouse Pressed

Answer optiond

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Fill in the blanks.

import java.applet.*;
import java.awt.event.*;
/*
<applet code="InnerClassDemo" width=200 height=100>
</applet>
*/
public class InnerClassDemo extends Applet {
65 public void init() {
__________ (new MyMouseAdapter());
}
class MyMouseAdapter extends _________________
{
public void mousePressed(MouseEvent me) {
showStatus("Mouse Pressed");
}
}
}

A. addMouse, Adapter

B. addMouseListener, Adapter

C. addMouseListener, MouseAdapter

D. addListener, MouseAdapter

Answer optionc

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
What is the output of the following java program?

class Outer {
void outerMethod() {
System.out.println("inside outerMethod");
// Inner class is local to outerMethod()
class Inner {
void innerMethod() {
System.out.println("inside innerMethod");
}
66 }
Inner y = new Inner();
y.innerMethod();
}
}
class MethodDemo {
public static void main(String[] args) {
Outer x = new Outer();
x.outerMethod();
}
}

A. inside innerMethod inside outerMethod

B. inside outerMethod inside innerMethod

C. inside innerMethod inside innerMethod

D. inside outerMethod inside outerMethod

Answer optionb

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Identify the correct adapter name and event name.

class MyWindowAdapter extends ________________


{
67 public void windowClosing(_____________ e)
{
System.exit(0);
}
}

A. Window, WindowEvent

B. WindowAdapter, Window

C. WindowAdapter, WindowEvent

D. Adapter, Event

Answer optionc

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
In the following code, what is the name of the inner class?
c class Periodical
Publi
{ long ISBN; public
class Book
{
68 public long getISBN()
{
retrun ISBN;
}
}

A. getISBN

B. Periodical

C. ISBN

D. Book

Answer optiond

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Identify the type of class for following code?

import java.applet.*;
import java.awt.event.*;
/*<applet code="Demo" width=300 height=100>
</applet>
*/
public class Demo extends Applet
{
69 public void init()
{
addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent me)
{ showStatus("Mouse Pressed");
}
});
}
}

A. Inner Class

B. Adapter class

C. Anonymous Inner Class

D. static class

Answer optionc

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 2
A. host name

In case of _______ we can implement only required methods


70
B. machineof any interface.
name

C. interface
A. local host

D. B. remote package
host

Answer C. optionc adapter classes

Marks: D. 1 event classes

73 The getByName()
Answer optionc method returns an ________________ with host n

A. IP address
Marks: 1

The ___________ method returns a value that indicates which mod


B. 71InetAddress Object
k when the event was generated.

C. port number
A. getModifiers( )

D. IPv4
B. getAdjustable( )

Answer optiona
C. Modifiers( )

Marks: 1
D. Adjustable( )

getAllByName() method returns an array of_____________ that


74 represents
Answer addresses that specific host name has
optiona

A. host names
Marks: 1

getLocalHost() method simply returns the InetAddress object wh


B. 72InetAddresses
represents______________

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
ich
C. ipaddresses ame

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. objects

Answer optionb

Marks: 1

what is the output of following


program import java.net.*; class Demo
{
public static void main(String arg[]) throws UnknownHostExcept
75 {
InetAddress ipa=InetAddress.getLocalHost();
System.out.println(ipa);
}
}

A. host name/IP address

B. iPAddress/Host name

C. IPAddress

D. Host name

Answer optiona

Marks: 2

76 Which type of Statement can execute parameterized queries?

A. ParameterizedStatement

B. PreparedStatement

C. ParameterizedStatement and CallableStatement

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
ion

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. All kinds of Statements

Answer optionb

Marks: 1

77 How can you retrieve information from a ResultSet?

By invoking the method get(String type) on the ResultSet, where type


A.
i

By invoking the method get(Type type) on the ResultSet, where Type


B.
is represents a database type

By invoking the method getValue(), and cast the result to the


C.
desired

By invoking the special getter methods on the ResultSet:


D.
getString(), getClob()

Answer optiond

Marks: 1

78 Which type of statement can execute parameterized queries ?

A. PreparedStatement

B. ParameterizedStatement

C. CallableStatement

D. All of the Above

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1
the method close() does not exist for a ResultSet. Only Connections
A.
ca
79 What is the meaning of ResultSet.TYPE_SCROLL_INSENSITIVE
B. the database and JDBC resources are released

This means that the ResultSet is insensitive to scrolling


A. you will get a SQLException, because only Statement objects can
C.
close
This means that the Resultset is sensitive to scrolling, but
B. the ResultSet, together with the Statement which created it and the Co
insensit i.e. not updateable
D.
the Statement was retrieved, will be closed and release all database a
This means that the ResultSet is sensitive to scrolling, but
C.
Answer optionb insensiti by others

Marks: The meaning depends on the type of data source, and the type an
D. 1
versi you use with this data source

82 What happens if you call deleteRow() on a ResultSet object?


Answer optionc
The row you are positioned on is deleted from the ResultSet, but not
A.
f
Marks: 1
The row you are positioned on is deleted from the ResultSet and from
B.
80t What statements are correct about JDBC transactions

The result depends onis


A transaction whether thesuccessfully
a set of property executed statements in
C. A. synchronizeWithDataSource false.
dat

A transaction is finished when commit() or rollback() is called


B. You will get a compile error: the method does not exist becau
D. the
from a ResultSet.
A transaction is finished when commit() or rollback() is called
C.
the
Answer optionb
A transaction is finished when close() is called on the Connect
D.
obj
Marks: 1

Answer optiond
83 What is correct about DDL statements

Marks: 1
DDL statements are treated as normal SQL statements, and are
A.
executed execute() method on a Statement
81 What happens if you call the method close() on a ResultSet obj

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
To execute DDL statements, you have to install additional support
B.
file

DDL statements can not be executed by making use of JDBC, you should
C.
u database tools for this

D. Support for DDL statements will be a feature of a f

Answer optiona

Marks: 1

Which of the following statements is false as far as different type


84 of concern in JDBC?

A. Regular Statement

B. Prepared Statement

C. Callable Statement

D. Interim Statement

Answer optiond

Marks: 1

JDBC facilitates to store the java objects by using which of the


85 metho Statement
1. setObject () 2. setBlob() 3. setClob()

A. 1, 2

B. 1, 2,3

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
ect? se
C. 1,3 you ca
uture
D. 2,3

release
of JD

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionb

Marks: 1

86 _______method to establish actual database connection.

A. executeQuery()

B. executeUpdate()

C. getConnection()

D. prepareCall()

Answer optionc

Marks: 1

Which of the following describes the correct sequence of the steps


inv connection with a database.
1. Loading the driver
87 2. Process the results.
3. Making the connection with the database.
4. Executing the SQL statements.

A. 1,3,4,2

B. 1,2,3,4

C. 2,1,3,4

D. 4,1,2,3

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 1

88 Which method is used to perform DML statements in JDBC?

A. execute()

B. executeQuery()

C. executeUpdate()

D. executeResult()

Answer optionc

Marks: 1

Can we retrieve a whole row of data at once, instead of calling an


89 in ResultSet.getXXX method for each column ?

A. No

B. Yes

C. Statement is incorrect

D. None of the above

Answer optionb

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
90 Are Prepared Statements actually compiled?

A. Yes

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. No

C. Statement is incorrect

D. None of the above

Answer optiona

Marks: 1

In order to transfer data between a database and an application


91 programming language, the JDBC API provides which of these met

Methods on the ResultSet class for retrieving SQL SELECT result


A.
Ja

Methods on the PreparedStatement class for sending Java types a


B.
s parameters.

Methods on the CallableStatement class for retrieving SQL OUT


C.
paramete

D. All mentioned above

Answer optiond

Marks: 1

92 _________calls get converted into native c or c++ API calls.

A. API

B. ODBC

C. JDBC API

hods?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. None of the above.

Answer optionc

Marks: 1

Which method Drops all changes made since the previous


93 commit/rollback

A. public void rollback()

B. public void commit()

C. public void close()

D. public Statement createStatement()

Answer optiona

Marks: 1

Which of the following is used to set the maximum number of rows


94 can

A. setMaxRows(int i)

B. setMinRows(int i)

C. getMaxrows(int i)

D. getMinRows(int i)

Answer optiona

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

____method of ResultSet is used to move the cursor to the row next


95 fro position.

A. fetch method

B. current method

C. next method

D. access method

Answer optionc

Marks: 1

Which of the following encapsulates an SQL statement which is passed


96 t be parsed, compiled, planned and executed?

A. DriverManager

B. JDBC driver

C. Connection

D. Statement

Answer optiond

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
The interface ResultSet has a method, getMetaData(), that returns
97 a/an

A. Tuple

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Value

C. Object

D. Result

Answer optionc

Marks: 1

Which method is used to find the number of column in


98 ResultSet

A. getNumberOfColumn()

B. getMaxColumn()

C. getColumnCount()

D. getColumns()

Answer optionc

Marks: 1

99 commit() method is belongs to which interface?

A. ResultSet

B. Statement

C. PreparedStatement

D. Connection

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiond

Marks: 1

100 Which one is the correct syntax for creating a Statement?

A. Statement stmt = connection.createStatements();

B. Statement stmt = connection.preparedStatement();

C. Statement stmt = connection.createStatement();

D. none of these

Answer optionc

Marks: 1

101 Which statement is correct?

ResultSet rs = stmt.selectQuery("SELECT ROLLNO,STUDNAME FROM


A.
STUDENT")

ResultSet rs = stmt.executeSelect("SELECT ROLLNO,STUDNAME FROM


B.
STUDENT

ResultSet rs = stmt.executeUpdate("SELECT ROLLNO,STUDNAME FROM


C.
STUDENT

ResultSet rs = stmt.executeQuery("SELECT ROLLNO,STUDNAME FROM


D.
STUDENT"

Answer optiond

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
102 INSERT, DELETE, UPDATE comes under ?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. Data Modification Language

B. Data Definition Language

C. Data Control Language

D. Data Manipulation Language

Answer optiond

Marks: 1

103 The return type of execute(String query) is?

A. int

B. ResultSet

C. boolean

D. void

Answer optionc

Marks: 1

Consider the following program. Select the missing statement in


given import java.sql.*; class PreparedExample{
public static void main(String args[]){
try{
104 Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:snrao","scott
PreparedStatement stmt=con.prepareStatement("select * f
rollno=?)");

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
rom
stud

stmt.setInt(1,1);
while( ------------------------------------------
{} rs.next())

con.close();
}catch(Exception e){ System.out.println(e);}

}
}

A. stmt.setString(2,"Ratan");

B. int i=stmt.executeQuery();

C. ResultSet rs=stmt.executeQuery();

D. ResultSet rs=stmt.executeQuery("select * from student―);

Answer optionc

Marks: 2

Consider the following code. To execute the query, which of the


follow used?

String sql = "update people set firstname=? , lastname=? where id=?";


105 preparedStatement = connection.prepareStatement(sql); preparedStatemen
"Gary");
preparedStatement.setString(2, "Larson");
preparedStatement.setLong (3, 123);

A. int rowsAffected = preparedStatement.executeUpdate();

B. ResultSet rs=preparedStatement.executeQuery(sql);

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. int rowsAffected = preparedStatement.executeQuery(sql);

D. ResultSet rs=preparedStatement.executeUpdate();

Answer optiona

Marks: 2

106 which method is used to insert image in database

A. statement.getImage()

B. statement.getDouble()

C. statement.getBLOB()

D. statement.getIcon()

Answer optionc

Marks: 1

All raw data types (including binary documents or images) should be


107 re the database as an array of

A. byte

B. int

C. char

D. long

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 1

Consider the following code and Select the missing statement in


108 given

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
import java.sql.*;
class MySQL
{
public static void main(String args[]){ try{
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection( error
"jdbc:mysql://localhost:3306/dsn","root","root");
Statement stmt=con.createStatement();
------------------------------------------------------------
while(rs.next())
System.out.println(rs.getInt(1)+" "+rs.getString(2)+"
"+rs.getString(3 con.close();
}catch(Exception e){ System.out.println(e);}
}
}

A. ResultSet rs=stmt.runQuery("select * from emp");

B. ResultSet rs=stmt.executeQuery("select * from emp");

C. int n=stmt.executeQuery("select * from emp");

D. int n=stmt.executeUpdate("select * from emp");

Answer optionb

Marks: 2

Consider the following program. Find which statement


contains import java.awt.*; import javax.swing.*;
/*
<applet code="JTableDemo" width=400 height=200>
</applet> */
109 public class JTableDemo extends JApplet
{
public void init()
{
Container contentPane = getContentPane();
contentPane.setLayout(new BorderLayout());

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
final String[] colHeads = { "Name", "Phone", "Fax"
}; final Object[][] data = { { "Pramod", "4567",
"8675" },
{ "Tausif", "7566", "5555" },
{ "Nitin", "5634", "5887" },
{ "Amol", "7345", "9222" },
{ "Vijai", "1237", "3333" },
{ "Ranie", "5656", "3144" },
{ "Mangesh", "5672", "2176" }, {
"Suhail", "6741", "4244" },
{ "Nilofer", "9023", "5159" },
{ "Jinnie", "1134", "5332" },
{ "Heena", "5689", "1212" },
{ "Saurav", "9030", "1313" },
{ "Raman", "6751", "1415" }
};
JTable table = new JTable(data, colHeads);
int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED; int
h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp = new JScrollPane(table, v, h);
contentPane.add(jsp, BorderL

A. No error

B. error

C. compile time error

D. Run time errror

Answer optiona

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Consider the following code and write the value of String sql to
delet employee. import java.sql.*; import java.util.*;
110 public class DeleteRecord
{
public static void main(String args[]) throws Exception

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
{
String sql;
Scanner sc=new Scanner(System.in);
System.out.println("Please Enter the ID no:");
int num = sc.readInt();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:od Statement
stmt=con.createStatement(); int affectedRecords =
stmt.executeUpdate(sql); br.close();
stmt.close(); con.close();
}
}

A. sql="delete from Employee where empid="+ num

B. sql="delete * Employee where empid="+ num

C. sql=" select * from Employee "

D. sql="delete from Employee where empid="

Answer optiona

Marks: 2

Following four methods belongs to which class?


1) public void add(Component c)
111 2) public void setSize(int width,int height)
3) public void setLayout(LayoutManager m)
4) public void setVisible(boolean)

A. Graphics class

B. Component class

C. Both A & B

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
bc:EMP","scott
"

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. None of the above

Answer optionb

Marks: 2

Which is the container that does not contain title bar and MenuBars
112 bu components like button, textfield etc?

A. Window

B. Menu bar

C. Panel

D. Output Screen

Answer optionc

Marks: 1

Whose object is to be created to show any number of choices in the


113 vis

A. JLabel

B. JButton

C. JList

D. JCheckbox

Answer optionc

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
What is used to store partial data results, as well as to perf
114 dyn return values for methods, and dispatch exceptions?

A. Window

B. Button

C. Container

D. Frame

Answer optiond

Marks: 2

115 Which class is used for processActionEvent( ) Processing Metho

A. JButton,JList,JMenuItem

B. JButton Only

C. JScrollbar

D. None of the above

Answer optiona

Marks: 1

a) It is lightweight.
b) It supports pluggable look and feel.
116 c) It follows MVC (Model View Controller) architecture
Above advantages are of _____________

d ?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. Swing

B. AWT

C. Networking

D. Databases

Answer optiona

Marks: 1

JFrame myFrame = new JFrame ();


Any command (such as the one listed above) which creates a new
117 object
(in this case a new JFrame object called myFrame) is generally
called

A. Constructor

B. Layout manager

C. Parameter

D. GUI

Answer optiona

Marks: 2

Suppose you are developing a Java Swing application and want to


118 toggle views of the design area. Which of the views given below are
present f toggle?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. Design View

B. Requirement View

C. Source View

D. Toggle View

Answer optionb

Marks: 2

119 The size of a frame on the screen is measured in:

A. Inches

B. Centimetres

C. Dots

D. Pixels

Answer optiond

Marks: 1

The layout of a container can be altered by using which of the


120 followi

A. setLayout(LayoutManager)

B. layoutmanager(LayoutManager)

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. addLayout(LayoutManager)

D. setLayoutManager(LayoutManager)

Answer optiona

Marks: 1

In JDBC _____ imports all java classes concerned with database


121 connect

A. javax.sql.*

B. java.mysql.*

C. java.sql.*

D. com.*

Answer optionc

Marks: 1

122 Methods of ResultSet throws ...... exception.

A. IOException

B. SQLException

C. MethodNotFoundException

D. ResultSetException

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionb

Marks: 1

123 Which of the following is FALSE with reference to JDBC Driver

A. All drivers implements the java.sql.Driver interface.

B. driver classes are not supplied by the database vendor

C. Driver class return a java.sql.Connection object.

D. None of the Above

Answer optionb

Marks: 1

How do you indicate where a component will be positioned using


124 Flowlay

A. North, South, East, West

B. Assign a row/column grid reference

C. Do nothing, the FlowLayout will position the component

D. Pass a X/Y percentage parameter to the add method

Answer optionc

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Match the following
i) Type 1 Driver a) Native API, partly Java
125 ii)Type 2 Driver b) Pure Java direct to database
iii)Type 3 Driver c) JDBC-ODBC bridge
iv)Type 4 Driver d) Pure Java to database middleware

A. i -> c, ii -> b , iii -> d, iv -> a

B. i -> c, ii -> a , iii -> d, iv -> b

C. i -> c, ii -> a , iii -> b, iv -> d

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. i -> c, ii -> d , iii -> a, iv -> b

Answer optionb

Marks: 1

126 PreparedStatements are used for calling........ statements

A. Interpreted Statements

B. Exceuted statements

C. Resultset statements

D. precompile Statement

Answer optiond

Marks: 1

Which TextComponent method is used to set a TextComponent to


127 t

A. setReadOnly()

B. setRead()

C. setUpdate()

D. setTextReadOnly()

Answer optiona

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
he
read-

Which type of Driver communicate using a network protocol to a


128 middlew

A. Type 1 Driver

B. Type 2 Driver

C. Type 3 Driver

D. Type 4 Driver

Answer optionc

Marks: 1

129 Which method will cause a JFrame to get displayed?

A. show( )

B. setVisible( )

C. showFrame( )

D. displayFrame( )

Answer optionb

Marks: 1

Which of the Following Drivers Sun describes it as being


130 experimental use only where no other driver is available.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. Type 1 Driver

B. Type 2 Driver

C. Type 3 Driver

D. Type 4 Driver

Answer optiona

Marks: 1

131 ___________ interface allows storing results of query?

A. ResultSet

B. Connection

C. Statement

D. Result

Answer optiona

Marks: 1

Which of the Following Drivers require native library files to be


132 inst on client systems.

A. Type 1 Driver

B. Type 2 Driver

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. Type 3 Driver

D. Type 4 Driver

Answer optionb

Marks: 1

133 InetAddress also Includes a factory method called____

A. getByAddress()

B. getHostName()

C. getAddress()

D. getIPAddress()

Answer optiona

Marks: 1

Which of the following statements are TRUE in case of Type 2 JDBC


134 Driv

A. It use native methods to call vendor-specific API functions.

B. native library files are to be installed on client systems.

C. Both of the Above

D. None of the Above

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionc

Marks: 1

135 in JDBC 2.0 a Connection object is created either by a call to

A. DriverManager.getConnection()

B. DataSource.Connection()

C. Both of the Above

D. None of the Above

Answer optiona

Marks: 1

136 How to create the Tabbed pane in swings?

A. JTab jt=new JTab();

B. JTabPane jt=new JTabPane();

C. JTabP =new JTabP();

D. JTabbedPane jt=new JTabbedPane ();

Answer optiond

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
137 In JDBC URL string protocol is always

A. jdbc

B. odbc

C. Jdbc-odbc

D. Any one of the above

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 1

Choose the correct option to insert rollno and student name int
138 table display its contents

import java.sql.*; class Example1{


("jdbc:oracle:thin:@localhost:1521:xe","sys
A.
PreparedStatement stmt=con.prepareStatement("insert int
System.out.println(e);} } }

import java.sql.*; class Example1{


("jdbc:oracle:thin:@localhost:1521:xe","system"
B.
PreparedStatement stmt=con.preparedStatement("insert in
stmt.setInt(1,"Ratan"); stmt.setString(2,101); in

import java.sql.*; class Example1{ values(?,?)")


; stmt.setInt(1,101);
C. i=stmt.executeQuery(); con.close(); }catch(Exception
System.out.println(e);} } }

import java.sql.*; class Example1{


("jdbc:oracle:thin:@localhost:1521:xe","system"
PreparedStatement stmt=con.preparedStatement("insert in
D.
stmt.setInt(1,101); stmt.setString(2,"Ratan");
i=stmt.executeUpdate(); con.close(); }catch(Exception
System.out.println(e);} } }

Answer optiond

Marks: 2

what is the output of following


program import java.net.*; class Demo
{
139 public static void main(String arg[])
{
InetAddress ip=InetAddress.getByName("www.google.com");

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
public static void main(

o studen

public static void


main(

to
stude t
i=stmt

public static void main(


stmt.setString(2,XYZ);
e){

public static void


main(

to
stude
int
e){

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
System.out.println(ip)
}

A. www.google.com/217.56.216.195

B. www.google.com

C. 217.56.216.195

D. All of the above

Answer optiona

Marks: 2

What does the following line of code do?


140 JTextfield text = new JTextfield(10);

A. Creates text object that can hold 10 columns of text.

B. Creates text object that can hold 10 rows of text.

C. Creates the object text and initializes it with 10.

D. The code is illegal

Answer optionc

Marks: 1

Which of the following is FALSE with reference to JDBC


141 databas

A. URL string has three components

e URL

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. protocol in URL string is always jdbc

C. subprotocol in URL string is always odbc.

D. subname identifies the specific database to connect

Answer optionc

Marks: 1

The Swing component classes that are used to encapsulate a mutually


142 ex buttons ?

A. AbstractButton

B. ButtonGroup

C. JButton

D. Button

Answer optionb

Marks: 1

143 Which class has strong support of the JDBC architecture?

A. The JDBC driver manager

B. JDBC driver test suite

C. JDBC ODBC bridge

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. All of these

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 1

Connection object can be initialized using the ____________meth


144 t Class.

A. putConnection()

B. setConnection()

C. Connection()

D. getConnection()

Answer optiond

Marks: 1

In model-view-controller (MVC) architecture of swings, model d


145 the_______________________________

A. Data layer

B. Presentation layer

C. Business-logic layer

D. Both A and C

Answer optiond

Marks: 1

efines

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Which of the following methods are needed for loading a database
146 drive

A. registerDriver() method

B. Class.forName ()

C. Both A and B

D. getConnection ()

Answer optionb

Marks: 1

147 Disadvantages of MVC architecture can be :

A. Navigation control is decentralized

B. Time consuming

C. both a& b

D. UI components are not user friendly

Answer optionc

Marks: 1

Native API converts ____________into the ________________used by


148 DBMS.

A. JDBC API, network protocol

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. JDBC API, Native API calls

C. JDBC API, User call

D. JDBC API, ODBC API calls

Answer optionb

Marks: 1

_______ method of DriverManager class is used to establish


149 connection

A. openConnection()

B. getConnection()

C. connect()

D. createConnection()

Answer optionb

Marks: 1

. . . . . . helps you to maintain data when you move from controller


150 t

A. View Bag

B. View Data

C. . Temp Data

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. Both A and B

Answer optiond

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

What is output of following


program import java.net.*; class
Demo
{
public static void main(String arg[]) throws UnKnownHostExcept
151 {
InetAddress ipa[]=InetAddress.getAllByName("www.google.com");
for(int i=0;i<ipa.length;i++){
System.out.println(ipa[i]); }
}
}

A. array of hostnames

B. array of hostname/IPaddress

C. array of IPaddress

D. IPAddress/Hostname

Answer optionb

Marks: 2

152 Which of the following view file types are supported in MVC?

A. .cshtml

B. .vbhtml

C. .aspx

D. All of the above

ion

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiond

Marks: 1

eated?
153 Can we use view state in MVC?

A. Yes

B. No

C. Both A & B

D. None of the above

Answer optionb

Marks: 1

154 subname part of JDBC URL string NOT contains

A. Database name

B. Username & password

C. Port number

D. Protocol

Answer optiond

Marks: 1

The code below draws a line. What is the color of the line
155 cr
g.setColor(Color.red.green.yellow.red.cyan);

g.drawLine(0, 0, 100,100);

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. Red

B. Green

C. Yellow

D. Cyan

Answer optiond

Marks: 1

What does the following code draw? g.setColor(Color.black);


g.drawLine(10, 10, 10,50);
156 g.setColor(Color.RED);
g.drawRect(100, 100, 150, 150);

A red vertical line that is 40 pixels long and a red square with
A.
sides

A black vertical line that is 40 pixels long and a red square with
B.
sid

A black vertical square that is 50 pixels long and a red square with
C.
s

A red vertical line that is 50 pixels long and a red square with
D.
sides

Answer optionb

Marks: 2

157 boolean equals(Object other) will return_______

A. Returns true if object has same internet address as other.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Returns False if object has same internet address as other.

C. Returns true if object has not same internet address as other.

D. Returns null if object has same internet address as other.

Answer optiona

Marks: 1

158 Which method is used to construct a 24-point bold serif font?

A. new Font(Font.SERIF, 24,Font.BOLD);

B. new Font("SERIF", 24, BOLD");

C. new Font("BOLD", 24,Font.SERIF);

D. new Font("SERIF", Font.BOLD,24);

Answer optiond

Marks: 1

159 What is the role of getAddress() method ?

A. returns Ip address of network.

Returns a byte array that represents the object's Ip address in


B.
ne

C. Returns an array of object's that represents Ip address .

D. Returns the a byte array of Ip address of network host machine

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionb

Marks: 1

Which of the following type of JDBC driver, is also called Type 3


160
Marks: 2JDBC

A. JDBC-ODBC Bridge plus ODBC driver


Analyse the following code and fill the appropriate statement in the
b import java.sql.*; class Demo
B. Native-API, partly Java driver
{
public static void main(String args[])throws Exception
{
C. JDBC-Net, pure Java driver
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
162 Connection con=DriverManager.getConnection("jdbc:odbc:stud");
D. Statement stmt=con.createStatement();
Native-protocol, pure Java driver
ResultSet rs=stmt.________________("select * from student where rollno
System.out.println("RollNo Name Branch"); where(rs.next()) {
Answer System.out.println(rs.getString(1)+"
optionc "+rs.getString(2)+"
con.close(); } }

Marks: 1
A. executeUpdate()
What will be the following code draw on the screen. Where "g" is a
gr the following code of line
161
B. executeQuery()
g.fillArc(45,90,50,50,90,180);
C. execute()
An arc bounded by a box of height 45, width 90 with a centre point of
A.
an angle of 90 degrees traversing through 180 degrees counter clockwis
D. All of the Above

An arc bounded by a box of height 50, width 50, with a centre point of
B.
Answer optionb
an angle of 90 degrees traversing through 180 degrees clockwis

Marks: 2An arc bounded by a box of width 50, height 50, with a top left at coo
C.
starting at 90 degrees and traversing through 180 degrees counter cloc

An arc starting at 45 degrees, traversing through 90 degrees clockwise


D.
of height 50, width 50 with a centre point of 90, 180.

Answer optionc

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
e.
What will be the output of the following program? The program
creates override the paint method as follows

import java.applet.*;
import java.awt.*;
163 public class HelloWorldApplet extends Applet {
public void paint (Graphics g) {
g.drawString ("Dolly",50,10);
}
}

"+rs.ge
tIn

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. The string "Dolly" will be displayed at the centre of the fram

An error at compilation complaining at the signature of the pai


B.
meth

C. The string "Dolly" will be seen at the top of the form

D. The string "Dolly" will be shown at the bottom of the form.

Answer optionc

Marks: 2

What is the output of the following


? import java.awt.*; import
javax.swing.*; public class FrameTest
extends JFrame { public
FrameTest() { add (new
JButton("First")); add (new
164 JButton("Second")); add (new
JButton("Third")); pack();
setVisible(true);
}
public static void main(String args [])
{ new FrameTest(); } }

A. Three buttons are displayed across a window.

B. A runtime exception is generated (no layout manager specified)

C. Only the first button is displayed.

D. Only the third button is displayed.

Answer optiond

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
e. .

Which of the following type of JDBC driver, is also called Type 1


165 JDBC

A. JDBC-ODBC Bridge Driver

B. Native API/ Partly java driver

C. All java / Net-protocol driver

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. Native protocol / all-java driver

Answer optiona

Marks: 1

Which of the following type of JDBC driver, is also called Type 2


166 JDBC

A. Native API/ Partly java driver

B. JDBC-ODBC Bridge Driver

C. Native protocol / all-java driver

D. All java / Net-protocol driver

Answer optiona

Marks: 1

Suppose a JPanel is added to a JFrame and a JButton is added to the JP


JFrames font is set to 12-point TimesRoman, the JPanels font is set to
167 TimesRoman, and the JButtons font is not set,what font will be taken t
JButtons label?

A. 12- point TimesRoman.

B. 11- point TimesRoman.

C. 10 -point TimesRoman

D. 09 -point TimesRoman.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionc

Marks: 1

Which of the following type of JDBC driver, is also called Type 4


168 JDBC

A. All java / Net-protocol driver

B. Native protocol / all-java driver

C. Native API/ Partly java driver

D. JDBC-ODBC Bridge Driver

Answer optionb

Marks: 1

What is the result of the following applet code ?

import java.applet.JApplet;
Import javax.swing.*;
public class Sample extends JApplet
{
169 private String text = "Hello World"; public
void init()
{
add(new JLabel(text));
}
public Sample (String string) {

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
text = string;
}
}
It is accessed form the following
HTML page: <html> <title>Sample Applet</title> <body> <applet
code="Sa width=200 height=200></applet></body></html>.

A. Prints "Hello World"

B. Generates a runtime error

C. . Does nothing

D. Generates a compile time error

Answer optionb

Marks: 2

import java.applet.JApplet;
import javax.swing.*;
public class Sample extends JApplet {
private String text = "Hello World"; public
void init()
{
add(new JLabel(text));
}
public Sample (String string)
170 {
text = string;
}
}
It is accessed form the following
HTML page: <html> <title>Sample Applet</title> <body> <applet
code="Sa width=200 height=200></applet></body></html>.

The method setLabel() can be used with what type of Object?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. Float

B. int

C. JTextField

D. String.

Answer optionc

Marks: 2

Which Swing Component classes that are used to Encapsulates a


171 mutually buttons?

A. AbstractButton

B. ButtonGroup

C. JButton

D. Button

Answer optionb

Marks: 1

Which method is used to add tooltip text to almost all components of


172 J

A. getToolTipText()

B. setToolTipText(String s)

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. setToolTip (String s)

D. getToolTipText(String s)

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionb

Marks: 1

173 In Swing the content pane can be obtained by using ________me

A. getContent()

B. getContentPane()

C. Both A & B

D. getContainedPane()

Answer optionb

Marks: 1

Which one of the following is the correct sequence of activitie


174 pe connectivity in java

Register the Driver class - Create statement - Create connecti


A.
Close connection

Register the Driver class - Create connection - Create stateme


B.
connection

Create connection - Register the Driver class - Create stateme


C.
connection

Create connection - Create statement - Register the Driver cla


D.
Close connection

Answer optionb

thod.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
on - Exe

nt -
Exec

nt -
Exec

ss - Exe

Marks: 1

175 Model is the _________ in the MVC architecture.

A. top most level

B. middle most level

C. bottom most level

D. None of the above

Answer optionc

Marks: 1

Double-buffering built in, tool tips, dockable tool bars, keyboard ,


176 a cursors, etc. are new features of _______?

A. AWT

B. Networking

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. Swing

D. All of the above

Answer optionc

Marks: 1

177 JCheckBox is ___________________Component .

A. heavyweight

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. mediumweight

C. No weight

:
D. lightweight

Answer optiond

Marks: 1

178 The default layout manager for the content pane of a swing is

A. CardLayout

B. GridLayout

C. BorderLayout

D. None of the above

Answer optionc

Marks: 1

Type of server in two-tier architectures which provides data to


179 client pages is called

A. transaction server

B. functional server

C. disk server

D. data server

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiond

Marks: 1

Application program interface in two tier architecture database


180 manage provided by the

A. close module connectivity

B. open module connectivity

C. close database connectivity

D. open database connectivity

Answer optiond

Marks: 2

181 Database system compiles query when it is

A. prepared

B. invoked

C. executed

D. initialized

Answer optiona

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Standard which allows access to DBMS by Java client programs is
182 classi

A. JCBD standard

B. JDBC standard

C. BDJC standard

D. CJBD standard

Answer optionb

Marks: 2

Which of the Following is NOT a valid Syntax for getConnection()


183 Metho

A. public static Connection getConnection(String url)

public static Connection getConnection(String url, String userID,


B.
Stri

public static Connection


C.
getConnection(jdbc:<subprotocol>:<subname>Str password)

D. None of the Above

Answer optiond

Marks: 1

In two-tier client/server architecture, running of application


184 program interface programs is in control of___________

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. modulation side

B. client side

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. server side

D. host side

Answer optionb

Marks: 2

185 Which of the following must be closed at end of Java program

A. Result

B. Connection

C. Query

D. Both A and B

Answer optionb

Marks: 1

186 A Java application program does not include declarations for

A. Data stored in database

B. Data retrieved of database

C. Data executed

D. Data manipulated

Answer optiona

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

A label is a simple control which is used to display


187 _________________on the window

A. button

B. Editable Text

C. Non-Editable Text

D. All of above

Answer optionc

Marks: 1

Which statement is true with respect to the following code?

import java.awt.*;
import javax.swing.*;
public class Test
{
public static void main(String[] args)
188 {
JFrame frame = new JFrame("My Frame");
frame.getContentPane().add(new JButton("OK"));
frame.getContentPane().add(new JButton("Cancel"));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(200, 200); frame.setVisible(true);
}
}

A. Only button OK is displayed.

B. Only button Cancel is displayed.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Both button OK and button Cancel are displayed and button OK is
C.
Answer optiona displa side of button OK.

Marks: Both button OK and button Cancel are displayed and button OK is
D. 1
displa side

191 getAlignment() is the method of ________ class.


Answer optionb

A. Button
Marks: 2

B. List
189 Label is ___________ entity.

C. Choice
A. Active

D. Label
B. Passive

Answer optiond
C. Both A& B

Marks: 1
D. None of these

Label(String str) creates a label that contains the string specified


192 b _________
Answer optionb

A. Right-Justified
Marks: 1

B. ___________ method is used to set or change the text in a Labe


190Left-Justified

C. setText(String strLabel)
A. Center-Justifed

D. B. All of getText()
above

Answer C. optionb getAlignment()

Marks: D. 1 None of these

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
193 Which of the following Statement is NOT true for Type-2 Driver

A. Driver needs to be installed separately in individual client m

B. The Vendor client library needs to be installed on client mach

Type-2 driver isn't written in java, that's why it isn't a portable


C.
dr

D. None of the Above

Answer optiond

Marks: 1

194 Which of the following method is used to set Label for Button

A. B.setLabel(String S)

B. B.getLabel()

C. Both A& B

D. B.setText(String S)

Answer optiona

Marks: 1

With respect to Type-3 drivers


A)Type-3 drivers are fully written in Java, hence they are portable
195 dr B)No client side library is required because of application server
tha tasks like auditing, load balancing, logging etc.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
l. s
A. A is True But B is False

B. B is True But A is False

achines

ine. B

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. Both are False

D. Both are True

Answer optiond

Marks: 1

196 The various controls supported by AWT are

A. Buttons,Scrollbar

B. Label,TabbedPanes

C. Tress,Tables

D. All of above

Answer optiona

Marks: 1

197 Which of the following is NOT true for Type - 4 drivers

A. Type-4 driver is also called native protocol driver.

B. Different driver is not needed for different database.

C. No client-side or server-side installation required.

It is fully written in Java language, hence they are portable


D.
drivers.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionb

Marks: 1

Which method does return true value if specified address is a


198 multicas

A. isMulticastHostName()

B. isMulticastHostAddress()

C. isMulticastAddress()

D. isMulticastIPAddress()

Answer optionc

Marks: 1

199 InetAddress has two subclasses called as:

A. IPV4Address() and IPV6Address()

B. IP4VAddress() and IP6VAddress()

C. Inet4Address() and Inet6Address()

D. InetAddress4() and InetAddress6()

Answer optionc

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
What is output of following
code? import java.net.*; class
200 Inet{
public static void main(String arg[]){ InetAddress
ip=InetAddress.getLocalHost();

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
System.out.println(ip.getHostAddress();
Marks: 1 }}

A.what is 192.168.0.100
the output of following
program import java.net.*; class Demo
{
B. localhost/192.168.0.100
public static void main(String arg[]) throws UnKnownHostExcept
{
202 C.InetAddress ipa=InetAddress.getLocalHost();
localhost machine InetAddress
ipa1=InetAddress.getLocalHost();
boolean b=ipa.equals(ipa1);
D.System.out.println(b);
localhost//8080:
}
}
Answer optionc

A. true
Marks: 2

B. false
what is the output of following
program import java.net.*; class Demo
C. 0 {
public static void main(String arg[]) throws UnKnownHostExcept
{
D. 1
201 InetAddress ipa=InetAddress.getLocalHost();
InetAddress ipa1=InetAddress.getLocalHost("www.google.com");
boolean b=ipa.equals(ipa1);
Answer optiona System.out.println(b);
}
}
Marks: 2

InetAddress class is used to encapsulate both numerical IP address


203 A. true
and

A. false
B.port number

B. compile time error


C.host name

C. 0
D.server name

D. socket name
Answer optionc

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
ion ion

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionb

Marks: 1

what is the output of following


program import java.net.*; class Demo
{
public static void main(String arg[]) throws UnKnownHostExcept
204 {
InetAddress ipa=InetAddress.getByName("www.google.com");
System.out.println(ipa.getHostName());
}
}

A. www.google.com

B. www.google.com/217.196.214.99

C. 217.196.214.99

D. None of the above

Answer optiona

Marks: 2

You can simply use InetAddress class when working with IP addre
205 beca accommodate both ___________ styles.

A. IP4V and IP6V

B. IPV4 and IPV6

C. host name and IP

ion

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. A and B

Answer optionb

Marks: 1

206 What does getHostAddress() of InetAddress class terurn?

A. Returns host address with ipaddress.

B. Returns a string that represents ipaddresses with hostname.

Returns a string that represents a host address associated with the


C.
In

Returns a string that represents a host name associated with


D.
Inetaddr

Answer optionc

Marks: 1

207 getHostName() of InetAddress class is used to_______

Return a string that represents host name associated with


A.
Inetaddress

Return a string that represents host address associated with


B.
Inetaddre

Return an object that represents Ipaddress associated with host


C.
name

D. Return Ipaddress that is associated with InetAddress object .

Answer optiona

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

208 Which of the following statement is correct ?

There are two kinds of sockets in java one is for server and other
A.
for

B. There is only one socket for server.

C. There is only one socket for client.

D. There is only one socket for server as well as for client.

Answer optiona

Marks: 1

Which of the following class is used to create server that listen


209 for

A. httpserver

B. ServerSocket

C. DatagramSocket

D. Socket

Answer optionb

Marks: 1

What happens if server socket is not able to listen on specified


210 port

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. The system exits gracefully with appropriate message

B. The system will wait till port is free.

C. IoExeption is thrown when opening the socket

D. PortOccupiedException is thrown.

Answer optionc

Marks: 1

Which exception will be thrown if client socket does not specify the
211 h created ?

A. IOException

B. UnknownHostException

C. UnknownHostNameException

D. UnknownPortException

Answer optionb

Marks: 1

Which constructor will you use to create client socket using a


212 preexsi object and a port ?

A. Socket (String hostname, int port )

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Socket (Inetaddress ipAdd, int port )

C. Socket (Inetaddress ip Add, string Hostname)

D. Socket ( int port, Inetaddress ipAdd )

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionb

Marks: 1

__________method returns the local part to which the invoking s


213 o

A. int getLocalHost()

B. int getLocalPort()

C. int getPort()

D. int GetLocalHost()

Answer optiona

Marks: 1

214 Which of the following are factory methods of InetAddress clas

A. static InetAddress[] getAllByName(String hostname)

B. static InetAddres getLocalHost()

C. string getHostName()

D. A and B

Answer optiond

Marks: 1

215 Which of the following methods belong to ServerSocket class

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
s?

A. accept()

B. connect()

C. bind()

D. A and C

Answer optiond

Marks: 1

216 ServerSocket class has one of the following constructor

A. ServerSocket(int port)

B. ServerSocket(String host, int port)

C. ServerSocket(int port, InetAddress add)

D. ServerSocket(InetAddress add, int port)

Answer optiona

Marks: 1

Socket method called______returns the port number that socket is


217 bound machine

A. int getLocalPortt()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. int getPort()

C. InetAddress getInetAddress()

D. string getHostAddress()

Answer optionb

Marks: 1

218 What are different factory methods of InetAddress class?

A. getByName()

B. GetLocalHost()

C. getByAddress()

D. both A & C

Answer optiond

Marks: 1

How long is an IPv6 address?


219

A. 32 bits

B. 128 bytes

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. 64 bits

D. 128 bits

Answer optiond

Marks: 1

__________________method is needed only when you instantiate the


220 socke argument constructer.

A. bind()

B. connect()

C. accept()

D. SetHostName()

Answer optionb

Marks: 1

InetAddress class having method which returns a string that shows


221 the address.

A. toString()

B. getHostAddress()

C. getLocalHost()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. none of the above

Answer optiona

Marks: 1

If server socket is created using serversocket () constructer then


222 whi use to bind the serve socket ?

A. isbind()

B. bind()

C. bind To()

D. bind ( socketAddress host , int backlog)

Answer optiond

Marks: 1

223 accept method is used for _______________________

A. Incoming Client connection

B. Incoming Server socket

C. Accepting request from server

D. Waiting socket

Answer optiona

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

_____________Class represents the socket that both the client &


224 server with each other

A. java.net.Serversocket

B. java.net.Server

C. Java.net.socket

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. java.net.Clientsocket

Answer optionc

Marks: 1

225 Socket s1= Socket ( localhost, 1346), What does it means ?

A. Client socket is waiting for connection

Client socket is created to connect with specified host name an


B.
port

C. Client socket is name as localhost and Port number is 1346

D. server socket is connected to local host with port number 134

Answer optionb

Marks: 1

What is the output of following statements Socket


226 s1=new Socket("localhost",1234);
int a=s1.getPort(); System.out.println(a);

A. localhost

B. localhost/1234

C. 1234

D. 1234/localhost

Answer optionc

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
6

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 2

227 Correct way of using ServerSocket is___________

A. ServerSocket(int port)

B. ServerSocket(int port,int maxQueue)

C. ServerSocket(int port,int maxQueue,InetAddress localAddress)

D. All of the above

Answer optiond

Marks: 1

What is the output of following statements?


ServerSocket ss=new ServerSocket(1349);
228 Socket s1=ss.accept();
System.out.println(ss.getLocalPort());

A. port number of client socket

B. 1349

C. local port

D. None of the above

Answer optionb

Marks: 1

229 public InputStream getInputStream() is method of ____________

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
class

A. Serversocket

B. ClientSocket

C. Socket

D. All of the above

Answer optionc

Marks: 1

230 getOutputStream() returns the output stream of the ________

A. Socket

B. ServerSocket

C. ClientSocket

D. None of the above

Answer optiona

Marks: 1

231 Which of the following statement is correct?

The input stream of socket is connected to the output stream of


A.
remote

The output stream of socket is connected to the input stream of


B.
remote

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
The output stream of socket is connected to the output stream of
C.
remot

D. A and B

Answer optiond

Marks: 1

__________method makes socket object no longer capable of connecting


232 a

A. send()

B. wait()

C. connect()

D. close()

Answer optiond

Marks: 1

If your application has successfully bound to specified port and is


233 re request then_________

A. an exception is thrown

B. an IOException is thrown

C. it does not throw an exception

D. UnknownHostException is thrown

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionc

Marks: 1

234 Socket is the combination of ______________ and __________.

A. IP address and port number

B. port number and local host

C. IPAddress and machine number

D. All of the above

Answer optiona

Marks: 1

Which steps occur when establishing a TCP connection between two


235 compu

The server initiates a ServerSocket object denoting port number to


A.
be

The server invokes the accept() method of ServerSocket class. This


B.
met client connects to the server on the given port

After the server is waiting, a client instantiates a socket object


C.
wit name and port number

D. All of the above

Answer optiond

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

What is the output of the following statement?


ServerSocket ss=new ServerSocket(1234);
236 Socket s1=ss.accept();
System.out.println(s1.getPort());

A. port number of client socket

B. 1234

C. local port

D. All of the above

Answer optiona

Marks: 2

What is the output of following statement?


ServerSocket ss=new ServerSocket(1234);
237 Socket s1=ss.accept();
System.out.println(s1.getRemoteSocketAddress());

A. 1234

B. iPAddress of serversocket

C. IPAddress of client with port number

D. IPAddress of server with port number

Answer optionc

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

What is the output of following statement?


238 Socket s1=new Socket("localhost",1234);
System.out.println(s1.getRemoteSocketAddress());

A. IPAddress of client with port number

B. host name, IPAddress and port number of Serversocket

C. host name and IPAddress Serversocket

D. IPAddress of server with port number

Answer optionb

Marks: 1

239 Connection timed out exception is occurred _________

A. if client socket is not created

B. if serversocket does not accept client request

if port number is not available which is specified by client socket


C.
wi

D. None of the above

Answer optionc

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Which method is used to expose the details of establishing
240 connection socket & client socket ?

A. connect()

B. receive()

C. there is no such method

D. None of the above

Answer optionc

Marks: 1

You can gain access to the input and output streams associated with
241 so getInputStream()

A. getOutStream()

B. setOutputStream()

C. getOutputStream()

D. getOutputClass()

Answer optionc

Marks: 1

Which exception will occur when port is already bound with an


242 applicat application is requesting for same port?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. IOException

B. PortNotFoundException

C. UnknownPortNameException

D. ConectException

Answer optiona

Marks: 1

When you will use this ServerSocket(int port, int que) constructor
243 to socket

A. to create ServerSocket with port number

B. to create ServerSocket with port number & Ip address

to create ServerSocket with port number and number of incoming


C.
client

D. B & C

Answer optionc

Marks: 1

Socket(InetAddress host, int port) in this constructor, what does


244 firs for ?

A. host name

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. host name and IPAddress specified by InetAddress object

C. IpAddress of host

D. ipaddress and port number

Answer optionb

Marks: 1

Which constructor will you use to connect to specified host and port
245 b on the local host at specified address & port

A. Socket()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Socket(String host, int port)

C. Socket (Inetaddress ipAdd,int port)

Socket ( String host,int port, Inetaddress ipAdd, int


D.
localpor

Answer optiond

Marks: 1

246 Which of the following class is used to create client socket

A. httpserver

B. Datagram Socket

C. Socket

D. ClientSocket

Answer optionc

Marks: 1

What will be the output of following statements


247 Socket s1=Socket("localhost",1349);
System.out.println(s1.getLocalPort());

A. 1349

B. port number of local machine

C. local host

t )

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. localhost/1349

Answer optionb

s
Marks: 2

248 Which of the following are Instance method of InetAddress Clas

A. byte[] getAddress()

B. string getHostName()

C. A and B

D. static InetAddress getByName(string hostname)

Answer optionc

Marks: 1

Which constructor of DatagramSocket class is used to create a


249 datagram it with the given port number?

A. DatagramSocket(int port)

B. DatagramSoclet(int port InetAddress add)

C. DatagramSoclet()

D. None of the above

Answer optiona

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
250 Which class is used for connection-less socket programming ?

A. DatagramSoclet

B. DatagramServer

C. A and B

D. None of the above

Answer optiona

Marks: 1

Which exception will occur if specified port number is not available


251 f

A. UnknownException

B. SocketException

C. UnknownSocketException

D. UnknownPortException

Answer optionb

Marks: 1

Which of the following constructor is used to create datagram socket


252 w host address

A. DatagramSoclet(int port)

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. DatagramSoclet(int port InetAddress add)

C. DatagramSoclet()

D. A & B

Answer optionb

Marks: 1

253 Which constructor will you use to send packet?

A. DatagramPacket(byte[] bar, int len)

B. DatagramPacket(byte[] bar, int len, int port)

C. DatagramPacket(string s1, int len, InetAddress, int port)

D. All of the above

Answer optionb

Marks: 1

Java DatagramSocket and DatagramPacket classes are used for


254 __________ programming

A. Connection-oriented

B. Connection-less

C. A & B

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. Reliable

Answer optionb

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

Datagram Packet is a message than can be used for _________


255 me

A. Connection-oriented or connection less

B. send and store

C. send and receive

D. receive and read

Answer optionc

Marks: 1

256 Which constructors are used to receive data from packet?

A. DatagramPacket(byte[] bar, int len)

B. DatagramPacket(byte[] bar, int off, int len)

C. DatagramPacket(string s1, int len, InetAddress, int port)

D. A and B

Answer optiond

Marks: 1

257 getData() & getLenght() are the methods of ___________ class

A. DatagramSoclet

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
ssages

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. ServerSocket

C. DatagramPacket

D. ClientSocket

Answer optionc

Marks: 1

What is the output of following code? DatagramPacket dp


258 =new DatagramPacket(byte[] data, 1024);
System.out.println(dp.getLength());

A. 1024

B. data, 1024

C. 1024, data

D. Null

Answer optiona

Marks: 2

259 Find the correct code from following program for given output

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
import java.awt.*;
import javax.swing.*;
/* <applet code="
JLabelDemo" width=250 height=150> </applet> */ public class
A. JLabelDemo public void init()
{
Container contentPane = getContentPane();
ImageIcon ii = new ImageIcon("IC.jpg");

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
JLabel jl = new JLabel("IC", ii, JLabel.CENTER); contentPane.add(jl);

import java.awt.*; import


javax.swing.*;
B. /* <applet code="JLabelDemo" width=250 height=150> </applet> * public
JLabelDemo extends JApplet { public void init() { Cont getContentPa
ImageIcon ii = new ImageIcon("IC.jpg"); JLabel jl = new JLabel("IC",

import java.awt.*; import


javax.swing.*;
/* <applet code="JLabelDemo" width=250 height=150> </applet> * public
class JLabelDemo extends JApplet
C. {
public void init()
{
ImageIcon ii = new ImageIcon("IC.jpg");
JLabel jl = new JLabel("IC", ii, JLabel.CENTER); co } }

/* <applet code="JLabelDemo" width=250 height=150> </applet> */ publi


D. extends JApplet { public void init() { Container contentPane = getC
ImageIcon ii = new ImageIcon("IC.jpg"); contentPane.add(jl); } }

Answer optiona

Marks: 2

Consider the following code and state the missing code. import
java.sql.*; class Example1{
public static void main(String args[]){ try{
Class.forName("oracle.jdbc.driver.OracleDriver"); Connection
260 con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe",
PreparedStatement stmt=con.prepareStatement("insert into Emp values(?,
---------------------------------------------- int
i=stmt.executeUpdate(); con.close();

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
ntentPane.add(jl);

}catch(Exception e){ System.out.println(e);}


}
}

stmt.setInt(1,101); stmt.setString(2,"Ratan");
A.
stmt.setString(2,50

stmt.setInt(1,101); stmt.setString(2,"Ratan");
B.
stmt.setInt(3,50000

C. stmt.setInt(1,101); stmt.setString(2,2); stmt.setInt(3,500

D. stmt.setInt(101); stmt.setString(2,2); stmt.setInt(3,50000

Answer optionb

Marks: 2

261 Choose the correct code to display the following output.

import javax.swing.*; /* <applet code="JCheckBoxDemo" width=400 height


public class JCheckBoxDemo extends JApplet implements ItemListener { J
public void init() { Container contentPane = getContentPane(); content
FlowLayout()); JCheckBox cb = new JCheckBox("C", true); cb.addItemList
contentPane.add(cb); cb = new JCheckBox("C++", false); cb.addItemListe
A. contentPane.add(cb); cb = new JCheckBox("Java", false); cb.addItemList
contentPane.add(cb); cb = new JCheckBox("Perl", false); cb.addItemList
contentPane.add(cb); jtf = new JTextField(15); contentPane.add(jtf); }
itemStateChanged(ItemEvent ie) { JCheckBox cb = (JCheckBox)ie.
jtf.setText(cb.getText()); } }

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
JLabel
import java.awt.*; import java.awt.event.*; import javax.swing.*; /*cl
extends JApplet implements ItemListener { JTextField jtf; public void
jl =
contentPane = getContentPane(); contentPane.setLayout(new FlowLayout()
new JCheckBox("C", true); cb.addItemListener(this); contentPane.add(cb
B. JCheckBox("C++", false); cb.addItemListener(this); contentPane.add(cb)
new
JCheckBox("Java", false); cb.addItemListener(this); contentPane.add(cb
JCheckBox("Perl", false); cb.addItemListener(this); contentPane.add(cb
JTextField(15); contentPane.add(jtf); } public void itemStateChanged(I
JCheckBox cb = (JCheckBox)ie.getItem(); jtf.setText(cb.getText()); } }

JLabel("IC", 00); );

import java.awt.*; import java.awt.event.*; import javax.swing.*; /* <


code="JCheckBoxDemo" width=400 height=50> </applet>
JApplet implements ItemListener { JTextField jtf; public void init() {
contentPane = getContentPane(); contentPane.setLayout(new FlowLayout()
new JCheckBox("C", true); cb.addItemListener(this)
JCheckBox("C++", false); cb.addItemListener(this);
contentPane.add(cb)
C. JCheckBox("Java", false); cb.addItemListener(this);
contentPane.add(cb
JCheckBox("Perl", false); cb.addItemListener(this); contentP
JTextField(15); contentPane.add(jtf); } public void
itemStateChanged(I
JCheckBox cb = (JCheckBox)ie.getItem(); jtf.setText(cb.getText()); }
}

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
import java.awt.*; import java.awt.event.*; import javax.swing
code="JCheckBoxDemo" width=400 height=50> </applet> */ public class JC
JApplet implements ItemListener { JTextField jtf; public void init() {
contentPane.add(cb); cb = new JCheckBox("C++", false); cb.addItemListe
D. contentPane.add(cb); cb = new JCheckBox("Java", false); cb.addItemList
contentPane.add(cb); cb = new JCheckBox("Perl", false); cb.addItemList
contentPane.add(cb); jtf = new JTextField(15); contentPane.add(jtf); }
itemStateChanged(ItemEvent ie) { JCheckBox cb = (JCheckBox)ie.getItem(
jtf.setText(cb.getText()); } }

Answer optionc

Marks: 2

262 Choose the correct code to display the following output.

import javax.swing.*; /* <applet code="JButtonDemo" width=250 height=


public class JButtonDemo extends JApplet implements ActionListener { J
public void init() { Container contentPane = getContentPane(); content
FlowLayout()); ImageIcon france = new ImageIcon("green.jpg"); JButton
JButton(france); jb.setActionCommand("Green"); jb.addActionListener(th
contentPane.add(jb); ImageIcon germany = new ImageIcon("red.jpg"); jb
A. JButton(germany); jb.setActionCommand("Red"); j
contentPane.add(jb); ImageIcon italy = new ImageIcon("yellow.jpg"); jb
JButton(italy); jb.setActionCommand("Yellow"); jb.addActionListener(th
contentPane.add(jb); ImageIcon japan = new ImageIcon("black.jpg"); jb
JButton(japan); jb.setActionCommand("Black"); jb.addActionListener(thi
contentPane.add(jb); jtf = new JTextField(15); contentPane.add(jtf); }
actionPerformed(ActionEvent ae) { jtf.setText(ae.getActionCommand());

import java.awt.*; import java.awt.event.*; import javax.swing.*; /* <


B.
code="JButtonDemo" width=250 height=300> </applet> */ public class JBu

getItem
( */
public
class
JC

; contentPane.add(cb

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
ane.add(cb .*; /* <

b.addActionListener(thi

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
;

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
JApplet implements ActionListener { JTextField jtf; public void
contentPane = getContentPane(); contentPane.setLayout(new FlowL
= new ImageIcon("green.jpg"); JButton jb = new JButton(france)
jb.setActionCommand("Green"); jb.addActionListener(this);
contentPane. germany = new ImageIcon("red.jpg"); jb = new
JButton(germany); jb.setActionCommand("Red");
jb.addActionListener(this); contentPane.ad italy = new
ImageIcon("yellow.jpg"); jb = new JButton(italy);
jb.setActionCommand("Yellow"); jb.addActionListener(this);
contentPane japan = new ImageIcon("black.jpg"); jb = new
JButton(japan); jb.setActionCommand("Black");
jb.addActionListener(this); contentPane. JTextField(15);
contentPane.add(jtf); } public void actionPerformed(Ac }
import java.awt.*; import java.awt.event.*; import javax.swing.
code="JButtonDemo" width=250 height=300> </applet> */ public cl
JApplet implements ActionListener { JTextField jtf; public void
contentPane = getContentPane(); contentPane.setLayout(new FlowL
= new ImageIcon("green.jpg"); JButton jb = new JButton(
jb.setActionCommand("Green"); jb.addActionListener(this); conte
germany = new ImageIcon("red.jpg"); jb = new JButton(ge
C. jb.setActionCommand("Red"); jb.addActionListener(this); content
italy = new ImageIcon("yellow.jpg"); jb = new JButton(
jb.setActionCommand("Yellow"); jb.addActionListener(this); con
new ImageIcon("black.jpg"); jb = new JButton(
jb.setActionCommand("Black"); jb.addActionListener(this); conte
JTextField(15); contentPane.add(jtf); } public void actionPerfo
jtf.setText(ae.getActionCommand());
import java.awt.*; import java.awt.event.*; import javax.swing.
code="JButtonDemo" width=250 height=300> </applet> */ public cl
JApplet implements ActionListener { JTextF
contentPane = getContentPane(); contentPane.setLayout(new
FlowLayout()
= new ImageIcon("green.jpg"); JButton jb = new JButton(
jb.setActionCommand("Green"); jb.addActionListener(this); con
D. = new ImageIcon("red.jpg"); jb = new JButton(ge
jb.setActionCommand("Red"); jb.addActionListener(this); content
italy = new ImageIcon("yellow.jpg"); jb = new JButton(
jb.setActionCommand("Yellow"); jb.addActionListener(this); cont
japan = new ImageIcon("black.jpg"); jb = new JButton(
jb.setActionCommand("Black"); jb.addActionListener(this); conte
JTextField(15); contentPane.add(jtf); } public void actionPerfo
jtf.setText(ae.getActionCommand()); } }

Answer optiond

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
tentPane ield jtf; public

void init()

;
tentPane
.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 2

263 Choose the correct code to display the following output.

import java.awt.*; import java.awt.event.*; import javax.swing.


code="JCheckBoxDemo" width=400 height=50> </applet> */ public c
JApplet implements ItemListener { JTextField jtf; public void i
contentPane = getContentPane(); contentPane.setLayout(new FlowL
new JCheckBox("C", true); cb.addItemListener(this); contentPane
JCheckBox("C++", false); cb.addItemListener(this); contentPane.
A. JCheckBox("Java", false); cb.addItemListener(this); contentPane
JCheckBox("Perl", false); cb.addItemListener(this); contentPane
JTextField(15); contentPane.add(jtf); } public void
itemStateChanged(I
JCheckBox cb = (JCheckBox)ie.getItem(); jtf.setText(cb.getText(
}

import javax.swing.*; /* <applet code="JCheckBoxDemo" width=40


public class JCheckBoxDemo extends JApplet implements ItemListe
public void init() { Container contentPane = getContentPane();
FlowLayout()); JCheckBox cb = new JCheckBox("C", true); cb.addI
B. contentPane.add(cb); cb = new JCheckBox("C++", false); cb.addIt
contentPane.add(cb); cb = new JCheckBox("Java", false); cb.addI
contentPane.add(cb); cb = new JCheckBox("Perl", false); cb.addI
contentPane.add(cb); jtf = new JTextField(15); contentPane.add(
itemStateChanged(ItemEvent ie) { J jtf.setText(cb.getText()); }

import java.awt.*; import java.awt.event.*; import javax.swing.


code="JCheckBoxDemo" width=400 height=50> </applet>
JApplet implements ItemListener { JTextField jtf; public void i
contentPane = getContentPane(); contentPane.setLayout(new FlowL
new JCheckBox("C", true); cb.addItemListener(this)
C. JCheckBox("C++", false); cb.addItemListener(this);
contentPane.add(cb)
JCheckBox("Java", false); cb.addItemListener(this); contentPane
JCheckBox("Perl", false); cb.addItemListener(this); contentP
JTextField(15); contentPane.add(jtf); } public void itemStateCh
JCheckBox cb = (JCheckBox)ie.getItem(); } }

import java.awt.*; import java.awt.event.*; import javax.swing.


code="JCheckBoxDemo" width=400 height=50> </applet> */ public c
D. JApplet implements ItemListener { JTextField jtf; public void i
contentPane = getContentPane(); contentPane.setLayout(new FlowL
new JCheckBox("C", true); cb.addItemListener(this); contentPane

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
CheckBox cb = (JCheckBox)ie.getItem(

*/ public class JC

; contentPane.add(cb

ane.add(cb

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
JCheckBox("C++", false); cb.addItemListener(this);
contentPane.add(cb)
JCheckBox("Java", false); cb.addItemListener(this); contentPane.add(cb
JCheckBox("Perl", false); cb.addItemListener(this); contentPane.add(cb
JTextField(15); contentPane.add(jtf); } public void
itemStateChanged(I ());
JCheckBox cb = (JCheckBox)ie.getItem(); jtf.setText(cb.getText

Answer optiona

Marks: 2

264 Choose the correct code to display the following output.

import java.awt.*; import java.awt.event.*; import javax.swing.*; /* <


code="JComboBoxDemo" width=300 height=100> </applet> */ public class J
extends JApplet implements ItemListener { JLabel jl; ImageIcon green,
public void init() { Container contentPane = getContentPane(); content
A. FlowLayout()); JComboBox jc = new JComboBox(); jc.addItem("Green"); jc
jc.addItem("Black"); jc.addItem("Yellow"); jc.addItemListener(this); c
jl = new JLabel(new ImageIcon("green.jpg")); contentPane.add(jl); } pu
itemStateChanged(ItemEvent ie) { String s = (String)ie.getItem(); jl.s
ImageIcon(s + ".jpg")); } }

import javax.swing.*; /* <applet code="JComboBoxDemo" width=300 heigh


public class JComboBoxDemo extends JApplet implements ItemListener { J
green, red, black, yellow; public void init() { Container cont
contentPane.setLayout(new FlowLayout()); JComboBox jc = new JComboBox(
B. jc.addItem("Green"); jc.addItem("Red"); jc.addItem("Black"); jc.addIte
jc.addItemListener(this); contentPane.add(jc); jl = new JLabel
ImageIcon("green.jpg")); contentPane.add(jl); } public void itemStateC
ie) { String s = (String)ie.getItem(); jl.setIcon(new ImageIcon(s + ".

import java.awt.*; import java.awt.event.*; import javax.swing.*; /* <


code="JComboBoxDemo" width=300 height=100> </applet> */ public class J
extends JApplet implements ItemListener { JLabel jl; ImageIcon green,
public void init() { contentPane.setLayout(new FlowLayout()); JComboB
C.
JComboBox(); jc.addItem("Green"); jc.addItem("Red"); jc.addItem("Black
jc.addItem("Yellow"); jc.addItemListener(this); contentPane.add(jc); j
ImageIcon("green.jpg")); contentPane.add(jl); } public void itemStateC
ie) { String s = (String)ie.getItem(); jl.setIcon(new ImageIcon(s + ".

import java.awt.*; import java.awt.event.*; import javax.swing.*; /* <


D.
code="JComboBoxDemo" width=300 height=100> </applet> */ public class J

entPane

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
(new

jp.add(

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
extends JApplet implements ItemListener { JLabel jl; ImageIcon
init() public void init()
{ Container { Container
contentPane contentPane = contentPane.setLayo
= getContentPane(); getContentPane();
BorderLayout()); JPanel
FlowLayout()); jp = newjc
JComboBox JPanel(); jp.setLayout(new
= new JComboBox(); GridLayout
jc.addItem("Gree
0; for(int i = 0; i < 20; i++) { for(int j = 0; j < 20; j++) {
jc.addItem("Black"); jc.addItem("Yellow"); jc.addItemListener(t
" + b)); ++b; } } int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NE
jl = new JLabel(new ImageIcon("green.jpg")); public void itemS
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
{ String s = (String)ie.getItem(); jl.setIcon(new JScrollPane jsp +
ImageIcon(s =
v, h); contentPane.add(jsp, BorderLayout.CENTER); }

Answer optiona
Answer optiona

Marks: 2
Marks: 2

265 Choose the correct code to display the following output.


266 Which of the following are ways to create a Frame?
import java.awt.*; import javax.swing.*; /* <applet code="JScro
A. height=250>
By creating </applet>
the object */ class
of Frame public(association)
class JScrollPaneDemo extends
init() { Container contentPane = getContentPane(); contentPane.
BorderLayout()); JPanel jp = new JPanel(); jp.setLayout(new Gri
A. By extending
0; for(int
Framei class
= 0; i < 20; i++) { for(int j = 0; j < 20; j++) {
(inheritance)
B.
" + b)); ++b; } } int v = ScrollPaneConstants.VERTICAL_SCROLLBA
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED; JScrollPane
C. a and v,
b h); contentPane.add(jsp, BorderLayout.CENTER); }}

D. none of/*these
<applet code="JScrollPaneDemo" width=300 height=250> </apple
JScrollPaneDemo extends JApplet { public void init() { Containe
getContentPane(); contentPane.setLayout(new BorderLay
Answer optionc jp.setLayout(new GridLayout(20, 20)); int b = 0; for(int i = 0;
B. = 0; j < 20; j++) { jp.add(new JButton("Button " + b)); ++b; }
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED; int h =
Marks: 1 ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED; JScrollPane
v, h); contentPane.add(jsp, BorderLayout.CENTER); }

267 Choose the correct code to display the following output.


import java.awt.*; import javax.swing.*; /* <applet code="JScro
height=250> </applet> */ public class JScrollPaneDemo extends
init() { Container contentPane = getContentPane(); contentPane.
BorderLayout()) JPanel jp = new JPanel(); jp.setLayout(new Grid
C. 0; for(int i = 0; i < 20; i++) { for(int j = 0; j < 20; j++) {
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED; int h =
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED; JScrollPane
v, h); contentPane.add(jsp, BorderLayout.CENTER); }

import java.awt.*; import javax.swing/* <applet code="JScrollPa


D.
height=250> </applet> */ public class JScrollPaneDemo extends J

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
import java.awt.*;import java.awt.event.*;import javax.swing.*;import
/*<applet code="JTreeEvents" width=400 height=200></applet>*/ public c
extends JApplet {JTree tree;JTextField jtf; public void init() { // Ge
Container contentPane = getContentPane();// Set layout manager content
BorderLayout());// Create top node of tree DefaultMutableTreeNode
top
A. DefaultMutableTreeNode("Options");// Create subtree of "A"
DefaultMuta
DefaultMutableTreeNode("A"); top.add(a); DefaultMutableTreeNode a1 =
n
DefaultMutableTreeNode("A1"); a.add(a1); DefaultMutableTreeNode a2 = n
DefaultMutableTreeNode("A2"); a.add(a2);// Create subtree of "B" Defau
b=new DefaultMutableTreeNode("B"); top.add(b); DefaultMutableTreeNode
out()); JPanel jp
jp.add(

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
DefaultMutableTreeNode("B1"); b1 = new DefaultMutableTreeNode("B1");
DefaultMutableTreeNode b3 = new DefaultMutableTreeNode("B3"); b.add(b3
tree = new JTree(top);// Add tree to a scroll pane int v =
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED; int h =
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED; JScrollPane jsp
=
tree =
JScrollPane(tree, v, h);// Add scroll pane to the content pane content
new
BorderLayout.CENTER); // Add text field to applet jtf = new JTextField
JTre
contentPane.add(jtf, BorderLayout.SOUTH);// Anonymous inner class to h
tree.addMouseListener(new MouseAdapter() {public void mouseClicked(Mou
{doMouseClicked(me);}});} void doMouseClicked(MouseEvent me) {TreePath
tree.getPathForLocation(me.getX(), me.getY()); if(tp != null)jtf.setTe
else jtf.setText("");}} content
import java.awt.*;import java.awt.event.*;import javax.swing.*;import
/*<applet code="JTreeEvents" width=400 height=200></applet>*/ public c
extends JApplet {JTree tree;JTextField jtf; public void init() { // Ge
Container contentPane = getContentPane();// Set layout manager content
BorderLayout());// Create top node of tree DefaultMutableTreeNode
top
DefaultMutableTreeNode("Options");// Create subtree of "A"
DefaultMuta
DefaultMutableTreeNode("A");top.add(a); DefaultMutableTreeNode a1 =
ne
DefaultMutableTreeNode("A1"); a.add(a1);DefaultMutableTreeNode a2 = ne
DefaultMutableTreeNode("A2"); a.add(a2);// Create subtree of "B" Defau
b=new DefaultMutableTreeNode("B"); top.add(b);DefaultMutableTreeNode b
B.
DefaultMutableTreeNode("B1"); b.add(b1);DefaultMutableTreeNode b2 =
ne
DefaultMutableTreeNode("B2"); b.add(b2);DefaultMutableTreeNode b3 = ne
DefaultMutableTreeNode("B3"); b.add(b3);// Create tree
to a scroll pane int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEE
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED; JScrollPane jsp =
JScrollPane(tree, v, h);// Add scroll pane to the content pane
BorderLayout.CENTER); // Add text field to applet jtf = new JTextField
contentPane.add(jtf, BorderLayout.SOUTH);// Anonymous inner class to h
tree.addMouseListener(new MouseAdapter() {public void mouseCli
{doMouseClicked(me);}});} void doMouseClicked(MouseEvent me) {TreePath
tree.getPathForLocation(me.getX(), me.getY()); if(tp != null)jtf.setTe
else jtf.setText("");}}
import java.awt.*;import java.awt.event.*;im
/*<applet code="JTreeEvents" width=400 height=200></applet>*/ public
c extends JApplet {JTree tree;JTextField jtf; public void init() { //
Ge Container contentPane = getContentPane()
BorderLayout());// Create top node of tree DefaultMutableTreeNode
C. top
DefaultMutableTreeNode("Options");// Create subtree of "A"
DefaultMuta DefaultMutableTreeNode("A"); top.add(a);
DefaultMutableTreeNode("A1"); a.add(a1); // Create subtree of "B" Def
b=new DefaultMutableTreeNode("B"); top.add(b); DefaultMutableTreeNode
DefaultMutableTreeNode("B1"); b1 = new DefaultMutableTr
cked(Mou

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
port javax.swing.*;import

;// Set layout manager content

DefaultMutableTreeNode a1 = n

eeNode("B1");

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
DefaultMutableTreeNode b3 = new DefaultMutableTreeNode("B3");
b.add(b3 tree = new JTree(top);// Add tree to a scroll pane int
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED; int h =
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED; JScrollPane
=
JScrollPane(tree, v, h);// Add scroll pane to the content pane
content BorderLayout.CENTER); // Add text field to applet jtf =
JTextField contentPane.add(jtf, BorderLayout.SOUTH);//
tree.addMouseListener(new MouseAdapter() {public void
mouseClicked(Mou {doMouseClicked(me);}});} void
doMouseClicked(MouseEvent me) {TreePath
tree.getPathForLocation(me.getX(), me.getY()); if(tp != else
jtf.setText("");}}
import java.awt.*;import java.awt.event.*;import javax.swing.*
/*<applet code="JTreeEvents" width=400 height=200></applet>*/ p
extends JApplet {JTree tree;JTextField jtf; public void init()
Container contentPane = getContentPane();// Set layout manager
BorderLayout());// Create top node of tree DefaultMutableTreeN
DefaultMutableTreeNode("Options");// Create subtree of "A" Defa
DefaultMutableTreeNode("A"); top.add(a); DefaultMutableTreeNode
n
DefaultMutableTreeNode("A1"); a.add(a1); DefaultMutableTreeNode
DefaultMutableTreeNode("A2"); a.add(a2)
b=new DefaultMutableTreeNode("B"); top.add(b); DefaultMutableTr
D. DefaultMutableTreeNode("B1"); b1 = new DefaultMutableTreeNode("
new JTree(top);// Add tree to a scroll pane int v =
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED; int h =
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED; JScrollPane
=
JScrollPane(tree, v, h);// Add scroll pane to the content pane
BorderLayout.CENTER); // Add text field to applet jtf = new JTe
contentPane.add(jtf, BorderLayout.SOUTH);// Anonymous inner cla
tree.addMouseListener(new MouseAdapter() {public void mouseClic
{doMouseClicked(me);}});} void doMouseClicked(MouseEvent me) {T
tree.getPathForLocation(me.getX(), me.getY()); if(tp != null)jt
else jtf.setText("");}}

Answer optionb

Marks: 2

268 Give the abbreviation of AWT?

A. Applet Windowing Toolkit

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Anonymous inner class to h

null)jtf.setTe

; // Create subtree of "B" Defa

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
NTER);

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Abstract Windowing Toolkit

C. Absolute Windowing Toolkit

"Fax" }; final Object[][] data = { { "Pramo


D. None of the above
"5555" }, { "Nitin", "5634", "5887" }, { "Amol", "7345", "9222" }, {
"
Answer "3333"
optionb }, { "Ranie", "5656", "3144" }, { "Mangesh", "5672", "2176"
},
"4244" }, { "Nilofer", "9023", "5159" }
Marks: "1212"
1 }, { "Saurav", "9030", "1313" }, { "Raman", "6751", "1415" }
};
JTable(data, colHeads); int v = ScrollPaneConstants.VERTICAL_SCROLLBAR
269 Choose the correct code to display the following output.
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED; JScrollPane jsp =
JScrollPane(table, v, h); contentPane.add(jsp, BorderLayout.CENTER);
import java.awt.*; import javax.swing.*; /* <applet code="JTableDemo"
}
height=200> </applet> */ public class JTableDemo extends JApplet { pub
import java.awt.*;
Container import
contentPane javax.swing.*; /*
= getContentPane(); <applet
contentPane.setLayout(new Bo
code="JTableDemo" height=200> </applet> */ public class JTable
final String[] colHeads = { "Name", "Phone", "Fax" }; final Object[][]
= getContentPane();
"Pramod", contentPane.setLayout(new
"4567", "8675" }, { "Tausif", "7566", BorderLayout()); final "
"5555" }, { "Nitin",
S
"Amol", "7345", "9222" }, { "Vijai", "1237", "3333" }, { "Ranie", "565
{ "Name", "Phone",
"Mangesh", "Fax" };
"5672", "2176" },final Object[][]
{ "Suhail", data"4244"
"6741", = { { },
"Pramo
{ "Nilofer"
A. "Tausif", "7566", "5555" }, { "Nitin
{ "Jinnie", "1134", "5332" }, { "Heena", "5689", "1212" }, { "Saurav",
"Vijai",
{ "Raman","1237", "3333"
"6751", },}{};
"1415" "Ranie", "5656",
JTable table "3144"
= new }, { "Mangesh",
JTable(data, colHead
D.
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED; int h =
"
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
"Suhail", "6741", "4244" }, { "Nilofer", "9023", "5159" JScrollPane jsp
}, { "Jinnie",
{
= "Heena", "5689", "1212" }, { "Saurav", "9030", "1313" }, { "Raman",
JTable table = new JTable(data,
JScrollPane(table, colHeads); int v
v, h); contentPane.add(jsp, =
BorderLayout.CENTER);
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
} int h =
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
import java.awt.*; import javax.swing.*; /* <applet JScrollPane jsp =
code="JTableDemo"
JScrollPane(table,
height=200> </applet>v, h); contentPane.add(jsp,
*/ public class JTableDemoBorderLayout.CENTER);
extends JApplet { pub }
Container contentPane = getContentPane(); contentPane.setLayout(new Bo
Answer optiona
final String[] colHeads = { "Name", "Phone", "Fax" }; final Object[][]
"Pramod", "4567", "8675" }, { "Tausif", "7566", "5555" }, { "Nitin", "
"Amol", "7345", "9222" }, { "Vijai", "1237", "3333" }, { "Ranie", "565
Marks: 2"Mangesh", "5672", "2176" }, { "Suhail", "6741", "4244" }, { "Nilofer"
B.
{ "Jinnie", "1134", "5332" }, { "Heena", "5689", "1212" }, { "Saurav",
{ "Raman", "6751", "1415" } }; JTable table = new JTable(data, colHead
270 Which of the below are common network protocols?
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED; int h =
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED; JScrollPane jsp
A. =
TCP
JScrollPane(table, v, h); contentPane.add(jsp, BorderLayout.CE

B. UDP
<applet code="JTableDemo" width=400 heigh
C. extends JApplet { public void init() { Container contentPane = getCont
contentPane.setLayout(new BorderLayout()); final String[] colHeads = {
C. TCP and UDP

D. FTP

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
t=200>
Answer optionc

Marks: 1

</applet> */ public c d",

"4567", "8675" }, { "Ta , {

"Jinnie", "1134", "5332" },

Demo extends JApplet { Con

d", "456 ", "5634", "5887" }, {


"Amol", "73

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
import

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
271 Choose the following code for following output :

// java Program to create a simple JPanel add components to it import


import java.awt.*; import javax.swing.*; class solution extends JFra
JFrame static JFrame f; // JButton static JButton b,
label to diaplay text static JLabel l; // mainn class
main(String[] args) { // create a new frame to stor text
f = new JFrame("panel"); // create a label to display text
JLabel("panel label"); // create a new buttons b =
A. JButton("button1"); b1 = new JButton("button2"); b2
JButton("button3"); // create a panel to add buttons
JPanel(); // add buttons and textfield to panel p.
p.add(b1); p.add(b2); p.add(l); //
setback
p.setBackground(Color.red); // add panel to frame //
set the size of frame f.setSize(300, 300); f.sh
// java Program to create a simple JPanel add components to it import
java.awt.*; import javax.swing.*; class solution extends JFra JFrame
static JFrame f; // JButton static JButton b, label to
diaplay text static JLabel l; // mai
main(String[] args) { // create a new frame to stor text
f = new JFrame("panel"); // create a label to display text
JLabel("panel label"); // cre
B. JButton("button1"); b1 = new JButton("button2");
b2
JButton("button3"); // create a panel to add
buttons
JPanel(); // add buttons and textfield to pane
p.add(b1); p.add(b2); p.setBackground(Color.re
add panel to frame f.add(p); // set the size of fra
f.setSize(300, 300); f.show(); } }
// java Program to create a simple JPanel add components to it import
import java.awt.*; import javax.swing.*; class solution extends JFra
JFrame static JFrame f; // JButton static JButton b,
label to diaplay text static JLabel l; // main class
main(String[] args) { // create a new frame to stor text
f = new JFrame("panel"); // create a label to dis
JLabel("panel label"); // create a new buttons b
=
C. JButton("button1"); b1 = new JButton("button2");
b2
JButton("button3"); // create a panel to add buttons
JPanel(); // add buttons and textfield to panel p.
p.add(b1); p.add(b2); p.add(l); //
setback
p.setBackground(Color.red); // add panel to frame
// set the size of frame } }
class

ate a new buttons b =

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
l p.

play text

//
a

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
// java Program to create a simple JPanel add components to it import
java.awt.*; import javax.swing.*; class solution extends JFra
static JFrame f; // JButton static JButton b, label to diap
static JLabel l; // main class main(String[] args) {
create a new frame to stor text f = new JFrame("panel"); //
D. a label to display text = new JButton("button2"); b2
JButton("button3"); panel to add buttons JPanel p = new J
textfield to panel p.add(b); p.add(b1); p.ad p.
// setbackground of panel p.setBackgroun // add panel t
f.add(p); // set th
f.setSize(300, 300); f.show(); } }

Answer optiona

Marks: 2

272 Which of the following statement is used to establish connection with

Connection conn =
A.
DriverManager.getConnection(jdbc:mysql://localhost:3306/booksdb,user,p

Connection conn = DriverManager.getConnected(jdbc:mysql://localhost:33


B.
password);

Connection conn =
C.
DriverManager.getConnection(jdbc:odbc:mysql://localhost:3306/booksdb,u

D. Connection conn = DriverManager.getConnection(localhost:3306/booksdb,u

Answer optiona

Marks: 1

273 Which class provides many methods for graphics programming?

A. javax.awt.graphics

e size of

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. java.Graphics

C. java.awt.Graphics

D. None of the above

Answer optionc

Marks: 1

274 How would you set the color of a graphics context called g to

A. g.setColor(Color.cyan);

B. g.setCurrentColor(cyan);

C. g.setColor("Color.cyan");

D. g.setColor(new Color(cyan));

Answer optiona

Marks: 1

Which of the following are passed as an argument to the paint(


275 metho

A. A Canvas object

B. A Graphics object

C. An Image object

D. A paint object

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
cyan?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionb

Marks: 1

Which of the following methods are invoked by the AWT to support


276 paint operations?

A. paint( )

B. repaint( )

C. draw( )

D. redraw( )

Answer optiona

Marks: 1

Which of the following classes have a paint( ) method?


a.Canvas
277 b.Image
c.Frame
d.Graphics

A. b and d

B. a and c

C. a and b

D. c and d

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionb

Marks: 1

Which of the following are methods of the Graphics class?


a.drawRect( )
278 b. drawImage( )
c.drawPoint( )
d. drawString( )

A. a , b and c

B. a , c and d

C. b,c and d

D. a, b and d

Answer optiond

Marks: 1

Which of the following are true?


a.The AWT automatically causes a window to be repainted when a portio
been minimized and then maximized.
b.The AWT automatically causes a window to be repainted when a portio
279 been covered and then uncovered.
c.The AWT automatically causes a window to be repainted when
applicat changed.
d. The AWT does not support repainting operations.

A. a and b

B. a and d

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. b and c

D. a and c

Answer optiona

Marks: 1

Given the following code


import java.awt.*;
public class SetF extends Frame
{
public static void main(String argv[])
{
SetF s = new SetF();
280
s.setVisible(true);
}
}
How could you set the frame surface color to pink and set its width
to
200 pixels?

A. s.setBackground(Color.pink); s.setSize(300,200);

B. s.setColor(PINK); s.setSize(200,300);

C. s.Background(pink); s.setSize(300,200);

D. s.color=Color.pink; s.Size(300,200);

Answer optiona

Marks: 2

281 PreparedStatement interface extends which interface?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. Statement

B. CallableStatement

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. ResultSet

D. None of the above

Answer optiona

Marks: 1

Consider the following program. Find which statement


contains import java.awt.*; import javax.swing.*; public
class Demo { public
static void main(String args[]) { JFrame f =new JFrame("Toggle
Sample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c=f.getContentPane(); c.add(new
282 JToggleButton("North"),BorderLayout.NORTH); c.add(new
JToggleButton("North"),BorderLayout.EAST); c.add(new
JToggleButton("North"),BorderLayout.WEST); c.add(new
JToggleButton("North"),BorderLayout.SOUTH); c.add(new
JToggleButton("North"),BorderLayout.CENTER); f.setSize(300,300
f.setVisible(true); } }

A. error

B. No Error

C. compile time error

D. Run time errror

Answer optionb

Marks: 2

Which of the following methods can be used to change the size o


jav object?
283 (A) dimension()
(B) setSize()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
error.

Button

);

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
(C) size()
(D) resize()

A. (A), (B), (C) and (D)


ner{
B. (A), (B) and (D)

C. (B), (C) and (D)

D. (B) and (D)

Answer optiond

Marks: 1

Consider the following program. Find correct


output import java.awt.Color; import
java.awt.FlowLayout; import
java.awt.event.ActionEvent; import
java.awt.event.ActionListener; import
javax.swing.*;
public class BgColor extends JFrame implements
ActionListe

private JButton btn;


private JButton red,blue,green;
private JLabel label;

public BgColor()
284
{
red = new JButton("red");
red.addActionListener(this);
add(red);

green = new JButton("green");


green.addActionListener(this);
add(green);
blue = new JButton("blue");
blue.addActionListener(this);
add(blue);

setLayout(new FlowLayout());
setSize(700,700);

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
setTitle("Bit Life - Java program Buttons Clicked");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);

label = new JLabel("what is happening ?");


add(label);

}
public static void main(String[] args)
{
new BgColor();
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource() == btn)
{
label.setText("button clicked");
}

if (e.getSource() == red)
{
label.setText("red selected");
getContentPane().setBackground(Color.RED);

A.

B.

C.

D. All of the above

Answer optiond

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
find out missing line in following code. Import java.awt.*;
285 import javax.swing.*;

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
public class demo2 extends JApplet {
________________________________
JRadioButton b1=new JRadioButton("Button1') ; JRadioButton =new
b2
JRadioButton("Button2"); public void init()
{ cp.add(b1); cp.add(b2);
ButtonGroup bg=new
ButtonGroup(); bg.add(b1);
bg.add(b2); } }

A. Container cp=getContentPane()

B. JRadioButton(

C. ButtonGroup bg=new ButtonGroup();

D. bg.add(b1);

Answer optiona

Marks: 2

Observe the following code


import java.awt.*; import java.applet.*;
import java.util.*; /* <applet code="BorderLayoutDemo" width=4 00
height=200> </applet> */ public class BorderLayoutDemo extends
Applet { public void init() { setLayout(new BorderLayout()); a
Button("This is across the top."), BorderLayout.NORTH);
add(ne Label("The footer message might go here."),
BorderLayout.SOUTH add(new Button("Right"),
BorderLayout.EAST); add(new Button("L BorderLayout.WEST);
String msg = "The reasonable man adapts "
286 "himself to the world;
" + "the unreasonable one persists in " +
"trying to adapt the world to himself.
" + "Therefore all progress depends
" + "on the unreasonable man.

" + " - George Bernard


Shaw

"; add(new TextArea(msg), BorderLayout.CENTER); } } What


will be the output of the above program?
dd(ne

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
w w
);
eft")
, +

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
The output is obtained in Applet with BorderLayout placing butt
A.
e

The output is obtained in Applet with BorderLayout placing butt


B.
e TextArea at center

C. The output is obtained in Applet south and TextArea at center

The output is obtained in Applet with BorderLayout placing but


D.
east,west,north,south and TextArea at center

Answer optiond

Marks: 2

Observe the following code import java.awt.*; import javax.swin


/*
<applet code="JTableDemo.class" width=400 height=500> </applet
*/ public class JTableDemo extends JApplet { public void init(
Container contentPane = getContentPane();
contentPane.setLayout(new FlowLayout()); final String[] colHea
287 "Name", "Phone", "Fax"}; final Object[][] data = { {"Prashant"
"12345","6789"}, {"Rupesh", "12345", "23456"} }; JTable table
new JTable(data, colHeads); int v =
ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS; int h =
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS; JScrollPane
jsp = new JScrollPane(table, v, h); contentPane.add(jsp,
BorderLayout.CENTER); } }

The output is obtained in table with two rows and two columns w
A.
hor vertical scrollbar

The output is obtained in table with two rows and three columns
B.
h vertical scrollbar

The output is obtained in table with three rows and three colum
C.
with vertical scrollbar

The output is obtained in table with four rows and three column
D.
with vertical scrollbar

ton on

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
> )
{

ds = {
,

Answer optionb

Marks: 2

288 Which of the following is true about AWT and Swing Component?

AWT Components create a process where as Swing Component create a


A.
thre

AWT Components create a thread where as Swing Component create a


B.
proce

C. Both AWT and Swing Component create a process

D. Both AWT and Swing Component create a thread

Answer optiona

Marks: 1

289 Which of the following is not a constructor of JTree Class

A. JTree(Object obj[])

B. JTree(int x)

C. JTree(TreeNode tn)

D. JTree()

Answer optionb

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

Observe the following program and point out which statement


290 co error.

importjava.awt.*;
importjavax.swing.*
; /* <applet
code="JTableDemo" width=400 height=200> </applet>
*/ public class JTableDemo extends JApplet {
public void init() {
Container contentPane = getContentPane();
contentPane.setLayout(new BorderLayout());
final String[] colHeads = { "emp_Name", "emp_id","emp_salary"
final Object[][] data = { { "Ramesh", "111", "50000"},
{ "Sagar", "222", "52000" },
{ "Virag", "333", "40000" },
{ "Amit","444", "62000" },
{ "Anil", "555", "60000" }, };
JTable table = new JTable(data,colHeads );
int v =ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED; int
h =ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPanejsp = new JScrollPane(table,,h,v);
contentPane.add( BorderLayout.CENTER); } }

A. Error in statement in which JScrollPane is created

B. statement in which JScrollPane is Not created

C. No Error in statement in which JScrollPane is created

D. Error in statement in which JScrollPane is deleted

Answer optiona

Marks: 2

291 ............. method is used to execute CREATE Table query.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
=
A. executeQuery() ntains
};
B. executeUpdate()

C. execute()

jsp,

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. All of the above

Answer optionb

Marks: 1

The setBackground() method is part of the following class in


292 java.awt

A. Graphics

B. Component

C. Applet

D. Container

Answer optionb

Marks: 1

Find the missing statement in the following


code import java.awt.*; import javax.swing.*;
/* <applet code="JLabelDemo" width=250 height=150> </applet> *
public class JLabelDemo extends JApplet
{
public void init()
293 {
Container contentPane = getContentPane();
ImageIcon ii = new ImageIcon("IC.jpg");
JLabel jl = new JLabel("IC", ii, JLabel.CENTER);
--------------------
}
}

A. setcontentPane.add(jl);

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. getcontentPane.add(jl);

C. contentPane.add(jl);

D. contentPane.add(j);

Answer optionc

Marks: 2

Find the missing statement in the following


code import java.awt.*; import javax.swing.*;
/*
<applet code="JTextFieldDemo" width=300 height=50>
</applet>
*/
public class JTextFieldDemo extends JApplet
{
JTextField jtf;
294 public void init()
{
Container contentPane = getContentPane();
contentPane.setLayout(new FlowLayout());
_________________________________

contentPane.add(jtf);
}
}

A. jtf = new JTextField(15);

B. jtf = JTextField(15);

C. Both A & B

D. None Of the above

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 2

Which of the following classes are derived from the Container class.
S correct answers.
a. Component
295 b.Panel
c.Dialog
d.Frame

A. b ,c and d

B. a ,b and c

C. a and b

D. all of above

Answer optiona

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Find the missing statement in the following code

import java.awt.*; import


java.awt.event.*; import
javax.swing.*;
/*
<applet code="JButtonDemo" width=250 height=300>
</applet> */
public class JButtonDemo extends JApplet implements
296 ActionListener
{
JTextField jtf;
public void init()
{
Container contentPane = getContentPane();
contentPane.setLayout(new FlowLayout()); ImageIcon
france = new ImageIcon("green.jpg");
JButton jb = new JButton(france);
jb.setActionCommand("Green");

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
jb.addActionListener(this);
contentPane.add(jb);
ImageIcon germany = new ImageIcon("red.jpg");
jb = new JButton(germany);
jb.setActionCommand("Red");
jb.addActionListener(this);
contentPane.add(jb);
ImageIcon italy = new ImageIcon("yellow.jpg");
jb = new JButton(italy);
jb.setActionCommand("Yellow");
jb.addActionListener(this);
contentPane.add(jb);
ImageIcon japan = new
ImageIcon("black.jpg"); jb = new
JButton(japan);
jb.setActionCommand("Black");
jb.addActionListener(this);
contentPane.add(jb); jtf = new
JTextField(15); contentPane.add(jtf);
}
public void actionPerformed(ActionEvent ae)
{
----------------------------------------
}
}

A. jtf.setText(ae.getActionCommand());

B. jtf.setText(ae.setActionCommand());

C. jtf.setText(ae.ActionCommand());

D. None of the above

Answer optiona

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Find the missing statement in the following
297 code import java.awt.*; import
java.awt.event.*; import javax.swing.*;

/*
<applet code="JCheckBoxDemo" width=400 height=50>
</applet>
*/
public class JCheckBoxDemo extends JApplet
implements ItemListener
{
JTextField jtf;
public void init()
{
Container contentPane = getContentPane();
------------------------------------------------------------
JCheckBox cb = new JCheckBox("BLUE", true);
cb.addItemListener(this);
contentPane.add(cb);
cb = new JCheckBox("RED", false);
cb.addItemListener(this);
contentPane.add(cb);
cb = new JCheckBox("YELLOW", false);
cb.addItemListener(this);
contentPane.add(cb);
cb = new JCheckBox("GREEN",
false); cb.addItemListener(this);
contentPane.add(cb); jtf = new
JTextField(15);
contentPane.add(jtf);
}
public void itemStateChanged(ItemEvent ie)
{
JCheckBox cb = (JCheckBox)ie.getItem();
jtf.setText(cb.getText());
}
}

A. contentPane.setLayout(FlowLayout());

B. contentPane.Layout(new FlowLayout());

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. contentPane.getLayout(new FlowLayout());

D. contentPane.setLayout(new FlowLayout());

Answer optiond

Marks: 2

298 Find out the correct statement

public PreparedStatement prepareStatement(String query)throws


A.
IOExcept

private PreparedStatement preparedStatement(String query)throws


B.
IOExce

public PreparedStatement prepareStatement(String query)throws


C.
SQLExcep

protected PrepareStatement prepareStatement(String query)throws


D.
FileNo

Answer optionc

Marks: 1

Which of the following classes are derived from the Container class.
S answers.
a. Panel
299 b Window c
Frame d
Component e
Dialog

A. a,b,d,c

B. a, b, c, e

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. b, c,d,e

D. a, e,c,d

Answer optionb

Marks: 1

300 Which are the parameters of setString() method?

A. String value,String paramIndex

B. String paramIndex, String value

C. int paramIndex, int value

D. int paramIndex, String value

Answer optiond

Marks: 1

Name the class used to represent a GUI application window, which is op


301 and can have a title bar, an icon, and menus. Select the one correct a

A. Window

B. Panel

C. Dialog

D. Frame

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiond

Marks: 1

302 What components will be needed to get following output?

A. . Label, TabbedPane, CheckBox

B. Panel, TabbedPane, List

C. TabbedPane, List, Applet

D. Applet, TabbedPane, Pane

Answer optionb

Marks: 2

303 What is the return type of executeQuery() method?

A. int

B. connection

C. ResultSet

D. None of the above

Answer optionc

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Button B1=new Button("Submit");Which method is used to obtain output
304 a

A. setText()

B. setLabel()

C. getText()

D. getLabel()

Answer optiond

Marks: 1

Which of these package contains classes and interfaces for


305 networking?

A. java.io

B. java.util

C. java.net

D. java.network

Answer optionc

Marks: 1

Label lb=new Label("Advanced Java");Which method is used to obtain


306 out Java"

A. setText()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. setLabel()

C. getText()

D. getLabel()

Answer optionc

Marks: 1

By using ___________ control, we can create a set of mutually exclusi


307 which one and only one checkbox in the group can be checked at a time.

A. Button

B. Checkbox

C. CheckboxGroup

D. List

Answer optionc

Marks: 1

Superclass of TextField and TextArea classes that is used to create


308 si Multiple textfields are

A. TextBox

B. TextComponent

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. Checkbox

D. Choice

Answer optionb

Marks: 1

309 Subclass of TextComponent is

A. TextArea

B. Button

C. Label

D. Checkbox

Answer optiona

Marks: 1

310 Following are constructors of TextArea class

A. TextArea(String str)

B. TextArea(int numLines,int numChars)

C. TextArea(String str,int numLines,int numChars,int sBars)

D. All of above

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiond

Marks: 1

Which of these is a protocol for breaking and sending packets to an


311 ad network?

A. TCP/IP

B. DNS

C. Socket

D. Proxy Server

Answer optiona

Marks: 1

312 Which of the following is not an AWT class?

A. Label

B. CheckboxGroup

C. RadioButton

D. List

Answer optionc

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
313 How many ports of TCP/IP are reserved for specific protocols?

A. 10

B. 1024

C. 2048

D. 512

Answer optionb

Marks: 1

Multiple selection of items in List is possible using following


314 Constr

A. List()

B. List(int numRows)

C. List(int numRows,booean multipleSelect)

D. None of these

Answer optionc

Marks: 1

Which object can be constructed to show and select any number of


315 choic window?

A. Button

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Choice

C. List

D. Label

Answer optionc

Marks: 1

Which method of Choice class is used to return index of the selected


316 i

A. getSelectedIndex()

B. getSelectedIndexes()

C. getSelectedItem()

D. getSelectedItems()

Answer optiona

Marks: 1

Swing components that don't rely on Native GUI are reffered to as


317 ____

A. GUI component

B. heavy weight component

C. Ligthweight component

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. middle weight component

Answer optionc

Marks: 1

How many bits are in a single IP address?

318

A. 8

B. 16

C. 32

D. 64

Answer optionc

Marks: 1

319 Developing GUI is swings does_________

A. uses buttons, menus, icons and all other components

B. should be easy for the end user to manipulate

C. stands for Graphic Use Interaction

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. Both (a) and (c)

Answer optiond

Marks: 1

Which of these functions is called to display the output of an


320 applet?

A. display()

B. paint()

C. displayApplet()

D. PrintApplet()

Answer optionb

Marks: 1

_____AWT Component is used to select only one item from popup list
321 of

A. Button

B. Choice

ield tf;

setV

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. Checkbox

D. All of above

Answer optionb

Marks: 1

322 Choose the correct code to display the following output.

import javax.swing.*; import java.awt.*; import java.awt.e


LabelExample extends Frame implements ActionListener{ JTextF
b; LabelExample(){ tf=new JTextField(); tf.setBounds(50,
JLabel(); l.setBounds(50,100, 250,20); b=new JButton("Fin
b.setBounds(50,150,95,30); b.addActionListener(this); a
A.
setSize(400,400); setLayout(null); setVisible(true); }
actionPerformed(ActionEvent e) { try{ String host=tf.getText
ip=java.net.InetAddress.getByName(host).getHostAddress(); l.s
"+ip); }catch(Exception ex){System.out.println(ex);} } pu
main(String[] args) { new LabelExample(); } }

import javax.swing.*; import java.awt.*; import java.awt.e


LabelExample extends Frame implements ActionListener{ JTe
LabelExample(){ tf=new JTextField(); tf.setBounds(50,
JButton("Find IP"); b.setBounds(50,150,95,30); b.addActionLi
B. add(b);add(tf);add(l); setSize(400,400); setLayout(null);
void actionPerformed(ActionEvent e) { try{ String h
ip=java.net.InetAddress.getByName(host).getHostAddress(); l.s
"+ip); }catch(Exception ex){System.out.printl main(String[]
args) { new LabelExample(); } }

import javax.swing.*; import java.awt.*; import java.awt.e


LabelExample extends Frame implements ActionListener{
l; JButton b; LabelExample(){ JButton("Find IP");
C.
b.setBounds(50,150,95,
b.addActionListener(this); main(String[] args)
{ new LabelExample

implements ActionListener{ LabelExample(){ tf=new JTextFiel


tf.setBounds(50,50, 150,20); l=new J
D. JButton("Find IP"); b.setBounds(50,150,95,30);
b.addActionListene

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
n(ex);} } public

JTex
tf=new JTe
30);
add(b);add(tf);ad
();

add(b);add(tf);add(l); setSize(400,400); setLayout(null); setV


public void actionPerformed(ActionEvent e) { try{ String host=tf
String ip=java.net.InetAddress.getByName(host).getHostAddress(); l.se
"+host+" is: "+ip); }catch(Exception ex){System.out.println(ex);}
void main(String[] args) { new LabelExample(); } }

Answer optiona

Marks: 2

323 Which of these methods can be used to output a string in an ap

A. display()

B. print()

C. drawString()

D. String()

Answer optionc

Marks: 1

324 Which component cannot be added to a container?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. JPanel

B. JButton

C. JFrame

D. None of the above

Answer optionc

Label(); l.setBounds(50,100, 2
plet?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
);

INT);

T);

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

Choose the correct syntax to create a table student with attributes


325 ro marks

Marks: 2
A. CREATE TABLE STUDENT VALUES (ROLLNO 1, STUDNAME "ABC",MARKS 90

What is the Message displayed in the applet made by this


B. CREATE TABLE STUDENT
progr import (ROLLNO
java.awt.*; INT,java.applet.*;
import STUDNAME VARCHAR(10), MARKS
public class myapplet extends Applet
{
C. CREATE TABLE STUDENT
public (ROLLNO NUMBER,g)STUDNAME STRING, MARKS IN
void paint(Graphics
327 {
g.drawString("A Simple Applet", 20, 20);
D. All of the Above
}
}
Answer /*<applet
optionb code="myapplet.class" width=200
height=200></applet>

Marks: 1
A. A Simple Applet

B. Which statement
a simple applet is true with respect to the following
code? import java.awt.*; import javax.swing.*;
public class Test { public static void main(String[] args) {
326
C. JFrameerror
Compile frame = new JFrame("My Frame");
frame.getContentPane(). JButton("OK"));
frame.getContentPane().add(new JButton("Cancel"))
D. None of the above
frame.setDefaultCloseOperation(JFra frame.setVisible(true); }}

Answer optiona
Only button OK is displayed
A.

Marks: 2Only button Cancel is displayed.


B.
How many bits value does IPv4 and IPv6 uses to represent the
328 Both
a button OK and button Cancel are displayed and button OK is
C.
displa side of button OK.
A. 32 and 64
Both button OK and button Cancel are displayed and button OK is
D.
displa side of button OK. FeedbackYour answer is correct.
B. 64 and 128

Answer optionb
C. 32 and 128

D. . 64 and 64

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
me.EXIT_ON_CLOSE); frame.setSi

am? */

Answer optionc

Marks: 1

What is the length of the application box made by this


program import java.awt.*; import java.applet.*;
public class myapplet extends Applet
329 {
Graphic g;
g.drawString("A Simple Applet", 20, 20);
}

A. 20

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Default value

C. Compilation Error

D. Runtime Error

Answer optionc

Marks: 2

330 TCP,FTP,Telnet,SMTP,POP etc. are examples of ?

A. Socket

B. IP Address

C. Protocol

D. MAC Address

Answer optionc

ddress?
?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

331 Which of following is subclass of java.awt.Component?

A. Container

B. LayoutManger

C. Color

D. Font

Answer optiona

Marks: 1

332 When should your program call repaint()?

A. Never--that is the system's job.

B. Only once when the frame is created.

Whenever it has made a change to what should be displayed i


C.
F

D. Always---whenever any method finishes

Answer optionc

Marks: 1

Consider the following code:import java.awt.*;import


javax.swing.*;pub public static void main(String[] args) { Comp
333 c = new JButton("OK new JFrame("My Frame"); frame.add(c);
frame.setDefaultCloseOperation(JFrame.EX

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
IT_ON_CLOSE);
frame.setVisible

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
You cannot add a Swing component directly to a JFrame. Instead,
A.
JFrame's contentPane using frame.getContentPane().add(c).

B. You cannot assign a JButton to a variable of java.awt.Componen

C. All of the above

D. None of the above

Answer optionb

Marks: 2

Which packages required for the program. public


class DeleteRecord
{
public static void main(String args[]) throws Exception
{
String sql;
Scanner sc=new Scanner(System.in);
System.out.println("Please Enter the ID no:");
334 int num = sc.readInt();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:stud","scott Sta
stmt=con.createStatement();
int affectedRecords = stmt.executeQuery("select * from stud
whe br.close(); stmt.close(); con.close();
}
}

A. import java.sql.*; import java.util.*;

B. import java.io.*; import java.util.*;

C. import java.sql.*; import java.io.*;

D. import java.sql.*; import java.stdio.*;

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
t.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 2

Answer optiona
A Swing component can be viewed based on what state it's in, ho
335 does. This is known as the model-view- __________ model
Marks: 2

A. AnalyseModel
the following code import javax.swing.*; Import
javax.swing.border.*; Import java.awt.*; Public class Test
ext JFrame { Public Test() { Border border=new
Controller bu
B. TitledBorder("My
Jbutton jbt1=new JButton("OK"); Jbutton jbt=new
JButton("Cance
View
C. Jbt1.setBorder(border);
337 Jbt2.setBorder(border);
Add(jbt1,BorderLayout.NORTH); Add(jbt2,BorderLayout.NORTH); }
D. Public None
static
of void main(String[] args){ JFrame frame=new
the above
Test(
Frame.setSize(200,100);
Frame.setDefaultCloseOperation(JFrame.ExIT_ON_CLOSE);
Answer optionb
Frame.setVisible(true); } }

A. Marks: 1
The program has run time error

B. The program hasthe


Analyse compile errorcode? import javax.swing.*; import java.
following
public class Test extends JFrame { public Test() { setLayout(n
FlowLayout()); add(new JButton("Java")); add(new JButton("Java
C. No error
add(new JButton("Java")); add(new JButton("Java")); } public s
336 void main(String [] args) { JFrame frame = new Test();
frame.setSize(200,100);
D. None offrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
the above
frame.setVisible(true); } }
Answer optionb

A. Four buttons are displayed with the same text java


Marks: 2

B. One buttons are displayed with the same text java

C. Three buttons are displayed with the same text java

D. Five buttons are displayed with the same text java

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
awt.*;
To get the following output complete the code given below
ew
"));
import java.awt.*;
tatic
import javax.swing.*;
/* ends
<applet code="jscroll" width=300 height=250>
338 </applet>
*/
public class jscroll extends JApplet
{
public void init()
{
Container contentPane = getContentPane();
tton");
l"); );

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
;

; j++) {

setL

setL

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
import java.awt.*; public class ChoiceExampleSimple extends Frame
{ contentPane.setLayout(new BorderLayout());
} } int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS;
ChoiceExampleSimple(String s){
int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
c.add("Java"); c.add("PHP"); c.add("Androi
C. JScrollPanejsp = new JScrollPane(jp, v, h);
c.setBounds(100,100,100,100); add(c);
contentPane.add(jsp, BorderLayout.CENTER);
} public
} static void main(String args[]) {
ChoiceExampleSimpl
}
ChoiceExampleSimple("Frame"); } }

D. All of Container
above contentPane = getContentPane(); contentPane.setLayout
A.
Gr
Answer optiona
B. JPanel jp = new JPanel(); jp.setLayout(new GridLayout(20, 20))

Marks: 2
int b = 0; for(int i = 0; i < 20; i++) { for(int j = 0; j < 20
C.
JButton(
For using Swing control one must
340 import______________________________package.
JPanel jp = new JPanel(); jp.setLayout(new GridLayout(3,3)); in
D.
<3; i++) { for(int j = 0; j <3; j++) { jp.add(new JButton(
A. import javax.swing.*

Answer optiond
B. import java.swing.*

Marks: 2
C. Both A & B

339 Following code shows given output


D. None of the above
import java.awt.*; public class ChoiceExampleSimple extends F
{
Answer optiona ChoiceExampleSimple(String s){
A.
c.add("C"); c.add("C++"); c.add("Java");
Marks: 1 c.add("Android"); c.setBounds(100,100,100,100);
} }
import java.awt.*; public class ChoiceExampleSimple extends F
341 In Swing{ Buttons are the subclasses of which class?
ChoiceExampleSimple(String s){
c.add("C");
B. AbstractButton c.add("C++"); c.add("Java");
A.
c.add("Android"); c.setB
main(String args[]) { ChoiceExampleSimple f=new ChoiceEx
B. Button } }

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. Both A & B

ounds(100,100,100,100); } pu
setL d");

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. None of the above

Answer optiona

Marks: 1

Applet class is a subclass of the panel class, which is again a


342 subcla the__________class

A. object

B. Component AW

C. awt

D. Container

Answer optiond

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Consider the program given
below import java.awt.*; import
java.awt.event.*; import
javax.swing.*; import
java.applet.*;
/*
<applet code="test" width=300 height=100>
</applet> */
343 public class test extends JApplet
{
public void init()
{
Container co = getContentPane();
co.setLayout(new FlowLayout()); JComboBox
jc=new JComboBox();
jc.addItem("cricket");
jc.addItem("football");

jc.addItem("hockey");
jc.addItem("tennis"); co.add(jc);
}
}

Choose the correct statement to get the following output

A. JComboBox jc=new JComboBox("Applet Viewer:test");

B. JComboBox jc=new JComboBox(cricket, football, hockey, tennis);

C. JComboBox jc=new JComboBox();

D. None of the above.

Answer optionc

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
The____________method is called every time the applet receives focus
344 a scrolling in the active window.

A. init( )

B. start( )

C. stop( )

D. destroy( )

Answer optionb

Marks: 1

Which of the following applet tag is legal to embed an applet class


345 na

webpage?

A.

B. <applet> code=Test.class width=200 height=100> </applet>

C. <applet code="Test.class" width=200 height=100> </applet>

D. <applet param=Test.class width=200 height=100> </applet>

Answer optionc

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

Find the missing statement in the following


code import javax.swing.*; class gui{
public static void main(String args[]){
JFrame frame = new JFrame("My First GUI");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
346 frame.setSize(300,300);
JButton button1 = new JButton("Press");
frame.getContentPane().add(button1);
----------------------------------
}
}

A. frame.setVisible(true);

B. frame.setVisible(False);

C. Both A & B

D. None of the above

Answer optiona

Marks: 2

The___________class is an abstract class that represents the display


347 a

A. display()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. graphics

C. text

D. area

Answer optionb

Marks: 1

Find the missing statement in the following code import


javax.swing.*;
/*
<applet code="JTabbedPaneDemo" width=400 height=100>
</applet> */
public class JTabbedPaneDemo extends JApplet
{
public void init()
{
JTabbedPane jtp = new JTabbedPane();
jtp.addTab("Languages", new LangPanel());
348
jtp.addTab("Colors", new ColorsPanel());
jtp.addTab("Flavors", new FlavorsPanel());
getContentPane().add(jtp);
}
}
class LangPanel extends JPanel
{
public LangPanel()
{
JButton b1 = new JButton("Marathi"); add(b1);
JButton b2 = new JButton("Hindi") add(b2);

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
JButton b3 = new JButton("Bengali");
add(b3)
JButton b4 = new JButton("Tamil");add(b4);
}
}
class ColorsPanel extends JPanel
{
public ColorsPanel()
{
JCheckBox cb1 = new JCheckBox("Red");
add(cb1);
JCheckBox cb2 = new JCheckBox("Green");
add(cb2);
JCheckBox cb3 = new JCheckBox("Blue");
add(cb3);
}
}
class FlavorsPanel extends JPanel
{
public FlavorsPanel()
{
JComboBox jcb = new JComboBox();
jcb.addItem("Vanilla");
jcb.addItem("Chocolate");
jcb.addItem("Strawberry");
add(jcb);
}
}

A. Error

B. No Error

C. Both A & B

D. None of the above

Answer optiona

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Which of the following method of applet class is used to clear the
349 sc paint( ) method

A. update( )

B. paint( )

C. repaint( )

D. reupdate( )

Answer optiona

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Observe the following code and Choose the correct output from the
give import java.awt.*; import javax.swing.*;
public class test extends JFrame
{
public test()
{
super("Login Form");
Container cpane=getContentPane();
cpane.setLayout(new FlowLayout()); JLabel
l1=new JLabel("Name");
JLabel l2=new JLabel("Password");
JTextField t1=new JTextField(20);
350
JTextField t2=new
JTextField(20); JButton b1=new
JButton("Login"); JButton b2=new
JButton("Cancel");
cpane.add(l1); cpane.add(t1);
cpane.add(l2); cpane.add(t2);
cpane.add(b1); cpane.add(b2);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String args[])
{
test obj=new test();

obj.setVisible(true);
obj.setSize(200,200);
}
}

A.

B.

C. None of the above

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D.

Answer optiond

Marks: 2

The__________method is automatically called the first time the


351 applet screen and every time the applet receives focus.

A. update( )

B. paint( )

C. repaint( )

D. reupdate( )

Answer optionb

Marks: 1

Find the missing statement in the following code import


352 java.awt.*;

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
import java.awt.event.*;
import javax.swing.*;
public class ButtonDemo extends JFrame
{
JButton yes,no,close;
JLabel lbl;
ButtonDemo()
{
yes = new JButton("YES");
no = new JButton ("No");
close = new JButton ("CLOSE");
lbl = new JLabel ("");
__________________________
setSize (400,200); add(yes);
add(no); add(close);
add(lbl);
setVisible(true);

//setDefaultCloseOperation(JFrame.EXIT_NO_CLOSE);
ButtonHandler bh = new ButtonHandler();
yes.addActionListener(bh);
yes.addActionListener(bh);
no.addActionListener(bh);
close.addActionListener(bh);
}
class ButtonHandler implements ActionListener
{
public void actionPerformed(ActionEvent ae)
{
if (ae.getSource()==yes)
{
lbl.setText("Button Yes is pressed");
}
if (ae.getSource()==no)
{
lbl.setText("Button No is pressed");
}
if (ae.getSource()==close)
{
System.exit(0);
}
}
}
public static void main(String args[])
{

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
n

A. setLayout (new GridLayout(4,1));

Butt
B. setLayout (new borderLayout(4,1)); Butt

C. setLayout (new flowLayout(4,1));

D. None of the above

Answer optiona

Marks: 2

The___________method is defined by the AWT which causes the AWT


353 runtim a call to your applet’s update( ) method.

A. update( )

B. paint( )

C. repaint( )

D. reupdate()

Answer optionc

Marks: 1

354 which code gives following output ?

import java.awt.*; import java.applet.*; /* <applet code="Buttonexampl


height=200> </applet> */ public class Buttonexample extends Applet {
A. init()
Button b1=new {Button("ok");
Button("cancel"); Button b3=new Button("exit");

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
add(b1);add(b2);add(b3); } }

import java.awt.*; import java.applet.*; /* <applet code="Buttonexampl


height=200> </applet> */ public class Buttonexample extends Applet {
init() { Button b1=new Button("ok"); applet
B. Button("cancel"); Button b3=new Button("exit");
add(b2);add(b1);add(b3); } }

import java.awt.*; import java.applet.*; /* <


height=200> </applet> */ public class Buttonexample extends Applet {
init() { Button b1=new Button("ok") Button("cancel");
; Button
C. b3=new Button("exit ");
add(b3);add(b1);add(b2); } }

import java.awt.*; import java.applet.*; /* <applet code="Buttonexampl


height=200> </applet> */ public class Buttonexample extends Applet {
init() { Button b1=new Button("ok") Button("cancel");
; Button
D. b3=new Button("exit ");
add(b3);add(b2);add(b1); } }

Answer optionb

Marks: 2

What is the output of the following code ?

import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
class solution extends JFrame {

static JFrame f;
static JButton b, b1, b2, b3;
355 static JLabel l;
public static void main(String[] args)
{
f = new JFrame("panel");
l = new JLabel("panel label");
b = new JButton("button1"); b1 = new JButton("button2");
b2 = new JButton("button3"); b3 = new JButton("button4");
JPanel p = new JPanel(new BorderLayout());
p.add(b, BorderLayout.NORTH); p.add(b1,
BorderLayout.SOUTH);
code="Buttonexampl

Butt

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Butt

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
p.add(b2, BorderLayout.EAST); p.add(b3,
BorderLayout.WEST)
p.add(l, BorderLayout.CENTER);
p.setBackground(Color.red);
f.add(p);
f.setSize(300, 300); f.show(); } }

A.

B.

C.

D.

Answer optiona

Marks: 2

In Swing ____________is a component that displays rows and columns


356 of

A. Tabpane

B. Table

C. Scrollpane

D. None of the above

Answer optionb

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

Which of the following method is used to display numerical values in


357 a

A. paint( )

B. drawstring( )

C. draw( )

D. convert( )

Answer optionb

Marks: 1

Consider the following program What will be the output?


import java.sql.*; class Example
{ public static void main(String srgs[])
{ try
358 { Class.forname("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:STUD");
System.out.println("connection Established");
} catch(sQLException e) { System.out.pritln("SQL error"); }
catch(Exc System.out.println("error"); }}}

A. error ; missing

B. Error } missing

C. Connection Established

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. SQL error

Answer optionc

Marks: 2

We can change the text to be displayed by an applet by supplying new


359 t a____________tag.

A.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B.

C.

D.

Answer optiond

Marks: 1

Which of the following is/are the possible values for alignment


360 attrib
i) Top ii) Left iii) Middle iv) B

A. i, ii and iii only

B. ii, iii and iv only

C. i, iii and iv only

D. All i, ii, iii and iv

Answer optiond

Marks: 1

We can change the text to be displayed by an applet by supplying new


361 t through________tag.

A. SPACE=pixels

B. HSPACE=pixels

C. HWIDTH=pixels

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
aseline

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. HBLANK=pixels

Answer optionb

};
Marks: 1

Debug the following


program import
java.awt.*; import
javax.swing.*;
/*
<applet code="JTableDemo" width=400 height=200>
</applet>
*/
public class JTableDemo extends JApplet
{
public void init() {
Container contentPane = getContentPane();
contentPane.setLayout(new BorderLayout());
362 final String[] colHeads = { "emp_Name", "emp_id",
"emp_salary" final Object[][] data = { { "Ramesh", "111",
"50000" },
{ "Sagar", "222", "52000" },
{ "Virag", "333", "40000" },
{ "Amit", "444", "62000" },
{ "Anil", "555", "60000" },
};
JTable table = new JTable(data,colHeads);
int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h = HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp = new JScrollPane(table, v, h);
contentPane.add(jsp, BorderLayout.CENTER);}}

A. Error in statement in which JTable is created

B. Error in statement in which JScrollPane is created

C. Error in statement in which Horizontal Scrollbar is declared

D. None of the above

Answer optionc

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 2

__________attribute of applet tag specify the width of the space on


363 th will reserved for the applet.

A. WIDTH=pixels

B. HSPACE=pixels

C. HWIDTH=pixels

D. HBLANK=pixels

Answer optiona

Marks: 1

Consider following code and state missing


code? import java.sql.*; class Demo1{
public static void main(String args[])throws Exception
{
try
{
Class.forName("_________________________________________");
Connection con=DriverManager.getConnection("Jdbc:Odbc:demo");
364 Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from student");
while(rs.next())
{
System.out.println(rs.getInt(1)+" "+rs.getString(2)+" "
+rs.getString(
}
catch(Exception e) {} } }

A. sun.odbc.jdbc.OdbcJdbcDriver

B. oracle.jdbc.driver.OracleDriver

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. sun.jdbc.odbc.JdbcOdbcDriver

D. None of the Above

Answer optionc

Marks: 2

365 What is the super class of container?

A. java.awt.Container

B. java.awt.Component

C. java.awt.Panel

D. java.awt.Layout

Answer optionb

Marks: 1

Following methods belongs to which class?

1) public void add(Component c)


366 2) public void setSize(int width,int height)
3) public void setLayout(LayoutManager m)
4) public void setVisible(boolean)

A. Graphics class

B. Component class

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. Both A & B

D. None of the above

Answer optionb

Marks: 1

__________is a server that is mediator between real web server and


367 cli

A. IBMServer

B. SQLServer

C. ReserverSockets

D. Proxy server

Answer optiond

Marks: 1

368 Port number 80 is reserved for

A. FTP

B. Telnet

C. e-mail

D. HTTP

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiond

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
369 View Data helps you to maintain data when you move from

A. Controller to View

B. Temp Data

C. Controller to Data

D. None of above

Answer optiona

Marks: 1

370 What is the purpose of JTable?

A. JTable object displays ONLY rows

B. JTable object displays ONLY columns

C. JTable object displays both rows and columns

D. JTable object displays data in Tree form

Answer optionc

Marks: 1

371 MVC is composed of three components:

A. Member Vertical Controller

B. Model View Control

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
-------------
-

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. Model View Controller

D. Model Variable Centered

Answer optionc

Marks: 1

__________method is used to know the type of content used in


372 t

A. ContentType()

B. Contenttype()

C. GetContentType()

D. getContentType()

Answer optiond

Marks: 1

373 Which of the following is TRUE?

A. Action method can be static method in a controller class

B. Action method can be private method in a controller class

C. Action method can be protected method in a controller class

D. Action method must be public method in a controller class

Answer optiond

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
he URL.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 2

374 Port number 25 is reserved for

A. FTP

B. Telnet

C. SMTP

D. HTTP

Answer optionc

Marks: 1

375 To hold component ___________ are used

A. Container

B. AWT

C. Both

D. None

Answer optiona

Marks: 1

376 What parameter we can pass to public int getInt() method?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. int columnIndex

B. int row

C. Both

D. None of the above

Answer optiona

Marks: 1

Find the error in the following code :


import java.awt.*;
import javax.swing.*;
/*<applet code="test" width=200 height=200>
</applet>*/
public class test extends JApplet
{
public void init()
{
Container c=getContentPane();
JTabbedPane jp=new JTabbedPane();
JButton b1=new JButton("COMP.TECH");
p1.add(b1);
377 JButton b2=new JButton("INFO.TECH");
p1.add(b2);
JButton b3=new JButton("ELEC.ENGG");
p1.add(b3);
JButton b4=new JButton("FIRST");
p2.add(b4);
JButton b5=new JButton("SECOND");
p2.add(b5);
JButton b6=new JButton("THIRD");
p2.add(b6);
jp.addTab("Branch",p1);
jp.addTab("Year",p2);
c.add(jp);
}
}

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. JPanel p2=new JPanel(); JButton b3=new JButton();

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. variable p1 ,cannot find symbol

C. /*<applet code="test" width=200 height=200> </applet>*/

D. jp.addTab()

Answer optionb

Marks: 2

List out few different return types of a controller action


378 met

A. View Result

B. Javascript Result

C. Redirect Result

D. All of these

Answer optiond

Marks: 1

379 What are the steps for the execution of an MVC project?

A. Receive first request for the application

B. Performs routing

C. Creates MVC request handler

D. All of the above

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
hod

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiond

Marks: 1

Which method of a Frame object is used to place a GUI component


380 (such the Frame?

A. . insert( Component c )

B. add( Component c )

C. draw( Component c )

D. click( Component c )

Answer optionb

Marks: 1

381 Which of following is TRUE?

A. The controller redirects incoming request to model

B. The controller executes an incoming request

C. The controller controls the data

D. The controller render html to view

Answer optionb

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
382 Which class is used to encapsulate IP address and DNS?

A. URLConnection

B. Telnet

C. DatagramPacket

D. netAddress

Answer optiond

Marks: 1

A JFrame supports three operations when the user closes the window.
383 Wh below is not one of the three:

A. LOWER_ON_CLOSE

B. DISPOSE_ON_CLOSE.

C. DO_NOTHING_ON_CLOSE

D. HIDE_ON_CLOSE.

Answer optiona

Marks: 1

384 What is the return type of getString() method?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. String

B. int

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. byte

D. short

String
Answer optiona
data[][

Marks: 1

385 Which is the correct code for displaying following output

import javax.swing.*; public class TableExample {


TableExample(){ f=new JFrame();
{"101","Amit","670000"},
{"102","Jai
A. {"101","Sachin","700000"}}; String column[]={"ID","NAME","
JTable jt=new JTable(data,column); jt.setBounds(30,40,200,
JScrollPane sp=new JScrollPane(jt); f.add(sp);
f.setSize(300,400); f.setVisible(true); } publi
main(String[] args) { } }

import javax.swing.*; public class TableExample {


TableExample(){ f=new JFrame(); String data[][
{"101","Amit","670000"}, {
{"101","Sachin","700000"}}; String
B. column[]={"ID","NAME","
JTable jt=new JTable(data,column); jt.setBounds(30,40,200,
JScrollPane sp=new JScrollPane(jt); f.add(sp); public
static void main(String[] args) { new TableExample( }

import javax.swing.*; public class TableExample {


TableExample(){ f=new JFrame(); String
data[][
{"101","Amit","670000"},
C. {"102","Jai
{"101","Sachin","700000"}};
JTable jt=new JTable(data,column); jt.setBounds(30,40,200,
f.setSize(300,400); f.setVisible(true); } publi
main(String[] args) { new TableExample(); }
import javax.swing.*; public class TableExample {
TableExample(){ f=new JFrame();
{"101","Amit","670000"},
{"102","Jai
D. {"101","Sachin","700000"}}; String
column[]={"ID","NAME","
JTable jt=new JTable(data,column);
jt.setBounds(30,40,200,
"102","Jai

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
String
column[]={"ID","NAME","

String data[][

JScrollPane sp=new JScrollPane(jt); f.add(sp);


f.setSize(300,400); f.setVisible(true); } publi
main(String[] args) { new TableExample(); }

Answer optiond

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Select correct output for following code:

import javax.swing.*;
import java.awt.event.*;
class RadioButtonExample extends JFrame implements
ActionListener{
JRadioButton rb1,rb2; JButton
b; RadioButtonExample(){
rb1=new JRadioButton("Male");
rb1.setBounds(100,50,100,30);
rb2=new JRadioButton("Female");
rb2.setBounds(100,100,100,30);
ButtonGroup bg=new ButtonGroup();
bg.add(rb1);bg.add(rb2); b=new
386 JButton("click");
b.setBounds(100,150,80,30);
b.addActionListener(this);
add(rb1);add(rb2);add(b);
setSize(300,300);
setLayout(null); setVisible(true); }
public void actionPerformed(ActionEvent e){
if(rb1.isSelected()){
JOptionPane.showMessageDialog(this,"You are Male.");
}
if(rb2.isSelected()){
JOptionPane.showMessageDialog(this,"You are Female.");
} }
public static void main(String args[]){
new RadioButtonExample(); }}

A.

B.

C.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D.

Answer optiona

Marks: 2

387 Port number 21 is reserved for

A. FTP

B. Telnet

C. e-mail

D. HTTP

Answer optiona

Marks: 1

388 Select the code for following output:

import javax.swing.*; public class TabbedPaneExample { f=new


JFrame(); JTextArea ta=new JTextArea(200,200); JPane
p1.add(ta); JPanel p2=new JPanel(); JPanel p3=new JPanel()
A. tp=new JTabbedPane(); tp.setBounds(50,50,200,200);
tp.add("visit",p2); tp.add("help",p3); f.add(tp);
f.setLayout(null); f.setVisible(true); } public static void
{ new TabbedPaneExample(); }}

import javax.swing.*; public class TabbedPaneExample { JFrame f;


TabbedPaneExample(){ f=new JFrame(); JTextArea ta=new JTex
JPanel p1=new JPanel(); p1.add(ta); JPanel p2=new p3=new
B. JPanel(); JTabbedPane tp=new JTabbedPane();
tp.setBounds(50,50,200,200); tp.add("main",p1); tp.add("vi
tp.add("help",p3); f.add(tp); f.setSize(400,400);
f.setVisible(true); } public static void main(String[] args) {

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
TabbedPan
e

tp.add(

TabbedPaneExample(); }}

import javax.swing.*; public class TabbedPaneExample { JFrame f;


TabbedPaneExample(){ f=new JFrame(); JTextArea ta= p1.add(ta);
JPanel p2=new JPanel(); JPanel p3=new JPanel() tp=new
C. JTabbedPane(); tp.setBounds(50,50,200,200); tp.add(
tp.add("visit",p2); tp.add("help",p3); f.add(tp);
f.setLayout(null); f.setVisible(true); } public static void
{ new TabbedPaneExample(); }}

import javax.swing.*; public class TabbedPaneExample { JFr


TabbedPaneExample(){ f=new JFrame(); JTextArea ta=new JTex
JPanel p1=new JPanel(); p1.add(ta); JPanel p2=new JPanel()
D. p3=new JPanel(); JTabbedPane tp=new JTabbedPane();
tp.setBounds(50,50,200,200); f.add(tp); f.s
f.setLayout(null); f.setVisible(true); } public static
void { new TabbedPaneExample(); }}

Answer optionb

Marks: 2

Which of the following statements are true.


1. ResultSet object can be moved forward only and it is not
updatable.
2. The object of ResultSet maintains a cursor pointing to a row of
389 a t
3. The statement interface is a factory of ResultSet
4. The performance of the application will be faster if you use
Prepar interface

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. 1,2,3

B. 2,4

C. 1,3,4

D. 1,2,3,4

Answer optiond

JPanel(

) new

JTex

ame f;

etSize(
4

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

390 The Transmission Control Protocol

A. Support fast transfer of packets

B. support connectionless transport of packets

C. support unreliable transport of packets

D. support connection oriented transport of packets

Answer optiond

Marks: 1

391 Which of the following methods cannot be called on JLabel?

A. setIcon()

B. getText()

C. setLabel()

D. setBorderLayout()

Answer optiond

Marks: 1

392 User Datagram Protocol is__________

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. Support fast transfer of packets

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. support connection-less transport of packets

C. support unreliable transport of packets

D. All of the above

Answer optiond

Marks: 1

393 A JTabbedPane does the following operations___________________

arranges GUI components into layers such that only one layer is
A.
visibl

B. allows users to access a layer of GUI components via a tab

C. extends JComponent

D. All of the above.

Answer optiond

Marks: 1

394 Where are the tabs on a JTabbedPane placed by default

A. top

B. bottom

C. left

D. right.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
__

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Find the missing statement from the below given code :-

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class menu extends JFrame {
// menubar
static JMenuBar mb;

// JMenu
static JMenu x;

// Menu items
static JMenuItem m1, m2, m3;

// create a frame
static JFrame f;

public static void main()


{
395
// create a frame
f = new JFrame("Menu demo");

// create a menubar
mb = new JMenuBar();

// create a menu
x = new JMenu("Menu");

// create menuitems
m1 = new JMenuItem("MenuItem1");
m2 = new JMenuItem("MenuItem2");
m3 = new JMenuItem("MenuItem3");

// add menu items to menu


x.add(m1);
x.add(m2);
x.add(m3);

// add menu to menu bar

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
___________________

// add menubar to frame


f.setJMenuBar(mb);

// set the size of the frame


f.setSize(500, 500);
f.setVisible(true);
}
}

A. m1 = new JMenuItem("MenuItem1");

B. x.add(m1);

C. f.setVisible(true);

D. mb.add(x);

Answer optiond

Marks: 1

396 The Transmission Control Protocol is

A. Low level routing protocol

B. Middle level routing protocol

C. Higher level routing protocol

D. None of above

Answer optionc

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

397 Mnemonics can be used with all sub classes of which class?

A. JComponent

B. JMenu

C. JMenuItem

D. All of the above

Answer optiond

Marks: 1

398 Menus are attached to the windows by calling___________ method

A. addMenus()

B. setMenu()

C. setJMenuBar()

D. addJMenuBar()

Answer optionc

Marks: 1

The elements of a _________ Layout are organized in a top to bottom,


399 l pattern.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. Grid

B. Border

C. Card

D. Flow

Answer optiond

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
From the following program select the
output. import java.awt.*; import
javax.swing.*;

public class JTPDemo extends JApplet


{
public void init()
{
JTabbedPane jt = new JTabbedPane();
jt.add("Colors", new CPanel());
jt.add( "Fruits", new FPanel());
jt.add("Vitamins", new VPanel( ) ) ;

getContentPane().add(jt);
}
}
class CPanel extends JPanel
400 {
public CPanel()
{
JCheckBox cb1 = new JCheckBox("Red");
JCheckBox cb2 = new JCheckBox("Green");
JCheckBox cb3 = new JCheckBox("Blue");
add(cb1); add(cb2); add(cb3) ;
}
}
class FPanel extends JPanel
{
public FPanel()
{
JComboBox cb = new JComboBox();
cb.addItem("Apple");
cb.addItem("Mango");
cb.addItem("Pineapple");
add(cb);

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
}
}
class VPanel extends JPanel
{
public VPanel()
{
JButton b1 = new JButton("Vit-A");
JButton b2 = new JButton("Vit-B");
JButton b3 = new JButton("Vit-C");
add(b1); add(b2); add(b3);
}
}

A.

B.

C. Both A & B

D. None of the above

Answer optionb

Marks: 2

401 Internet Protocol is

A. Low level routing protocol

B. Middle level routing protocol

C. Higher level routing protocol

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. None of above

Answer optiona

Marks: 1

402 Cookies were originally designed for

A. Client-side programming

B. Server-side programming

C. Both Client-side & Server-side programming

D. web programming

Answer optionb

Marks: 1

403 What happens if setSize() is not called on a JFrame ?

A. The window is displayed at its preferred size

B. The window is not displayed

C. The window is displayed at its absolute size

D. Only the title bar appears

Answer optionb

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

When the user press Enter key in a JTextField, the GUI component gener
404 an_____________ , _______________ which is processed by an object th
interface.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. ActionEvent, ActionListener

B. ActionEvent, TextEventListener.

C.
C. TextEvent, is
DataSource TextListener
a registry point

D.
D. TextEvent, is
DataSource ActionEventListener
a factory of connections to a physical data sour

Answer
Answer optiona
optiond

Marks:
Marks: 22

The following specifies the advantages of ____


Which of the following encapsulates an SQL statement which is passed
407 t be parsed, compiled, planned and executed?
405 It is lightweight.
It supports pluggable look and feel.
A. It follows MVC (Model View Controller) architecture.
DriverManager

A.
B. AWT
Connection

B.
C. SWINGDriver
JDBC

C.
D. Both A & B
Statement

D.
Answer None of the above
optiond

Answer
Marks: 2optionb

Marks:
408 1
Which driver is efficient and preferable for using JDBC applic

406
A. What 1is in terms of JDBC ,a DataSource
Type

A.
B. A DataSource
Type 2 is the basic service for managing a set of JDBC

B.
C. DataSource
Type 3 is a java representation of physical data source

D. Type 4

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiond

drivers
ce

ations?

Marks: 1

409 Which packages contains JDBC classes?

A. java.jdbc

B. java.jdbc.sql

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. java.sql

D. java.rdb

Answer optionc

Marks: 1

Which of the following methods are needed for loading the database
410 dri

A. resultSet method

B. class.forName() method

C. getConnection()

D. Both A and B

Answer optionb

Marks: 2

411 Is the JDBC-ODBC bridge multithreaded ?

A. True

B. False

C. can't predict

D. don't know

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 1

________ is an open source DBMS product that runs on UNIX, Linux and
412 W

A. MySQL

B. JSP/SQL

C. JDBC/SQL

D. Sun ACCESS

Answer optiona

Marks: 2

Which driver is efficient and always preferable for using JDBC


413 applica

A. Type 1 driver

B. Type 2 driver

C. Type 3 driver

D. Type 4 driver

Answer optiond

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Which model does a Java applet or application talks directly to the
414 da

A. Two Tier Model

B. Three Tier Model

C. Both A and B

D. None of the above

Answer optiona

Marks: 1

What is the reason that a java program cannot directly communicate


415 wit

A. ODBC written in C# language

B. ODBC written in C language

C. ODBC written in C++ language

D. None of the above

Answer optionb

Marks: 2

416 Which models do the JDBC API support for the database access?

A. Two Tier Model

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Three Tier Model

C. Both A and B

D. None of the above

Answer optionc

Marks: 2

417 ODBC stands for?

A. Open database connectivity

B. Open database concept

C. Open database communications

D. None of the above

Answer optiona

Marks: 1

Which class has traditionally been the backbone of the JDBC


418 architectu

A. the JDBC driver manager

B. the JDBC driver test suite

C. the JDBC-ODBC bridge

" ");

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. All mentioned above

Answer optiona

Marks: 2

Which method is used to establish the connection with the speci


419 ur Manager class?

A. public static void registerDriver(Driver driver)

B. public static void deregisterDriver(Driver driver)

C. public static Connection getConnection(String url)

D. None of the above

Answer optionc

Marks: 2

Consider the following program.What should be the correction do


t correct output? import java.sql.*; class Ddemo1
{{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection c=DriverManager.getConnection("jdbc:odbc:ODSN"," ",
Statement s=c.createStatement();
420 ResultSet rs=s.executeQuery("select *from StudTable");
System .out.println("Name" + " " + "Roll_No" + "
System.out.println(rs.getString(1)+" "+rs.getInt(2)+"
}
s.close();
c.close();
}}

A. Missing semicolon

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
" +
"Avg");while
"+rs
");

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Missing {
D. c.close()

C. Missing }
Answer optiona

D. Missing statement.
Marks: 2

Answer optiond
Consider the following program. What should be the correction done
in correct
Marks: 2 output? class Ddemo1
{public static void main(String args[]) throws Exception {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Consider the following program Select the statement that should
Connection c=DriverManager.getConnection("jdbc:odbc:ODSN","
add to get correct output. ",
Statement s=c.createStatement();
import java.sql.*; public
ResultSet rs=s.executeQuery("select
class db *from StudTable"); System
422 .out.println("Name"
{ + " " + "Roll_No" + " " + "Avg
while(rs.next())
public static void main(String args[])throws Exception
{ {
System.out.println(rs.getString(1)+" "+rs.getInt(2)+"
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} Connection c =DriverManager.getConnection("jdbc:odbc:XYZ","","
s.close();
PreparedStatement s=c.prepareStatement( "update db3 set Name=?
c.close();
R Statement s=c.createStatement( );
}} s.setString(1,args[0]);
421
s.setString(2,args[1]);
s.setString(3,args[2]);
A. MissingResultSet
semicolonrs=s.executeQuery("select* from db3");
System.out.println("Name"+" "+"Roll no"+" "+"Avg");
while(rs.next())
B. Missing{ {
System.out.println(rs.getString(1)+" "+rs.getInt(2)+"
}
C. Missing }
s.close();
c.close();
D. Missing}}package statement.

A. s.executeUpdate()
Answer optiond

B. c.createStatement( )
Marks: 2

C. s.close()
423 Which of the following is correct about driver interface of JD

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
"+rs.getD
o " ");

");

"+rs

BC?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
JDBC driver is an interface enabling a Java application to interact
A.
wi

JDBC API is an application interface of javafor connecting java as


B.
bac

C. Both A and B

D. None of the above

Answer optiona

Marks: 2

424 Which of the following is correct about Statement?

A. Used for general-purpose access to your database.

B. Useful when you are using static SQL statements at runtime.

C. Both of the above.

D. None of the above.

Answer optionc

Marks: 2

Connection object can be initialized using the____________method of


425 th class.

A. putConnection()

B. setConnection()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. Connection()

D. getConnetion()

Answer optiond

Marks: 1

The _________________ method executes an SQL statement that may


426 return

A. .executeUpdate()

B. executeQuery()

C. execute()

D. noexecute()

Answer optionc

Marks: 2

427 ________Use to execute parameterized query?

A. Statement Interface

B. PreparedStatement interface

C. ResultSet Interface

D. None of the above

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionb

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Every driver must provide a class that should implement
428 the___________

A. Driver interface

B. Driver manager

C. Driver class

D. Driver

Answer optiona

Marks: 2

429 How can you execute a stored procedure in the database?

A. Call method execute() on a CallableStatement object

B. Call method executeProcedure() on a Statement object

C. Call method execute() on a StoredProcedure object

D. Call method run() on a ProcedureCommand object

Answer optiona

Marks: 1

430 Which of the following is false as far as type 4 driver is con

A. Type 4 driver is native protocol, pure java driver

B. Type 4 drivers are 100% Java compatible

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
cern?

C. Type 4 drivers uses Socket class to connect to the database

D. Type 4 drivers can not be used with Netscape

Answer optiond

Marks: 1

Which driver is efficient and always preferable for using JDBC


431 applica

A. Type 4

B. Type 3

C. Type 2

D. Type 1

Answer optiona

Marks: 1

432 The JDBC-ODBC bridge is

A. Three tiered

B. Multithreaded

C. Best for any platform

D. All of the above

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionb

Marks: 1

433 Which driver is called as thin-driver in JDBC?

A. Type-4 driver

B. Type-1 driver

C. Type-2 driver

D. Type-3 driver

Answer optiona

Marks: 1

434 _____interface allows storing results of query?

A. Statement

B. Connection

C. ResultSet

D. None of the above

Answer optionc

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Which layout manager should you use to arrange the components of
435 conta form?

A. Grid Layout

B. Card Layout

C. Border Layout

D. Flow Layout

Answer optiona

Marks: 1

436 Which of the following is the default layout for a applet?

A. Grid Layout

B. Card Layout

C. Border Layout

D. Flow Layout

Answer optiond

Marks: 1

437 Which of the following is the default layout for Frame?

A. Grid Layout

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Card Layout

C. Border Layout

D. Flow Layout

Answer optionc

Marks: 1

Which of the following statement is correct to change the layout


438 of

A. setLayoutManager(new GridLayout());

B. setLayout(new GridLayout(2,2));

C. setGridLayout(2,2);

D. setBorderLayout();

Answer optionb

Marks: 1

439 Which method is used to set the layout of a container?

A. startLayout()

B. initLayout()

C. layoutContainer()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. setLayout()

Answer optiond

Marks: 1

440 Which containers use a Borderlayout as their default layout?

A. Window

B. Frame

C. Dialog

D. All of the above

Answer optiond

Marks: 1

--------------arranges the components as a deck of cards such that


441 onl visible at a time.

A. Grid Layout

B. Card Layout

C. Border Layout

D. Flow Layout

Answer optionb

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

442 Select the correct option to get the given output.

import java.awt.*; import javax.swing.*; public class Border {


Border(){ f=new JFrame(); JButton b1=new JButton("N
JButton b2=new JButton("SOUTH");; JButton b3=new JButton("EAST")
b4=new JButton("WEST");; JButton b5=new JButton("CENTER");;
A. f.add(b1,BorderLayout.NORTH); f.add(b2,BorderLayout.SOUTH);
f.add(b3,BorderLayout.EAST);
f.add(b4,BorderLayout.WEST);
f.add(b5,BorderLayout.CENTER);
f.setSize(300,300);
;

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
} public static void main(String[] args) { new Border();
}
import java.awt.*; import javax.swing.*; public class Border
{
Border(){ f=new JFrame(); JButton b1=new JButton("N
JButton b2=new JButton("SOUTH");; JButton b3=new JButton("EAST")
b4=new JButton("WEST");; JButton b5=new JButton("CENTER");;
B. f.add(b1,BorderLayout.NORTH); f.add(b2,BorderLayout.RIGHT);
f.add(b3,BorderLayout.EAST);
f.add(b4,BorderLayout.LEFT);
f.add(b5,BorderLayout.CENTER); f.setSize(300,300)
} public static void main(String[] args) { new Border();
}
import java.awt.*; import javax.swing.*; public class Border {
Border(){ f=new JFrame(); JButton b1=new
JButton b2=new JButton("SOUTH");; JButton b3=new JButton("EAST")
b4=new JButton("WEST");; JButton b5=new JButton("CENTER");;
C. f.add(b1,BorderLayout.TOP); f.add(b2,BorderLayout.RIGHT)
f.add(b3,BorderLayout.BOTTOM);
f.add(b4,BorderLayout.LEFT);
f.add(b5,BorderLayout.CENTER); f.setSize(300,300); }
public static void main(String[] args) { new Border(); }
import java.awt.*; import javax.swing.*; public class Border {
Border(){ f=new JFrame(); JButton b1=new JButton("N
JButton b2=new JButton("SOUTH");; JButton b3=new JButton("EAST")
b4=new JButton("WEST");; JButton b5=new JButton("CENTER");;
f.add(b1,BorderLayout.TOP); f.add(b2,BorderLayout.SOUTH);
D. f.add(b3,BorderLayout.BOTTOM);
f.add(b4,BorderLayout.WEST);
f.add(b5,BorderLayout.CENTER); f.setSize(300,300);
} public static void main(String[] args) { new Border();
}

Answer optiona

Marks: 2

import java.awt.*; import


javax.swing.*;

public class MyFlowLayout{


JFrame f;
443 MyFlowLayout(){
f=new JFrame();

JButton b1=new JButton("1");


JButton b2=new JButton("2");

JButton("
N

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
;

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
JButton b3=new JButton("3");
JButton b4=new JButton("4");
JButton b5=new JButton("5");

f.add(b1);f.add(b2);f.add(b3);f.add(b4);f.add(b5);

-----------------------------------------
//setting flow layout of right alignment

f.setSize(300,300);
f.setVisible(true);
}
public static void main(String[] args) {
new MyFlowLayout();
}
}
Find the missing statement to get the following output

A. f.setLayout(new FlowLayout());

B. f.setLayout(new FlowLayout(FlowLayout.RIGHT));

C. f.setLayout(new FlowLayout(FlowLayout.CENTRE));

D. f.setLayout(new FlowLayout(FlowLayout.LEFT));

Answer optionb

Marks: 2

Which of the following layout manager should be used so that every


444 com same size in the container?

A. Grid Layout

B. Card Layout

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. Border Layout

D. Flow Layout

Answer optiona

Marks: 1

import java.awt.*;
class SampleFrame extends Frame
{
SampleFrame(String title)
{
super(title);
}
}
class FileDialogDemo
{
445
public static void main(String args[])
{
Frame f = new SampleFrame("File Dialog Demo");
----------------------------
f.setSize(100, 100);
FileDialog fd = new FileDialog(f, "File Dialog");
fd.setVisible(true);
}
}
Find the missing statement to get the given output.

A. fd.setVisible(true);

B. f.setVisible(false);

C. fd.setVisible(false);

D. f.setVisible(true);

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiond

Marks: 2

446 In CardLayout where components of every card are added?

A. Window

B. Panel

C. Applet

D. Frame

Answer optionb

Marks: 1

447 Select correct statement to add component in south region-----

A. add(component obj,FlowLayout.SOUTH);

B. add(component obj,BorderLayout.RIGHT);

C. add(component obj,BorderLayout.SOUTH);

D. add(component obj,FlowLayout.RIGHT);

Answer optionc

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Which of the following statements are used to create panel in border
448 l

A. Frame p=new Frame(new BorderLayout());

B. Panel p=new Panel(); p.setLayout(new BorderLayout());

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. Panel p=new Panel();

D. Panel p=new Panel(); p.setLayout(new Border());

Answer optionb

Marks: 2

---------------is used to position components in an applet


449 win

A. Layout Manager

B. addComponent();

C. add()

D. Both a and b

Answer optiona

Marks: 1

450 What is use of GridLayout Manager ?

A. To lay out components in a two-dimensional grid

B. To lay components in tabular form

C. Both a and b

D. none of the above

Answer optionc

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
dow.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

Which of the following is used to rollback a JDBC


451 transaction?

A. rollback()

B. rollforward()

C. deleteTransaction()

D. RemoveTransaction()

Answer optiona

Marks: 2

452 When the message "No Suitable Driver" occurs?

A. When the driver is not registered by Class.forname() method

B. When the user name, password and the database does not match

C. When the JDBC database URL passed is not constructed properly

D. When the type 4 driver is used

Answer optionc

Marks: 2

453 What is the disadvantage of Type-4 Native-Protocol Driver?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. At client side, a separate driver is needed for each database

rotocol

es

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Type-4 driver is entirely written in Java

The driver converts JDBC calls into vendor-specific database


C.
p

D.
Answer It does not support to read MySQL data
optionb

Answer
Marks: 2optiona

Marks:
456 2
Which of the following are interfaces in javax.servlet.http pa

454
A. The Java software Bridge provides JDBC access via__________
HttpServletRequest

A.
B. ODBC drivers
HttpServletResponse

B.
C. JDBC API
HttpSession

C.
D. BothofA the
All and above
B

D.
Answer None of the above
optiond

Answer
Marks: 1optiona

Marks: 1
Which of the following informs an object that it is bound to or
457 unboun session?
455 Which statement about JDBC are true
A. HttpServletRequest
JDBC is an API to connect relational-object and XML data
A.
sours
B. HttpServlet
B. JDBC stands for Java Database Connectiivity
C. HttpSession
C. JDBC is an API to access relational database.
D. HttpSessionBindingListener
JDBC is an API to bridge the objectrelational
D.
Answer databases
optiond

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
-----------------provides a way to identify a user across more than
458 on
relational mismatch between OO pro
ckage?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
visit to a Web site and to store information about that user.

A. HttpServletRequest

B. HttpServlet

C. HttpSession

D. HttpSessionBindingListener

Answer optionc

Marks: 1

------------------- class provides methods to handle HTTP requests


459 an

A. HttpServlet

B. GenericServlet

C. HttpSessionEvent

D. None of the above

Answer optiona

Marks: 1

Which type of driver converts JDBC calls into network protocol used
460 by management system directly?

A. Type 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Type 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. Type 3

D. Type 4

Answer optiond

Marks: 1

Which JDBC driver types can be used either in applet or


461 servle

A. Both Type 1 and Type 2

B. Both Type 1 and Type 3

C. Both Type 3 and Type 4

D. Type 4 only

Answer optionc

Marks: 2

462 How many JDBC driver types does Sun define?

A. 1

B. 2

C. 3

D. 4

Answer optiond

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
t code?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

463 String[] getSelectedItems() is the method of _________ class.

A. List

B. Choice

C. Button

D. TextArea

Answer optiona

Marks: 1

464 ______class is used to create radiobutton in AWT.

A. List

B. Choice

C. Checkbox

D. CheckboxGroup

Answer optiond

Marks: 1

__________ is used when user wants to enter text that is not


465 displayed

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. setEditable()

B. setEchoChar()

C. getSelectedText()

D. setText()

Answer optionb

Marks: 1

Which of the following is correct statement? Consider t1 as


466 TextField

A. t1.setEchoChar('*');

B. t1.setEchoChar("*");

C. t1.setEchoChar('**');

D. None of these

Answer optiona

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

To create radiobutton in Applet which of the following are valid


467 stat

CheckboxGroup cbg=new CheckboxGroup(); Checkbox cb1=new


A.
Checkbox("java cb2=new Checkbox("php",true,cbg);
Checkbox

CheckboxGroup cbg=new CheckboxGroup(); Checkbox cb1=new


B.
Checkbox("java cb2=new Checkbox("php",false,cbg);
Checkbox

CheckboxGroup cbg=new CheckboxGroup(); Checkbox cb1=new


C.
Checkbox("java new Checkbox("php",false,cbg);
Checkbox cb2=

D. All of above

Answer optiond

Marks: 2

468 Which is the correct statement to produce following output ?

A. List l1=new List(4);

B. List l1=new List(3,true);

C. List l1=new List(3,false);

D. List l1=new List();

Answer optionb

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 2

In the Delegation Event Model, a user interface element is able to


469 del processing of an event............................

A. a separate piece of code

B. A source generates an event

C. a separate elements in a graphical user interface

D. None of above

Answer optiona

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
470 In The delegation Event Model, ................

A. an Event propogated up the containment hierarchy

B. a source generates an event and sends it to one or more listen

C. notification sent to all components in containment hierarchy.

D. None of Above

Answer optionb

Marks: 1

471 Which of the following classes in Java contains swing version o

A. JButton

B. JApplet

C. AbstractButton

D. JLabel

Answer optionb

Marks: 1

Which of the following value is not available to align argument


472 u
Constants interface?

A. Left

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
ers.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Right

C. Middle

D. Leading

Answer optionc

Marks: 1

473 Which of the following classes of Java swing extends Applet cl

A. JButton

B. JApplet

C. AbstractButton

D. None of these

Answer optionb

Marks: 1

In Java swing, which of the following components is/are represe


474 by in which a component may be viewed?

A. Scroll pane

B. Tabbed pane

C. Combo boxes

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
ass?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. None of these

Answer optiona

Marks: 2

475 Swing components are ultimately derived form which of the following ?

A. javax.awt.*

B. java.awt.*

C. javax.swing.JComponent

D. java.swing.*

Answer optionc

Marks: 1

Identify the layout manager for the given output container having a r
476 that should all be displayed at the same size, filling the container's

A. Grid Layout

B. Card Layout

C. Border Layout

D. Flow Layout

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 2

477 Swing components are preceded by the letter

------
S ----
A.

B. A

C. X

D. J

Answer optiond

Marks: 1

478 The syntax for creating and setting layout manager object is

r
A. LayoutManager Obj= new LayoutManager();

B. LayoutManager Obj= new LayoutManager(); setLayout(Obj);

C. setLayout(Obj); LayoutManager Obj= new LayoutManager();

D. setLayout(Obj);

Answer optionb

Marks: 1

The Swing is an API for providing graphical user interface


479 fo

A. Python programs

B. Java programs

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. C programs

D. PHP programs

Answer optionb

Marks: 1

480 An Event can be generated by-

A. Pressing a button

B. A counter exceeds a value

C. cliking the Mouse

D. All of the above.

Answer optiond

Marks: 1

481 A general form, event registration method-

A. public void addTypeListener (TypeListener el)

B. public void addEventObject(EventObject eo)

C. public void addActionEvent(ActionEvent ae)

D. public void addComponetEvent(ComponentEvent ce)

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 1

Listeners are created by implementing one or more of the


482 _____________ java.awt.event package.

A. class

B. interfaces

C. object

D. package

Answer optionb

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
import javax.swing.*;
import java.awt.*;
-------------------------------------------------- public
class FlowLayoutDemo extends JApplet {

public void init() {

Container cp = getContentPane();

483
-------------------------------

JButton button1 = new JButton("Button1");


JButton button2 = new JButton(" Button2");
JButton button3 = new JButton(" Button3");

cp.add(button1);
cp.add(button2); cp.add(button3);
}
}

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Identify the missing statement to get the following output.

A. <applet code="FlowLayoutDemo" width=100 height=100></applet>

<applet code="FlowLayoutDemo" width=100 height=100></applet>


B.
cp.setLay

<applet code="FlowLayout" width=100 height=100></applet>


C.
);

<applet code="FlowLayoutDemo" width=100 height=100></applet>


D.
cp.setLay FlowLayout() );

Answer optiond

Marks: 2

484 At The root of the java event class hierarchy is..............

A. ContainerEvent

B. ComponentEvent

C. WindowEvent

D. EventObject

Answer optiond

Marks: 1

Match the correct pairs-


a. getSource( ) i. Determine the type
of the
485 b. toString ( )
c. getID( ) iii-
Constructor
d. EventObject(Object src) iv-

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
cp.setLayout

( .

ii. Returns the source of

returns the string equivalent of


th lected.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. c-i , a-ii, d-iii, b-iv
D. reference to the object that generated event.

B. c-ii , a-i, d-iv, b-iii


Answer optionb

C. c-iii , a-ii, d-i, b-iv


Marks: 1

D. Which c-iv , a-iii, d-ii, b-i


of these are integer constants defined in ActionEvent
488 c
Answer optiona
A. ALT_MASK

Marks: 2
B. META_MASK

486 An ActionEvent is generated -


C. SHIFT_MASK
a button is pressed, component gains or losses keyboard focus,
A.
scroll
D. All of the mentioned

B. a button is pressed, scroll bar is manipulaed, menu item is se


Answer optiond
a button is pressed, input received from the keyboard, window i
C.
activ
Marks: 1

D. a button is pressed, a list item is double-


489 Which components of AWT are used to produce following output.

Answer optiond
A. TextArea,Label,Button

Marks: 1
B. Label,Choice,Button

487 The method getWhen( ) returns-


C. List,TextField,Button

A. a value that indicates which modifier keys pressed.


D. List,Label,TextArea

B. the time at which the event took place.


Answer optionc

C. obtain the command name for the invoking ActionEvent object.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

clicked, menu item is selec


lass-

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Select proper output for
public
following.. import java.awt.*;
{
import java.applet.*; class list
extends Applet

public void init()


{
Button b1=new Button("OK");
List l=new List(5,true);
TextField t1=new TextField("Languages used");
CheckboxGroup cbg=new CheckboxGroup(); Checkbox
c1,c2;
c1=new Checkbox("Server Side",true,cbg); c2=new
Checkbox("Client Side",false,cbg);
l.add("java");
l.add("php");
l.add("c++");
l.add("c");
l.add("Python"); add(l);
490 add(t1);add(b1);add(c1);add(c2);

}}
/*<applet code=list.class height=200 width=200> </applet>*/

A.

B.

C.

D.

Answer optiona

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
491 We cannot alter text in TextField when___

A. setEditable(true)

B. setEditable(false)

C. isEditable()

D. All of Above

Answer optionb

Marks: 1

492 ____method is used to lock the textfield component

A. getText()

B. setText()

C. getSelectedText()

D. setEditable(false)

Answer optiond

Marks: 1

493 which is constructor of Checkbox()?

A. Checkbox(String label)

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Checkbox(String label,boolean state)

C. Checkbox(String label,boolean state,CheckboxGroup group)

D. All of Above

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiond

Marks: 1

494 Following are the method(s) of List class

A. getSelectedIndex()

B. getSelectedIndexes()

C. getSelectedItem()

D. All of Above

Answer optiond

Marks: 1

Which of the following method does not belongs to Choice


495 class

A. getItem()

B. getSelectedIndexes()

C. getSelectedItem()

D. All of Above

Answer optionb

Marks: 1

 Which of these interfaces define a method


496 actionPerformed()?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
.

A. ComponentListener

B. ContainerListener

C. ActionListener

D. InputListener

Answer optionc

Marks: 1

497 setSelectedCheckbox() is the method of ________

A. Checkbox

B. CheckboxGroup

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. List

D. RadioButton

Answer optionb

Marks: 1

498 TextArea supports _____method(s) of TextComponent class

A. select()

B. isEditable()

C. getText()

D. All of above

Answer optiond

Marks: 1

499 Which of these are methods of MouseListener Interface?

A. mouseDragged()

B. MouseMotionListener()

C. MouseClick()

D. MousePressed()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiond

Marks: 1

What does following line of code do ?


500 TextField text=new TextField(30);

A. Creates text object with 30 rows of text

B. Creates text object and initilizes with value 30

C. Creates text object with 30 columns of text

D. This is invalid code

Answer optionc

Marks: 1

501 How many ways can we align the label in a container ?

A. 1

B. 2

C. 3

D. 4

Answer optionc

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
502 AWT includes multiline editor called as ______

A. TextField

B. Label

C. Button

D. TextArea

Answer optiond

Marks: 1

Which are the active controls that support any interaction with the
503 us

A. Choice

B. List

C. Button

D. All of Above

Answer optiond

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
.import java.awt.*;
.import java.applet.*; ic class
1 ChoiceDemo extends Applet
2
3.publ public void init()
4.{ 5. {
6. 7. Button b1=new Button("OK"); Choice
8. l=new Choice();
9. l.add("java");
10. l.add("php");
504 11. l.add("c++");
12. l.add("c",true);

13. l.add("Python");

14. add(l);

15. add(b1);

16.}} 17.
18./*<applet code=choice.class height=200 width=200>
19.</applet>*/
Which statement number shows compilation error ?

A. 7.Button b1=new Button("ok");

B. 8.Choice l=new Choice();

C. 12.l.add("c",true);

D. No Compilation Error in given code

Answer optionc

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
import
public java.awt.*; import
java.applet.*;
{ class choiceDemo
extends Applet

public void init()


{
Button b1=new Button("OK");
Choice l=new Choice(); Label
lb=new Label("List");
add(lb);
l.add("java");
l.add("php");
l.add("c++");
l.add("c");
lb.add("Python");
505 add(l); add(b1);
}}
/*<applet code=choice.class height=200 width=200>
</applet>*/
Which is incorrect statement ?

A. Label lb=new Label("List");

B. add(b1);

C. lb.add("Python");

D. None of above

Answer optionc

Marks: 2

import java.awt.*; import


java.applet.*;
506 public class textareaex extends Applet
{
public void init()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
{

TextField t2=new TextField("welcome",20,40);


TextArea t1=new TextArea(10,30); add(t1);add(t2);
}}
/*<applet code=textareaex.class height=200 width=200>
</applet>*/
Which statement will give an error ?

A. TextArea t1=new TextArea(10,30);

B. TextField t2=new TextField("welcome",20,40);

C. public class textareaex extends Applet

D. add(t1);add(t2);

Answer optionb

Marks: 2

507 An ItemEvent is generated when............................

A. user clicked the mouse

B. keyboard input occurs.

C. a checkable menu item is selected or deselected.

D. The window was activated.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionc

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
508 The Swing was previously known as
C. Graph

A. Java shoot
D. Table

B. Java control
Answer optionc

C. Java Class
Marks: 2

D. Java Foundation Class


511 Swing components are referred to as platform-

Answer optiond
A. Heavyweight

Marks: 1
B. Elements

509 Swing is an excellent replacement for


C. Lightweight

A. Abstract Window Toolkit (AWT)


D. Light Components

B. Java control
Answer optionc

C. Java drive
Marks: 1

D. Java class
512 In Java Swing, the JTable has a model called

Answer optiona
A. JModel

Marks: 1
B. TableModel
The following are advanced components that comes with Swing
510 ex
C. JRule

A. Trees
D. JSwing

B. Lists

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
cept
Answer optiond

indepen
dent
and
thus
desc

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

select the correct output for following code


import javax.swing.*;
public class FirstSwingExample {
public static void main(String[] args) {
JFrame f=new JFrame();//creating instance of JFrame

JButton b=new JButton("click");//creating instance of JButton


b.setBounds(130,100,100, 40);//x axis, y axis, width, height
513
f.add(b);//adding button in JFrame

f.setSize(400,500);//400 width and 500 height


f.setLayout(null);//using no layout managers
f.setVisible(true);//making the frame visible
}
}

A.

B.

C.

D.

Answer optionc

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
select the correct output for following
code import javax.swing.*; class
LabelExample
{
public static void main(String args[])
514 {
JFrame f= new JFrame("Label Example");
JLabel l1,l2;
l1=new JLabel("First Label.");
l1.setBounds(50,50, 100,30);

l2=new JLabel("Second Label.");


l2.setBounds(50,100, 100,30);
f.add(l1); f.add(l2);
f.setSize(300,300);
f.setLayout(null);
f.setVisible(true);
}
}

A.

B.

C.

D. None of the above

Answer optionc

Marks: 2

-------------- is the class representing event notifications for


515 chang within a web application.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. HttpServlet

B. Cookie

C. HttpSessionEvent

D. None of the above

Answer optionc

Marks: 1

Which of the following method call can be used to send an error respo
516 using the specified integer 'statusCode' and String error message 'mes

A. request.sendError(statusCode,message)

B. response.sendError(statusCode,message)

C. header.sendError(statusCode,message)

D. None of the above

Answer optionb

Marks: 1

_______method of HttpServletResponse interface can be used to redirect


517 another resource, it may be servlet, jsp or html file.

A. sendRedirect()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. sendError()

C. Redirect()

D. None of the above

Answer optiona

Marks: 1

Which methods are used to bind the objects on HttpSession instance


518 and

A. setAttribute() only

B. getAttribute() only

C. Both A and B

D. None of the above

Answer optionc

Marks: 1

getAuthType() returns the name of the _______used to protect the


519 servl

A. authentication scheme

B. authority Scheme

C. Authorization scheme

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. none of above

Answer optiona

Marks: 1

520 ____ returns an enumeration of the header names

A. getHeaderNames()

B. getNames()

C. getHeader()

D. none of the above

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 1

tion?
_______ method returns the part of this request's URL that calls
521 the

A. getServletPath()

B. getPathInfo()

C. getPathTranslated()

D. None of the above

Answer optiona

Marks: 1

522 Which of the following is not a method of HttpServletRequest interface

A. isRequestedSessionIdFromCookie( )

B. getHeader(String field )

C. getMethodI( )

D. addCookie(Cookie cookie)

Answer optiond

Marks: 1

523 Which class provides system independent server side implementa

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. Socket

B. ServerSocket

C. Server

D. ServerReader

Answer optionb

Marks: 1

------------Determines if the session ID must be encoded in the


524 so, returns the modified version of url. Otherwise, returns ur

A. encodeRedirectURL(String url)

B. String encodeURL(String url)

C. encode(String url)

D. None of the above

Answer optionb

Marks: 1

________ returns a boolean indicating whether the named respon


525 head set.

A. void containsHeader(String name)

B. boolean containsHeader(String name)

l.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. boolean containsHeader()

D. Boolean isHeader(String name)

Answer optionb

Marks: 1

526 Following Shows networking terminologies ?

A. IP Address

B. Protocol

C. URL

D. All of the above

Answer optiond

Marks: 1

________ returns true if the server created the session and it has
527 not by the client.

A. invalidate( )

B. isNew()

C. getLastAccessedTime( )

D. None of the above

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionb

Marks: 1

528 Invalidate() method belongs to ______interface

A. SessionBindingListener

B. HttpSessionBindingListener

C. HttpBindingListener

D. HttpListener

Answer optionb

Marks: 1

______ interface is implemented by objects that need to be notified


529 wh to or unbound from an HTTP session.

A. SessionBindingListener

B. HttpSessionBindingListener

C. HttpBindingListener

D. HttpSessionBinding

Answer optionb

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
530 Cookies are stored at _____ side.

A. server

B. client

C. Both A and B

D. Neither A nor B

Answer optionb

Marks: 1

Some of the information that is saved for each cookie includes the
531 fol

A. The name of the cookie

B. The value of the cookie

C. The expiration date of the cookie

D. All of the above

Answer optiond

Marks: 1

---------------returns true if the browser is sending cookies only ove


532 protocol, or false if the browser can send cookies using any protocol.

A. getSecure( )

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. getName( )

C. clone()

D. None of these

Answer optiona

Marks: 1

533 The HttpServlet class extends ______

A. GenericServlet

B. Servlet

C. Throwable

D. none of the above

Answer optiona

Marks: 1

534 Which of the following is not a method of HttpServlet class?

A. doDelete()

B. doGet()

C. doHead()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. getValue()

Answer optiond

Marks: 1

Which method is Called by the server when an HTTP request arrives


535 for

A. getLastModified()

B. service()

C. init()

D. None of the above

Answer optiond

Marks: 1

536 HttpSessionEvent encapsulates ______Object

A. Event

B. session

C. request

D. response

Answer optiona

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

537 _____ returns the name of the cookie.

A. getName()

B. getName(String s)

C. getName(String s,String a)

D. none of the above

Answer optiona

Marks: 1

---------returns the current session associated with this request,


538 or not have a session, creates one.

A. getName()

B. getSession()

C. getSessionName()

D. putSession()

Answer optionb

Marks: 1

539 A servlet developer overrides which of the following methods?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. doDelete()

B. doGet()

C. doHead()

D. All of the above

Answer optiond

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Identify Error in the following servlet code import
java.io.*;
public class ColorGetServlet extends HttpServlet {
public void doGet(HttpServletRequest request,HttpServletRespon
resp
ServletException, IOException {
540
String color = request.getParameter("color"); response.setConte
PrintWriter pw = response.getWriter(); pw.println("<B>The selec
pw.println(color); pw.close();
}
}

A. javax.servlet.http.* ;is missing

B. javax.servlet.*; is missing

C. Both A and B

D. None of the above

Answer optionc

Marks: 2

541 Which classes are used for connection-oriented socket programm

A. Socket

B. ServerSocket

C. Both A and B

D. None of the above

Answer optionc

ing?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

542 The ______is invoked when a form on a Web page is submitted.

A. servlet

B. session

C. cookie

D. none of above

Answer optiona

Marks: 1

Find error in the following


code import java.io.*; import
javax.servlet.*; import
javax.servlet.http.*;
public class ColorPostServlet extends HttpServlet
{
public void doPost(HttpServletRequest request,HttpServletResponse
res
543 ServletException, IOException
{
String color =
request.getParameter("color"); PrintWriter
pw = response.getWriter();
pw.println("<B>The selected color is: ");
pw.println(color); pw.close();
}
}

A. Some classes/ interfaces not imported

B. Correct Exception is not thrown by the method

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. No Error

D. response.setContentType("text/html"); is missing

Answer optiond

Marks: 2

Which is a one-way communication only between the client and the serve
544 reliable and there is no confirmation regarding reaching the message t

A. TCP/IP

B. UDP

C. Both A & B

D. None of the above

Answer optionb

Marks: 1

545 Which method returns copy of this cookie object?

A. getclone()

B. clone()

C. setclone()

D. None of these

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionb

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Which class allows state information to be stored on a client
546 machine?

A. Cookie

B. HttpServlet

C. HttpSession

D. None of these

Answer optiona

Marks: 1

547 getCookies() method returns ______ of the cookies in this requ

A. array

B. enum

C. object

D. none of the above

Answer optiona

Marks: 1

548 Which method returns the URL?

A. getURL()

B. URL()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
est

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. getRequestURL()

D. None of the above

false
Answer optionc

Marks: 1

549 ______ returns true if a cookie contains session id otherwise

A. isRequestedSessionFromCookie()

B. isRequestedFromCookie()

C. isRequestedSessionCookie()

D. None of the Above

Answer optiona

Marks: 1

______ method returns true if requested session ID is valid in the


550 c context

A. isRequestedSessionIdValid()

B. isSessionIdValid()

C. isRequestedIdValid()

D. RequestedSessionIdValid()

Answer optiona

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

551 Which method redirects the client to the URL?

A. sendRedirect(String url)

B. Redirect(String url)

C. sendError(String url)

D. None of the above

Answer optiona

Marks: 1

552 ____ method adds field to the header with date value equal to

A. void setDateHeader(String field,long msec)

B. void DateHeader(String field,int msec)

C. void setDateHeader(long msec)

D. void setDate(String field,long msec)

Answer optiona

Marks: 1

553 Which method sets status code for this response to code

A. void setStatus(int code)

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
msec?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. void setStatus()

C. void Status(int code)

D. None of the above

Answer optiona

Marks: 1

Which method returns the time when the client last made a request
554 for

A. void getLastAccessDate()

B. long getLastAccessedTime()

C. getAccessedTime()

D. None of the above

Answer optionb

Marks: 1

555 Which method performs an HTTP DELETE?

void doDelete(HttpServletRequest req,HttpServletResponse res) throws


A.
I ServletException

void Delete(HttpServletRequest req,HttpServletResponse res) throws


B.
IOE ServletException

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
void destroy(HttpRequest req,HttpServletResponse res) throws
C.
IOExcepti ServletException

void doDestroy(HttpRequest req,HttpResponse res) throws IOException,


D.
S

Answer optiona

Marks: 1

556 Which method performs an HTTP GET?

void Get(HttpServletRequest req,HttpServletResponse res) throws


A.
Servl

void doGet(HttpServletRequest req,HttpServletResponse res) throws


B.
IOEx ServletException

void DoGet(HttpServletRequest req,HttpServletResponse res) throws


C.
IOEx ServletException

D. None of the above

Answer optionb

Marks: 1

_____ method invalidates this session and removes it from the


557 context?

A. void invalidate()

B. void validate()

C. void verify()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. void removeAttribute()

Answer optiona

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

_________ method removes attribute specified by attr from the


558 session.

A. void removeAttribute(String attr)

B. void removeAttribute()

C. void deleteAttribute(String attr)

D. void remove()

Answer optiona

Marks: 1

559 Which of the following is not a method of HttpSession interfac

A. getAttribute()

B. setAttribute()

C. setHeader()

D. isNew()

Answer optionc

Marks: 1

560 All the methods of _____Interface throw IllegalStateException

A. Session

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
e?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. HttpSession

C. cookies

D. Servlet

Answer optionb

Marks: 1

561 Which of the following is true about cookies?

A. Cookies are stored on client

B. Cookies contain state information

C. Cookies track user activities

D. All of the above

Answer optiond

Marks: 1

562 Which one is not a constructor for cookie?

A. Cookie() only

B. Cookie(String name) only

C. a and b

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. Cookie(String name,String value)

Answer optionc

Marks: 1

If an expiration date is not explicitly assigned to a cookie,it is


563 del

A. Immediately after creation

B. When session is expired

C. when current browser session ends.

D. Never

Answer optionc

Marks: 1

564 Which of the following is not a method of cookie class?

A. Clone()

B. getMaxAge()

C. doGet()

D. getName()

Answer optionc

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

565 Which of the following are methods of HttpServlet Class?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. setComment()

B. doDelete() only

C. doGet() only

D. b and c

Answer optiond

Marks: 1

566 HttpServlet class methods throw _______.

A. IOException only

B. ServletException only

C. IllegalstateException only

D. IOException and ServletException only

Answer optiond

Marks: 1

Which of the following is constructor for HttpSessionEvent


567 Cla

A. HttpSessionEvent()

B. HttpSessionEvent(Httpsession session)

C. HttpSessionEvent(String value)

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
ss?

D. None of the above

Answer optionb

Marks: 1

568 httpServlet program overrides ____ method

A. doPut() only

B. doHead() only

C. doTrace()

D. All Of The Above

Answer optiond

Marks: 1

_____ and _____ requests are most commonly used when handling form
569 in

A. get , post

B. put , trace

C. head , delete

D. none of above

Answer optiona

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

570 ____ identifies a servlet to process HTTP GET request

A. session

B. cookie

C. URL

D. request

Answer optionc

Marks: 1

Parameters of ____ request are included as part of the URL that is


571 sen Server.

A. HTTPPOST

B. HTTPGET

C. HTTPDELETE

D. HTTPTRACE

Answer optionb

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
------------ method returns true if the cookie contains session
572 id.oth false

A. Boolean isRequestedSessionIdFromCookie()

B. Boolean isRequestedSessionId()

C. Boolean isSessionIdFromCookie()

D. None of the above

Answer optiona

Marks: 1

---------method returns any extra path information associated with


573 th sent when it made this request.

A. String getPathInfo()

B. String getPath()

C. String getMethod()

D. None of the above

Answer optiona

Marks: 1

574 ------------- returns an array of the cookies in this request

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. Cookie[] getCookies()

B. Cookie[] getMaxCookies()

C. Cookie[] getMinCookies()

D. None of the above

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 1

575 Which method returns int equivalent of the header field named

A. int getHeader()

B. int getIntHeader()

C. int getIntHeader(String field)

D. None of these

Answer optionc

Marks: 1

---------- method returns name of the user who issues this


576 req

A. String getRemoteUser()

B. String getUser()

C. String getRemote()

D. None of these

Answer optiona

Marks: 1

577 Which method adds cookie to the HTTP response

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
field?

uest.

A. void addCookie()

B. void addCookie(Cookie cookie)

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. void addCookie(String cookie)

D. void addCookie(int i)

Answer optionb

Marks: 1

578 _____ sets status code for this response to code

A. setStatus()

B. setStatus(int code)

C. setStatusCode(int code)

D. None of the Above

Answer optionb

Marks: 1

579 Cookies were originally designed for __________

A. Client-side programming

B. Server-side programming

C. Both Client-side & Server-side programming

D. web programming

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionb

Marks: 1

580 ----is not a protocol

A. Telnet

B. TCP

C. FTP

D. hit

Answer optiond

Marks: 1

581 Following are tasks of Proxy Server__________

A. Filter certain request

B. cache the results of request for future use

C. provide faster access of catched pages to clients

D. All of the above

Answer optiond

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
582 Select incorrect statement about Internet Protocol

A. It is low level routing Protocol

B. It breaks data into small packets

C. sends packet to an address across network

D. it is higher level Protocol

Answer optiond

Marks: 1

583 Canvas is a ______________

A. Window

B. Frame

C. Panel

D. applet

Answer optiona

Marks: 1

584 By default page-up and page-down increment of scrollbar is____________

A. 20

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. 10

C. 15

D. 5

Answer optionb

Marks: 1

585 Scrollbar( ) creates a ______________ scroll bar by default.

A. Vertical

B. Horizantal

C. Both

D. None

Answer optiona

Marks: 1

----- is the protocol that web browser and server use to transfer
586 hype images

A. FTP

B. HTTP

C. telnet

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. none of above

Answer optionb

Marks: 1

587 Which of the following are various AWT controls?

A. Labels, Push buttons, Check boxes, Choice lists.

B. Text components, Threads, Strings, Servelts, Vectors

C. Labels, Strings, JSP, Netbeans, Sockets

D. Push buttons, Servelts, Notepad, JSP

Answer optiona

Marks: 1

588 To execute a statement, we invoke method

A. execute method

B. executeRel method

C. executeStmt method

D. executeConn method

Answer optiona

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

A typical __________ program obtains a remote reference to one or


589 more a server and then invokes methods on them.

A. server

B. client

C. thread

D. concurrent

Answer optionb

Marks: 1

590 File transfer protocol(FTP) is used for____________

A. Speed

B. Efficient

C. Security

D. All of the above

Answer optiond

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Which of these class is necessary to implement datagrams?

591

A. DatagramPacket

B. DatagramSocket

C. All of the mentioned

D. None of the mentioned

Answer optionc

Marks: 1

The Prepared statement _____symbolis a placeholder that is replaced


592 by parameter at seen time

A. ?

B. *

C. /

D. +

Answer optiona

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
593 Which methods are commonly used in ServerSocket class?

A. public OutputStream getOutputStream()

B. public synchronized void close()

C. public Socket accept()

D. none of the above

Answer optionc

Marks: 1

594 The ___________method is used to insert data into table

A. execute()

B. executeQuery()

C. executeUpdate()

D. None of the above

Answer optionc

Marks: 1

595 Which method is used to load the driver?

A. Class.forName()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. class.forname()

C. Connection con

D. None of the above

Answer optiona

Marks: 1

596 A small data file in the browser.

A. Cookie

B. Web Server

C. FTP

D. DATABASE

Answer optiona

Marks: 1

Unlike User Datagram Protocol (UDP), Transmission Control Protocol


597 (TC which is

A. Connection Oriented

B. Connectionless

C. Connection Available

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. Connection Origin

Answer optiona

Marks: 1

Unlike Transmission Control Protocol (TCP), User Datagram Protocol


598 (UD which is

A. Connection Oriented

B. Connectionless

C. Connection Available

D. Connection Origin

Answer optionb

Marks: 1

The JDBC-ODBC Bridge driver translates the JDBC API and used with
599 ____

A. JDBC drivers

B. ODBC drivers

C. Both A and B

D. None of the above

Answer optionb

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

Which protocol is for breaking and sending packets to an address


600 acros

A. UDP

B. TCP/IP

C. Proxy server

D. none of the above

Answer optionb

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Consider the following code. What will be student table data af
exe table has only one record. import java.sql.*; public clas
{
public static void main(String[] args) throws Exception
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
601 Connection con=DriverManager.getConnection("jdbc:odbc:mystud")
PreparedStatement ps = con.prepareStatement("delete * from stu
.executeUpdate(); Statement st = con.createStatement(); ResultS
ps.executeQuery("select * from student");
while (Rset.next()) { int studid = Rset.getInt("rno");
String studname = Rset.getString("name");
System.out.println(studid + " " +studname); } } }

A. One record will get displayed.

B. No record will get displayed.

C. All records will get displayed.

D. None of the above.

Answer optionb

Marks: 2

602 The __________object allows you to execute parametrized querie

A. putString()

B. insertString()

C. setString()

D. setToString()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
;
dent");

Answer optionc

Marks: 1

603 UDP stands for ---------

A. User Datagram Protocol

B. Uses Datagram Protocol

C. user data procedure

D. user data program

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 1

Central Computer which is powerful than other computers in the


604 network __________.

A. client

B. server

C. hub

D. switch

Answer optionb

Marks: 1

which class is used to create servers that listen for either local
605 or

A. Server Machine

B. Client Machine

C. HttpServer

D. ServerSockets

Answer optiond

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
606 The class java.sql.Timestamp is associated with _______

A. java.util.time

B. java.sql.Time

C. java.util.Date

D. None of the above

Answer optionc

Marks: 1

Fill in the blank space?

import java.sql;
class connectDB
{
607 public static void main(String arg[])
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
System.out.println("Driver Loaded");
String url="jdbc:odbc:myDCN");
Connection con=__________.getConnection(url);
System.out.println("Connection to database is created");
}
catch(SQLException e)
{
System.out.println("Error"+e);
}
catch(Exception e)
{
system.out.println("Error"+e);
}
}
}
}

A. DriverManager

B. classmanager

C. statementmanager

D. None of the above

Answer optiona

Marks: 2

608 Which are the navigation methods of resultset?

A. beforeFirst()

B. afterLast()

C. first()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. All of the above

Answer optiond

Marks: 1

__________method is used to execute the queries that contains the


609 INSE UPDATE statements.

A. execute()

B. executeQuery()

C. executeUpdate()

D. getResultSet()

Answer optionc

Marks: 2

610 Which of the following query is use for select query?

A. execute()

B. execute(String sql)

C. executeUpdate(String sql)

D. executeQuery(String sql)

Answer optiond

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

_________ method of HttpServletResponse interface adds cookies to


611 the

A. public void addCookie(Cookie cookie )

B. public void addCookie( )

C. public void getCookie(Cookie cookie )

D. public void getCookie( )

Answer optiona

Marks: 1

612 HTTP stands for___________?

A. Hypertext transfer processor

B. Hypertext Transfer Protocol

C. High transfer protocol

D. hyper transfer protocol

Answer optionb

Marks: 1

_______method from JDBC is the means of establishing a connection


613 betw Database.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. getConnection()

B. executeQuery()

C. createStatement()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. executeUpdate()

Answer optiona

Marks:
616 1Correct syntax of the constructor to create Cookie object is__

A servlet can write a cookie to a user's machine via the addCookie(


A.
614 Cookie(String value, String name)
) _____________ interface

B. Cookie(int value, String name)


A. ServletRequest

C. Cookie(String name, String value)


B. HttpServletRequest

D. Cookie(int value, int name)


C. HttpServletResponse

Answer optionc
D. ServletResponse

Marks: 1
Answer optionc

which driver converts JDBC API calls directly into the DBMS specific
617
Marks: 1n without a middle tier?

615
A. Which
Type 1driver converts JDBC API calls into DBMS-

A.
B. Type
Type 1
2

B.
C. Type
Type 2
3

C.
D. Type
Type 3
4

D.
Answer Type
optiond4

Answer
Marks: optionb
1

Marks:
618 1
Information that is saved for each cookie includes ______

A. The name, the value and expiration date of the cookie.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. The name and expiration date of the cookie only

specific client API


cal __:

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. The name of Cookie only.

D. The name and the value of the cookie only

Answer
Marks: optiona
1

Marks:
621 1Following is the correct syntax for creating Cookies Object c

which driver converts JDBC API calls middle tier net server that
A.
619 Cookie c = new Cookie(MyCookie, data);
trans into the DBMS specific network protocol ?

B. Cookie c = new Cookie("MyCookie", data);


A. Type 1

C. cookie c = new cookie("MyCookie", data);


B. Type 2

D. Cookie c = new Cookie(data,"MyCookie");


C. Type 3

Answer optionb
D. Type 4

Marks: 1
Answer optionc
The Elements Of Flow Layouts are arranged in ---------------
622
Marks: 1-

A. stacked, on the top of the other


620 Which driver allows access to multiple databases using one dri

B. laid out using the square of a grid


A. Type 1

C. Organized top to bottom, left to right


B. Type 2

D. organized at the borders and the centre of a container


C. Type 3

Answer optionc
D. Type 4

Marks: 1
Answer optionc

623 which method returns the current result as Resultset object.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
ver? .
A. execute()

----
fash

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. executeQuery()

C. getResult()

D. getResultSet()

Answer optiond

Marks: 1

Which method executes the given SQL statement , which return the
624 singl

A. execute()

B. executeQuery()

C. executeUpdate()

D. getResultSet()

Answer optionb

Marks: 1

625 What is the Difference Between Grid And Gridbaglayout?

In Grid layout the size of each grid is varying where as in


A.
GridbagLay constant.

In Grid layout the size of each grid is constant where as in


B.
GridbagLa be varied.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. The size of each component in both layout is same

D. All of the above

Answer optionb

Marks: 1

626 _______ method is called when servlet is initialized.

A. destroy()

B. service()

C. init()

D. connect()

Answer optionc

Marks: 1

Which driver provides JDBC access via one or more ODBC


627 drivers

A. Type 1 driver

B. Type 2 driver

C. Type 3 driver

D. Type 4 driver

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 1

628 To iterate the resultset you use its _________ method

A. next()

B. previous()

C. beforefirst()

D. afterLast()

Answer optiona

Marks: 1

629 A servlet is an instance of ___________

A. HTTPServlet class

B. Cookie

C. HttpSessionBindingEvent

D. HttpUtils

Answer optiona

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Which of the following method is used to Sets the maximum age of
630 th seconds.

A. public void setmaxage(int secs)

B. public void Setmaxage(String secs)

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. public void setMaxAge(String secs)

D. public void setMaxAge(int secs)

t?
Answer optiond

Marks: 1

When iterating the ResultSet you want to access the column values of
631 e so by calling one or more of the many ______ methods.

A. getXXX()

B. updateXXX()

C. setXXX()

D. None of the above

Answer optiona

Marks: 1

632 Which method moves the cursor to the first row of the resultse

A. first()

B. last()

C. next()

D. previous()

Answer optiona

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
633 Which method is called to process HTTP request?

A. destroy()

B. service()

C. init()

D. None of these

Answer optionb

Marks: 1

Which of the following method of HttpServletRequest interface is


634 used cookies from the browser.

A. Cookie getcookies()

B. private Cookie[] getCookies()

C. public Cookie[] getCookies()

D. public Cookie[] setCookies()

Answer optionc

Marks: 1

Which is correct for the Three Tier Architecture of JDBC?


635 i) It can connect to different databases without changing code
ii)Business logic is clearly separated from database.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. only i

B. only ii

C. both

D. none

Answer optionc

Marks: 2

636 What Is A Layout Manager?

A layout manager is an object that is used to organize components in


A.
a

B. It is a container object.

C. It is a component object.

D. All of the above

Answer optiona

Marks: 1

637 getUserName() is used to

A. retrive name of the user

B. access name

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. Both of the above.

D. None of the above.

Answer optiona

Marks: 2

638 what are the components of Three Tier Architecture?

A. Client-Tier

B. Middle_Tier

C. Data Source Layer

D. All of the above

Answer optiond

Marks: 2

----------method indicates to the browser whether the cookie should


639 o secure protocol, such as HTTPS or SSL.

A. public void setSecure(boolean flag)

B. public void setsecure(int flag)

C. private void setSecure(boolean flag)

D. public boolean setSecure(boolean flag)

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 1

640 Which driver is known as Network Protocol, Pure Java Driver?

A. Type 1

B. Type 2

C. Type 3

D. Type 4

Answer optionc

Marks: 1

641 Which driver is known as Native Protocol, Pure Java Driver.?

A. Type 1

B. Type 2

C. Type 3

D. Type 4

Answer optiond

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Which method moves the cursor to the beginning of the resultset that
642 i

A. beforeFirst()

B. afterLast()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. first()

D. last()

.
Answer optiona

Marks: 1

643 Following method is used for setting up comments in the cookie

A. public void setComment(int purpose)

B. public void setComment(String purpose)

C. public void getComment(String purpose)

D. private void setcomment(String purpose)

Answer optionb

Marks: 1

The server calls __________ method to relinquish any resources, such


644 a that are allocated for servlet.

A. service()

B. init()

C. destroy()

D. stop()

Answer optionc

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

645 The life cycle of servlet is managed by ___________

A. servlet context

B. servlet container

C. servletconfig

D. All of the above

Answer optionb

Marks: 1

Which of the following method is used to specify the path to


646 which return the cookie.

A. public void setPath(String path)

B. public void setpath(String value)

C. public void setPath(int path)

D. private void setpath(String path)

Answer optiona

Marks: 1

647 The include() method of RequestDispatcher ______

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. Sends a request to another resource

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Include the content of resource like servlet,jsp or html

C. Appends the request and response object to the current servle

D. None of the above

Answer optionb

Marks: 1

Find the error in the following


code import java.io.*; import
javax.servlet.*;
public class HelloServlet extends GenericServlet{
public void service(ServletRequest request, ServletResponse
648 response) ServletException,IOException{
response.setContentType("text/html");
PrintWriter pw =
response.getOutputStream(); pw.println("<b>
Hello"); pw.close();

A. import javax.servlet.*;

B. response.setContentType("text/html")
B. public void setDomain(int pattern)
C. PrintWriter pw = response.getOutputStream();
C. public void getDomain(String pattern)
D. None of these
D. private void setdomain(String pattern)
Answer optionc
Answer optiona
Marks: 2
Marks: 1
Which of the following method is used to Set the domain in whi
649 this
Which package contains the classes and interfaces required to build
650 se
A. public void setDomain(String pattern)

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
t
A. javax.servlet and javax.servlet.http

B. javax.servlet only

C. javax.servlet.http only

D. java.servlet and java.servlet.http

Answer optiona

Marks: 1

651 Which of the following method returns the cookie protocol ve

A. int getVersion( )

B. int setversion( )

C. int GetVersion( )

D. String getVersion( )

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
s

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
o

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
.

Answer optiona

Marks: 1

_______ class provides functionality that makes it easy to handle


652 re responses.

A. Generic Servlet

B. ServletInputStream

C. ServletOutputStream

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. None of these

Answer optiona

Marks: 1

653 Which of these classes implement the LayoutManager interface?

A. RowLayout

B. ColumnLayout

C. GridBagLayout

D. All of the above

Answer optionc

Marks: 1

654 _______method establishes the MIME type of the HTTP response.

A. setContentType()

B. ContentType()

C. setType()

D. none of above

Answer optiona

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

655 ______ is a way to maintain state (data) of an user.

A. Session Tracking

B. Cookie tracking

C. HttpServletState

D. Session

Answer optiona

Marks: 1

Which of the following interface declares the lifecycle method for


656 ser

A. Servlet

B. Servlet Config

C. ServletContext

D. ServletResponse

Answer optiona

Marks: 1

657 ____________encapsulates session events.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. httpsessionevent

B. HttpSessionEvent

C. HttpSessionTrackingEvent

D. HttpSessionEventObject

Answer optionb

Marks: 1

____________ interface allows servlet to get initialization


658 parameters

A. SingleThreadModel

B. ServletRequest

C. ServletConfig

D. ServletContext

Answer optionc

Marks: 1

Which of the following method returns the session in which the


659 event

A. HttpSession setSession( )

B. httpsession getsession( )

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. HttpSession getSession( )

D. HttpSession setSessionEvent( )

Answer optionc

Marks: 1

660 HTTP is a __________ protocol.

A. stateless

B. state oriented

C. stateful

D. none of above

Answer optiona

Marks: 1

How will the following program lay out its buttons. Select the one
cor

import java.awt.*; public


661 class MyClass {
public static void main(String args[]) {
String[] labels = {"A","B","C","D","E","F"};
Window win = new Frame();
win.setLayout(new GridLayout(1,0,2,3));

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
for(int i=0;i < labels.length;i++)
win.add(new Button(labels[i]));
win.pack();
win.setVisible(true);
}
}

A. The program will not display any buttons.

B. The program will display all buttons in a single row.

C. The program will display all buttons in a single column.

D. The program will display three rows - A B, C D, and E F.

Answer optionb

Marks: 2

662 A session can be created via the getSession( ) method of _____

A. HttpServletResponse

B. HttpServletRequest

C. HttpServlet

D. GenericServlet

Answer optionb

Marks: 1

______method Writes the specified message to a servlet log file


663 usual
_____.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. log(jString msg)

B. log()

C. Both A and B

D. none of above

Answer optiona

Marks: 1

664 JComboBox constructors are________________

A. JComboBox( )

B. JComboBox(Vector v)

C. JComboBox(Vector v,Vector v)

D. both a & b

Answer optiond

Marks: 1

In some applications, it is necessary to __________ so that informatio


665 from several interactions between a browser and a server.

A. save date and time information

B. save creation of session

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. save state information

D. save objects

Answer optionc

Marks: 1

A session can be created via the ___________ method of


666 HttpServletRequ

A. getSessionCreate( )

B. setSession( )

C. setsession( )

D. getSession( )

Answer optiond

Marks: 1

667 Which Swing classes can be used with progress bars?

A. JProgressBar

B. ProgressMonitor

C. ProgressMonitorInputStream

D. all the above

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiond

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
How will the following program lay out its buttons. Select the
cor

import java.awt.*; public


class MyClass {
public static void main(String args[]) {
String[] labels = {"A"};
668 Window win = new Frame();
win.setLayout(new FlowLayout());
for(int i=0;i < labels.length;i++)
win.add(new Button(labels[i]));
win.pack();
win.setVisible(true);
}
}

A. The button A will appear on the top left corner of the window.

The button A will appear on the middle row and column, in the
B.
center

C. The button A will appear on the top right corner of the window

D. The button A will appear on the top right corner of the window

Answer optionb

Marks: 2

HttpSession hs = request.getSession(true);
669 Above statement indicates that_____

A. Get the HttpSession object

B. Get the Http object.

C. Set the HttpSession object.

D. Set the Cookie object.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
.

Answer optiona

Marks: 1

What will be the output of the following code?


1. import java.io.*;
2. import java.util.*;
3. import javax.servlet.*;
4. import javax.servlet.http.*;
5 public class DateServlet extends HttpServlet {
6. public void doGet(HttpServletRequest request,
HttpServletResponse
ServletException, IOException {
7. HttpSession hs = request.getSession(true);
8. response.setContentType(""text/html"");
670 9. PrintWriter pw = response.getWriter();
10. pw.print(""<B>"");
11. Date date = (Date)hs.getAttribute(""date"");
12. if(date != null) {
13. pw.print(""Last access: "" + date + ""<br>"");
14. }
15. date = new Date();
16. hs.setAttribute(""date"", date);
17. pw.println(""Current date: "" + date);
18. }
19. }

The first line shows the date and time when the servlet was last
A.
acces line shows the current date and time.

B. shows the date and time when the servlet was last accessed.

C. shows the date and time when the servlet was last accessed

The first line shows the date and time when the servlet is first
D.
acces line shows the previous date and time.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 2

The ________ method is overridden to process any HTTP POST requests


671 th servlet.

A. doGet()

B. doPost( )

C. doPut()

D. doHead()

Answer optionb

Marks: 1

The ____________ method is overridden to process any HTTP GET


672 requests this servlet.

A. doPost( )

B. doPut()

C. doGet( )

D. doHead()

Answer optionc

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

The doGet( ) method is overridden to process any ________ requests


673 tha servlet.

A. HTTP POST

B. HTTP SET

C. HTTP TRACE

D. HTTP GET

Answer optiond

Marks: 1

The doPost( ) method is overridden to process any _________requests


674 th servlet.

A. HTTP POST

B. HTTP SET

C. HTTP TRACE

D. HTTP GET

Answer optiona

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Suppose a JFrame uses the GridLayout(2,0). If six buttons are added
675 t many columns are displayed?

A. 1

B. 2

C. 3

D. 4

Answer optionc

Marks: 1

How many frames are c related


? import java.awt.*; import
javax.swing.*;

public class FrameTest


{
public static void main(String args[])
{
676
JFrame fr=new JFrame("My frame");
JFrame fr1=fr; JFrame
fr2=fr1;
fr.setVisible(true);
fr1.setVisible(true);
fr2.setVisible(true);
}
}

A. 1

B. 2

C. 3

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. 0

Answer optiona

Marks: 2

677 ___________provide client request information to a servlet.

A. ServletResponse

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. ServletRequest

C. both a and b

D. None of these

Answer optionb

Marks: 1

678 The SingleThreadModel indicates that the __________ is thread

A. process

B. Thread
Answer optionc
C. Servlet
Marks: 2
D. GenericServlet
680 ________class provides stream to read binary data from the req
Answer optionc
A. ServletException
Marks: 1
B. GenericServlet
GenericServlet class implements _____ and __________
679 inter
C. ServletOutputStream
A. ServletRequest and ServletResponse
D. ServletInputStream
B. ServletResponse and Servlet
Answer optiond
C. Servlet and ServletConfig
Marks: 1
D. None of these

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
safe.
681 ________ class indicates that a servlet error occurred.

A. ServletException

B. IOExeption

C. ServletNotFound

D. None of these

Answer optiona

Marks: 1
faces.
___________ indicates that a servlet is permanently or temporarily
682 u

uest.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. ServletUnavailableException

B. IllegalException

C. ServletException

D. UnavailableException

Answer optiond

Marks: 1

683 The default alignment of buttons in Flow Layout is ..........

A. LEFT

B. CENTER

C. RIGHT

D. JUSTIFY

Answer optionb

Marks: 1

684 The default horizontal and vertical gap in FlowLayout is

A. 0 Pixel

B. 1 Pixel

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. 5 Pixel

D. 10 Pixel

Answer optionc

Marks: 1

685 The default horizontal and vertical gap in BorderLayout is

A. 0 Pixel

B. 1 Pixel

C. 5 Pixels

D. 10 Pixels

Answer optiona

Marks: 1

Which of the following interface allows a servlet to get


686 initializatio

A. ServletConfig

B. ServletContext

C. ServletRequest

D. ServletResponse

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 1

687 getServletContext() returns the __________ for this servlet.

A. value

B. context

C. enumeration

D. None of these

Answer optionb

Marks: 1

Which of the following method returns the value of the


688 initialization param

A. ServletContextgetServletContext()

B. String getInitParameter(String param)

C. Enumeration getInitParameterNames()

D. String getServerInfo()

Answer optionb

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
689 The ServletContext interface is implemented by the ________

A. client

B. server

C. cookie

D. session

Answer optionb

Marks: 1

Which of the following interface enables the servlet to obtain


690 informa environment?

A. ServletContext

B. ServletConfig

C. ServletRequest

D. ServletResponse

Answer optiona

Marks: 1

___________ methods are dangerous to use because they can corrupt


691 the machine.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. getServlet()

B. getServletNames()

C. both a and b

D. None of these

Answer optionc

Marks: 1

692 ________returns the port number to which the request was sent.

A. String getScheme()

B. String getServerName()

C. int getServerPort()

D. String getRemoteHost()

Answer optionc

Marks: 1

. ________ returns the host name of the server to which the request
693 wa

A. String getScheme()

B. String getServerName()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. int getServerPort()

D. String getRemoteHost()

Answer optionb

Marks: 1

______ method returns the name of the scheme used to make this
694 reques http, https, or ftp.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. getScheme()

B. setScheme()

C. putScheme()

D. none of the above

Answer optiona

Marks: 1

________ Returns the fully qualified name of the client or t


695 last the request.

A. String getRemoteHost()

B. String getRemoteAddr()

C. String getProtocol()

D. None of these

Answer optiona

Marks: 1

Which of the following package is missing for the below


pro import java.io.*: import javax.servlet.*;
public class PostParameterServlet extends GenericServlet{
696 public void service(ServletRequest request, ServletResponse
response throws ServletException ,IOException{ Printwriter pw=
response.getWriter(); Enumeration e= request.getParameterNames(
while(e.hasMoreElements()) {

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
gram?

String pname= (String) e.nextElement(); pw.print(pname


+ "= ");
Sting pvalue = request.getParameter(pname);
pw.println(pvalue);
}
pw.close();
}
}

A. import.java.util.*;

B. import javax.servlet.http.*;

C. import java.awt.*;

D. None of these

Answer optiona

Marks: 2

Write the missing statement in the below code

import javax.servlet.*;
public class WelcomeServlet extends GenericServlet
{
public void service( ServletRequest request,ServlerResponse
697 response) ServletException ,IOException
{
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
pw.println("<b> Hello");
}
}

A. pw.close()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. pw.stop()

C. pw.destroy()

D. none of these

Answer optiona

Marks: 2

Identify the missing statement at line no. 6.


1. import java.io.*;
2. import javax.servlet.*;
3. public class First extends GenericServlet{
4. public void service(ServletRequest req,ServletResponse
res) thr
698 ServletException{
5. res.setContentType("text/html"); 6. ?
7. out.print("<html><body>");
8. out.print("<b>hello generic servlet</b>");
9. out.print("</body></html>");
10. }
11. }

A. PrintWriter out=res.getWriter();

B. PrintWriter in = res.getWriter()

C. PrintWriter out=res.putWriter();

D. PrintWriter in = res.putWriter()

Answer optiona

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Which method is used to specify before any lines that uses the
699 PrintWr

A. SetPageType()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. SetType()

C. setContextType()

fe?
D. setResponseType()

Answer optionc

Marks: 1

700 Which method of servlet is/are called several times in its li

A. destroy()

B. service()

C. init()

D. none of above

Answer optiond

Marks: 1

In a web application, running in a web server, servlet is


701 responsibl creating______object.

A. request and response

B. request only

C. response only

D. none of above

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 1

702 Servlets execute ______of a web server

A. within the address space

B. out of the address space

C. any address space

D. none of the above

Answer optiona

Marks: 1

703 The UnavailableException Class is subclass of ______

A. IllegalArgumentException

B. ClassNotFoundExceptin

C. ServletException

D. All Of The Above

Answer optionc

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Which of the following method Write s and stack the trace for e to
704 th

A. void log(Throwable e )

B. void log( String s)

C. void log()

D. void log(String s, Throwable e)

Answer optiond

Marks: 1

Which of the following method returns an enumeration with the name


705 of same namespace in the server?

A. String getInitParameter(String param)

B. Enumeration getInitParameterNames()

C. Enumeration getServletNames()

D. None of these

Answer optionc

Marks: 1

_____________ returns the real path that corresponds to the


706 virtua

A. String getServerInfo()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. String getMimeType(String File)

C. String getRealPath(String vpath)

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. int getContentLength()

Answer optionc

Marks: 1

The ________ interface is used to indicate that only a singl


707 the service() method of a servlet.

A. SingleThreadModel

B. UnithreadModel

C. ThreadModel

D. None of These

Answer optiona

Marks: 1

The SingleThreadModel interface defines no constants and declares


708 no

A. True

B. False

C.

D.

Answer optiona

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
e
Marks: 1 threa

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
The servlet programmer should implement_______ interface to ens
709 tha handle only one request at a time.

A. ServletResponse

B. ServlerRequest

C. SingleThreadModel

D. None of these

Answer optionc

Marks: 1

Which of the following class provides implementations of the


710 for a servlet.

A. Servlet InputStream

B. GenericServlet

C. ServletException

D. Servlet OutputStream

Answer optionb

Marks: 1

711 void log(String s) method belongs to which of the following c

A. GenericServlet Class

lasses.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Servlet OutputStream Class

C. Servlet InputStream Class

D. None of These

Answer optiona

Marks: 1

Every servlet has it's own ________object and servlet container is


712 res instantiating this object.

A. ServletConfig

B. servletContext

C. Both A and B

D. none of the above

Answer optiona

Marks: 1

The ServletContext is _______ object and available to all the


713 servlets application.

A. unique

B. seperate

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. different

D. optional

Answer optiona

Marks: 1

714 Which of the following is the unique object per servlet?

A. ServletConfig

B. ServletContext

C. ServletRequest

D. None of these

Answer optiona

Marks: 1

715 . _______ is an unique object for complete application.

A. ServletConfig

B. ServletContext

C. ServletRequest

D. None of these

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionb

Marks: 1

We cannot set attributes in ________ interface that other servlets


716 can implementations.

A. ServletConfig

B. ServletContext

C. ServletRequest

D. None of these

Answer optionb

Marks: 1

717 ______interface is used for inter-servlet communication

A. RequestDispatcher

B. ServlerRequest

C. ServletResponse

D. none of above

Answer optiona

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Which of the following interface is used to forward the request to a
718 that can be HTML, JSP or another servlet in same application?

A. Request Dispatcher Interface

B. SinglethreadModel Interface

C. ServletResponse Interface

D. None of These

Answer optiona

Marks: 1

Which of the following method forwards the request from a servlet


719 to (servlet, JSP file, or HTML file) on the server?

A. void include(ServletRequest request, ServletResponse response)

B. void forward(ServletRequest request, ServletResponse response)

C. void include(ServletRequest request)

D. void forward(ServletRequest request)

Answer optionb

Marks: 1

720 ________ is protocol independent implementation of Servlet

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. ServletInputStream

B. ServletOutputStream

C. GenericServlet

D. None of These

Answer optionc

Marks: 1

Which of the following interface guarantees that no two threads will


721 e in the servlet's service method ?

A. ServletResponse

B. ServletRequest

C. SingleThreadModel

D. ServletConfig

Answer optionc

Marks: 1

722 ______ is the super class of all servlets.

A. GenericServlet

B. HttpServlet

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. Servlet

D. none of above

Answer optiona

Marks: 1

How many ServletContext objects are available for an entire web


723 applic

A. One each per servlet

B. One each per request

C. One each per response

D. Only one

Answer optiond

Marks: 1

724 Servlet creates ______ thread for each request of client.

A. single

B. two

C. multiple

D. None of These

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 1

725 Servlet runs each request in a __________ ?

A. OS shell

B. JVM

C. Separate thread

D. JRE

Answer optionc

Marks: 1

GenericServlet class is encapsulated inside __________


726 package

A. java.lang

B. javax.servlet

C. java.servlet

D. javax.servlet.http

Answer optionb

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
727 _________ is responsible for managing execution of servlet

A. Web Container

B. Servlet Context

C. JVM

D. Server

Answer optiona

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Consider the following program which class should be
extended? import java.io.*; import javax.servlet.*;
public class First extends ************{
public void service(ServletRequest req,ServletResponse
res) throws IOException,ServletException{
728 res.setContentType("text/html"); PrintWriter
out=res.getWriter(); out.print("<html><body>");
out.print("<b>hello generic servlet</b>");
out.print("</body></html>");
}
}

A. HttpServlet

B. GenericServlet

C. Servlet

D. None of These

Answer optionb

Marks: 2

ItemEvent constructor-
729 ItemEvent(ItemSelectable src, int type, Object entry, int
Here entry means......

A. The specific item that generated the item event is passed

B. The type of object

C. a reference to the component that generated event

D. The current state of that item.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
state)

Answer optiona

Marks: 1

730 The getItem( ) method can be used...

A. to obtain a reference to the all item

B. to obtain a reference to the item that changed.

C. get reference to the component.

D. get reference to the frame

Answer optionb

Marks: 1

The example of user interface elements that implement the


731 ItemSelectab

A. Choices and TextBox

B. TextBox and Lists

C. Lists and choices

D. Lists and canvas

Answer optionc

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
732 The getStateChange ( ) method returns the state change.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. The mouse pressed or released

B. Selected or Deselected

C. A page-up or page-down

D. The window gained input focus.

Answer optionb

Marks: 1

. Debug the following


program import java.awt.*;
import javax.swing.*;
/*
<applet code="JTableDemo" width=400 height=200>
</applet>
*/
public class JTableDemo extends JApplet
{
public void init() {
Container contentPane = getContentPane();
contentPane.setLayout(new BorderLayout());
final String[] colHeads = { "emp_Name", "emp_id",
733 "emp_salary" final Object[][] data = { { "Ramesh", "111",
"50000" },
{ "Sagar", "222", "52000" },
{ "Virag", "333", "40000" },
{ "Amit", "444", "62000" },
{ "Anil", "555", "60000" },
};
JTable table = new JTable(data);
int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp = new JScrollPane(table, v, h);
contentPane.add(jsp, BorderLayout.CENTER);
}
}

A. Error in statement in which applet tag is declared

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
};

B. Error in statement in which JScrollPane is created

C. Error in statement in which JTable is created

D. None of the above

Answer optionc

Marks: 2

Cookie ck=new Cookie("auth",null);


ck.setMaxAge(0);
734
A _______ value in the above method means that the cookie is not
store will be deleted when the Web browser exits.

A. Negative, Positive

B. Positive

C. Zero

D. Negative

Answer optiond

Marks: 1

A cookie's value can uniquely identify a client, so cookies are


735 common ___________________.

A. Cookie Management

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Session Management

C. Http Management

D. Servlet

Answer optionb

Marks: 1

736 ________ is removed each time when user closes the browser.

A. Non-persistent cookie

B. Persistent cookie

C. session

D. httpservlet

Answer optiona

Marks: 1

737 __________________ valid for single session only.

A. Persistent cookie

B. Non-persistent cookie

C. session

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. httpservlet

Answer optionb

Marks: 1

___________ is not removed each time when user closes the browser.
738 It user logout or sign out.

A. Non-persistent cookie

B. Persistent cookie

C. session

D. httpservlet

Answer optionb

Marks: 1

739 _____________ is valid for multiple session

A. Persistent cookie

B. Non-persistent cookie

C. session

D. httpservlet

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 1

Chose the correct output following


740 code import javax.swing.*; class
TextFieldExample

{
public static void main(String args[])
{
JFrame f= new JFrame("TextField Example");
JTextField t1,t2;
t1=new JTextField("Welcome to
Javatpoint."); t1.setBounds(50,100,
200,30); t2=new JTextField("AWT
Tutorial"); t2.setBounds(50,150, 200,30);
f.add(t1); f.add(t2);
f.setSize(400,400);
f.setLayout(null);
f.setVisible(true);
}
}

A.

B.

C.

D.

Answer optionb

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
741 Identify the methods which belong to Cookies.

A. public void setMaxAge(int expiry)

B. public String getName()

C. public String getValue()

D. All of above

Answer optiond

Marks: 1

742 Which of the following methods are related to Cookies?

A. public void setName(String name)

B. public void setValue(String value)

C. public Cookie[] getCookies()

D. All of above

Answer optiond

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Find which of the following options contains error
: import java.applet.*; import java.awt.*; import
javax.swing.*;

Public class fonts extends JApplet


{
Public void paint(Graphics g)
{
743 String str =" ";
String FontList[];
GraphicsEnvironment ge=
GraphicsEnvironment.getLocalGraphicsEnvironmen
FontList=ge.getAvailableFontFamilyNames();
For(int i=0;i<fontlist.length;i++)
Str+=FontList[i]+ " ";
g.drawString(str,10,16);
}
}

A. str+=FontList[i]+ "";

B. String FontList[];

C. For(int i=0;i<fontlist.length;i++)

D. none of the above

Answer optionc

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Choose the correct output to display the following Code.
import javax.swing.*;
import java.awt.event.*;
public class TextFieldExample implements ActionListener{
JTextField tf1,tf2,tf3;
JButton b1,b2;
TextFieldExample(){
JFrame f= new JFrame();
tf1=new JTextField();
tf1.setBounds(50,50,150,20);
tf2=new JTextField();
tf2.setBounds(50,100,150,20);
tf3=new JTextField();
tf3.setBounds(50,150,150,20);
tf3.setEditable(false);
b1=new JButton("+");
744 b1.setBounds(50,200,50,50);
b2=new JButton("-");
b2.setBounds(120,200,50,50);
b1.addActionListener(this);
b2.addActionListener(this);
f.add(tf1);f.add(tf2);f.add(tf3);f.add(b1);f.add(b2);
f.setSize(300,300);
f.setLayout(null);
f.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
String s1=tf1.getText();
String s2=tf2.getText();
int a=Integer.parseInt(s1);
int b=Integer.parseInt(s2);
int c=0;
if(e.getSource()==b1){

c=a+b;
}else if(e.getSource()==b2){
c=a-b;
}
String result=String.valueOf(c);
tf3.setText(result);
}
public static void main(String[] args)
{ new TextFieldExample(); } }

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A.

B.

C.

D.

Answer optiona

Marks: 2

import java.net.*;
745 In above statement net is -------

A. package

B. class

C. interface

D. method

Answer optiona

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

746 Identify the correct sequence of creating cookies.

1) Create a Cookie object. 2) Set the maximum Age. 3) Place the


A.
Cookie header.

1) Set the maximum Age. 2) Place the Cookie in HTTP response h


B.
object.

1) Place the cookie in HTTP response header. 2)


C.
object."

1) Set the maximum Age. 2) Create a Cookie object. 3)Place the


D.
Cookie header.

Answer optiona

Marks: 1

Choose the correct output to display the following


code import javax.swing.*; public class
TextAreaExample
{
TextAreaExample(){
JFrame f= new JFrame();
JTextArea area=new JTextArea("Welcome to javatpoint");
area.setBounds(10,30, 200,200);
747 f.add(area);
f.setSize(300,300);
f.setLayout(null);
f.setVisible(true);
}
public static void main(String args[])
{
new TextAreaExample();
}}

A. Output

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
eader. 3 Set the

maximum Age.

B. Output

C. Output

D. None of the above

Answer optiona

Marks: 2

748 ------ is a protocol

A. netnews

B. Sting

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. hit

D. none of above

Answer optiona

Marks: 1

749 -------is protocol

A. netnews

B. finger

C. e-mail

D. all of the above

Answer optiond

Marks: 1

________________ interface enables a servlet to obtain


750 information about a client request.

A. HttpServletRequest

B. HttpServletResponse

C. httpservletrequest

D. Http Request

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 1

which of the following are the methods in belong to


751 HttpServletReques

A. String getAuthType( )

B. Cookie[ ] getCookies( )

C. Both A and B

D. Neither A nor B

Answer optionc

Marks: 1

752 choose the output for following code:

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
package jprogressbardemo;
import java.awt.*;
import
javax.swing.*;

public class Main {

C. both public
a & b static void main(String[] args) {
final int MAX = 100;
final JFrame frame = new JFrame("JProgress Demo");
D. none of the above
// creates progress bar
final JProgressBar pb = new
Answer JProgressBar();
optiona pb.setMinimum(0);
pb.setMaximum(MAX);
pb.setStringPainted(true);
Marks: 2
// add progress bar
Which of frame.setLayout(new FlowLayout());
the following methods belong to HttpServletResponse
753 frame.getContentPane().add(pb);
interfa

A. void sendRedirect(String url) throws IOException


frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(300, 200); frame.setVisible(true);
B. void sendError(int c, String s) throws IOException
// update progressbar
for (int i = 0; i <= MAX; i++) {
C. Both A and currentValue
final int B = i;
try {
SwingUtilities.invokeLater(new Runnable() {
D. public void
Neither A nor Brun() {
pb.setValue(currentValue);
}
Answer });
optionc
java.lang.Thread.sleep(100);
} catch (InterruptedException e) {
Marks: 1 JOptionPane.showMessageDialog(frame,
e.getMess
}
754 Which of }the following methods belong to in HttpSession inte

A. } getId( )
String
}

B.
A. void invalidate( )

C. long getLastAccessedTime( )
B.

D. All of the above

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiond

age());
rface.

Marks: 1

755 What components will be needed to get following output?

A. JLabel, JTabbedPane, JCheckBox

B. JTabbedPane, JList, JApplet

C. JPanel, JTabbedPane, JList

D. JApplet, JTabbedPane, JPanel

Answer optionc

Marks: 2

_______________enables a servlet to read and write the state


756 informati associated with an HTTP session.

A. HttpRequest

B. HttpSession

C. HttpServletRequest

D. HttpServletResponse

Answer optionb

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

Choose the correct output to display the following Code.


import javax.swing.*;
757 import java.awt.event.*;
public class TextAreaExample implements ActionListener{

JLabel l1,l2;
JTextArea area;
JButton b;
TextAreaExample() {
JFrame f= new JFrame();
l1=new JLabel();
l1.setBounds(50,25,100,30);
l2=new JLabel();
l2.setBounds(160,25,100,30);
area=new JTextArea();
area.setBounds(20,75,250,200);
b=new JButton("Count Words");
b.setBounds(100,300,120,30);
b.addActionListener(this);
f.add(l1);f.add(l2);f.add(area);f.add(b);
f.setSize(450,450);
f.setLayout(null);
f.setVisible(true);
}
public void actionPerformed(ActionEvent e){
String text=area.getText(); String
words[]=text.split(" ");
l1.setText("Words: "+words.length);
l2.setText("Characters: "+text.length());
}
public static void main(String[] args) {
new TextAreaExample();
}
}

A.

B.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. Both A & B

D. None of the above

Answer optionb

Marks: 2

Choose the correct output to display the following code.


import javax.swing.*;
public class PasswordFieldExample {
public static void main(String[] args) {
JFrame f=new JFrame("Password Field Example");
JPasswordField value = new JPasswordField();
JLabel l1=new JLabel("Password:");
758 l1.setBounds(20,100, 80,30);
value.setBounds(100,100,100,30);
f.add(value); f.add(l1);
f.setSize(300,300);
f.setLayout(null);
f.setVisible(true);
}
}

A.

B.

C.

D.

Answer optiona

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 2

choose the correct output for for following


code: import java.awt.*; import
java.awt.event.*; import javax.swing.*;
/*
<applet code="JComboBoxDemo" width=300 height=100>
</applet>
759 */
public class JComboBoxDemo extends JApplet
implements ItemListener {
JLabel jl;
ImageIcon france, germany, italy,
japan; public void init() { // Get
content pane

Container contentPane = getContentPane();


contentPane.setLayout(new FlowLayout());
// Create a combo box and add it
// to the panel
JComboBox jc = new
JComboBox();
jc.addItem("France");
jc.addItem("Germany");
jc.addItem("Italy");
jc.addItem("Japan");
jc.addItemListener(this);
contentPane.add(jc); // Create
label
jl = new JLabel(new ImageIcon("france.gif"));
contentPane.add(jl);
}
public void itemStateChanged(ItemEvent ie) {
String s = (String)ie.getItem();
jl.setIcon(new ImageIcon(s + ".gif"));
}
}

A.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B.

C.

D. none of the above

Answer optiona

Marks: 2

import java.net.ServerSocket;
760 In above statement ServerSocket is -----------

A. package

B. class

C. interface

D. method

Answer optionb

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
choose output for following code:

import javax.swing.*;
import java.lang.*;
public class ToolTipExample {
public static void main(String[] args) {

//Creating PasswordField and label


JPasswordField value = new JPasswordField();
761
value.setBounds(100,100,100,30);
value.setToolTipText("Enter your Password");
JLabel l1=new JLabel("Password:");
l1.setBounds(20,100, 80,30);
//Adding components to frame
f.add(value); f.add(l1);
f.setSize(300,300);
f.setLayout(null);
f.setVisible(true);
}
}

A. Error in the program

B.

C.

D. none of the above

Answer optiona

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Find the missing statement from the following code:

import javax.swing.*;
import java.lang.*;
public class ToolTipExample {
public static void main(String[] args) {
_________________________________
//Creating PasswordField and label
JPasswordField value = new JPasswordField();
value.setBounds(100,100,100,30);
762 value.setToolTipText("Enter your Password");
JLabel l1=new JLabel("Password:");
l1.setBounds(20,100, 80,30);
//Adding components to frame
f.add(value); f.add(l1);
f.setSize(300,300);
f.setLayout(null);
f.setVisible(true);
}
}

A. JPanel p=new JPanel("Password Field Example");

B. JFrame f=new JFrame("Password Field Example");

C. JContentPane c=new JContentPane("Password Field Example");

D. none of the above

Answer optionb

Marks: 2

763 Which of these is a full form of DNS?

A. Data Network Service

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Data Name Service
Answer optionc

C. Domain Network Service


Marks: 1
D. Domain Name Service

766 UDP support -------


Answer optiond

A. a simpler communication
Marks: 1

B. a fasterThe
764 communication
HttpSession interface is implemented by the __________.

C. A.point tosession
point data gram oriental model

cookies
B.All of the
D. above

C. client
Answer optiond

D. server
Marks: 1
Answer optiond
Panel is a pure container and is not a window in itself. The sole
767 purp to 1organize the components on to a window.
Marks:

A cookie is stored on a _______ and contains state


A. True
765 information

A.False Session
B.

B. Cookies
C.

C. client
D.
D. server

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
. ,
Answer optiona whose

Marks: 1

768 Swing is a ----------------------------

compone
nts are
all
ulti

the javax.swing.JComponent class.

A. Model-Based

B. component-based framework

C. Relational Based

D. None of the above

Answer optionb

Marks: 1

769 java.net package's interfaces are____________

A. URLConnection

B. ContentHandlerFactory

C. DatagramSocket

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. All of the above

Answer optionb

Marks: 1

Choose correct output for following code:

import javax.swing.*;
import java.awt.event.*;
770 public class PasswordFieldExample {
public static void main(String[] args) {
JFrame f=new JFrame("Password Field Example");
final JLabel label = new JLabel();

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
label.setBounds(20,150, 200,50);
final JPasswordField value = new
JPasswordField();
value.setBounds(100,75,100,30); JLabel l1=new
JLabel("Username:"); l1.setBounds(20,20,
80,30); JLabel l2=new JLabel("Password:");
l2.setBounds(20,75, 80,30); JButton b = new );
JButton("Login");
b.setBounds(100,120, 80,30);
final JTextField text = new JTextField();
text.setBounds(100,20, 100,30);
f.add(value);
f.add(l1);
f.add(label);
f.add(l2);
f.add(b);
f.add(text);
}
f.setSize(300,300);
f.setLayout(null);
f.setVisible(true);
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String data = "Username " + text.getText(); data +=
", Password: "+ new String(value.getPassword()
label.setText(data);
}
});
}
}

A. Error in the program

B.

C.

D.

Answer optiona

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
771 Constructor of JCheckBoxMenuItem is

A. JCheckBoxMenuItem()

B. JCheckBoxMenuItem(Action a)

C. JCheckBoxMenuItem(String text, boolean b)

D. All of the above

Answer optiond

Marks: 1

772 Constructor of JTable is

A. JTable()

B. JTable(Object[][] rows, Object[] columns)

C. Both A & B

D. None of the above

Answer optionc

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Choose correct output for following code:

import javax.swing.*;
773 class MenuExample
{
JMenu menu, submenu;
JMenuItem i1, i2, i3, i4, i5;

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
MenuExample(){
JFrame f= new JFrame("Menu and MenuItem Example");
JMenuBar mb=new JMenuBar();
menu=new JMenu("Menu");
submenu=new JMenu("Sub Menu");
i1=new JMenuItem("Item 1");
DefaultMutableTreeNode("color"); DefaultMutableTreeNode
i2=new JMenuItem("Item 2");
font=new
i3=new JMenuItem("Item 3");
DefaultMutableTreeNode("font");
i4=new JMenuItem("Item 4"); style.add(color); style.ad
DefaultMutableTreeNode red=new
i5=new JMenuItem("Item 5"); DefaultMutableTreeNode("red");
DefaultMutableTreeNode
menu.add(i1);blue=new
menu.add(i2);
DefaultMutableTreeNode("blue");
menu.add(i3); submenu.add(i4);
DefaultMutableTreeNode
submenu.add(i5); black=new DefaultMutableTreeNode("black");
menu.add(submenu);
DefaultMutableTreeNode
mb.add(menu); green=new DefaultMutableTreeNode("green");
color.add(blue); color.add(black); color.add(green);
f.setJMenuBar(mb); JTree j
f.add(jt);f.setSize(400,400);
f.setSize(200,200); f.setVisible(true); } p
main(String[] args) {
f.setLayout(null); new TreeExample(); }}
f.setVisible(true);
import
} javax.swing.*; import javax.swing.tree.DefaultMutableTreeNode
TreeExample { JFrame f;
public static void main(StringTreeExample(){
args[]) f=new JFrame();
DefaultMutableTreeNode
{ style=new DefaultMutableTreeNode("St
DefaultMutableTreeNode
new MenuExample(); color=new DefaultMutableTreeNode("color");
DefaultMutableTreeNode font=new DefaultMutableTreeNode("font");
}}
style.add(font); DefaultMutableTreeNode red=new DefaultMutableTr
B. DefaultMutableTreeNode blue=new DefaultMutableTreeNode("blue");
DefaultMutableTreeNode black=new DefaultMutableTreeNode("black");
A.
DefaultMutableTreeNode green=new DefaultMutableTreeNode("green");
color.add(blue); color.add(black); color.add(green); JTree j
f.add(jt); f.setSize(200,200); f.setVisible(true); } p
B.
main(String[] args) { new TreeExample(); }}

import javax.swing.*; import


C. javax.swing.tree.DefaultMutableTreeNode
TreeExample { JFrame f; TreeExample(){ f=new
JFrame();
D. DefaultMutableTreeNode style=new
DefaultMutableTreeNode("Style");
DefaultMutableTreeNode color=new DefaultMutableTreeNode("color");
C.
Answer DefaultMutableTreeNode
optiond font=new DefaultMutableTreeNode("font");
style.add(font); DefaultMutableTreeNode red=new DefaultMutableTr
DefaultMutableTreeNode blue=new DefaultMutableTreeNode("blue");
Marks: DefaultMutableTreeNode
2 black=new DefaultMutableTreeNode("black");
DefaultMutableTreeNode green=new DefaultMutableTreeNode("green");
color.add(blue); color.add(black); color.add(green); f.
f.setSize(200,200); f.setVisible(true); } public static void
774 Select
args) {Correctnew
Code for Given Output:
TreeExample(); }}

import javax.swing.*; import javax.swing.tree.DefaultMutableTreeNode


A. TreeExample { TreeExample(){ f=new JFrame(); style=new
DefaultMutableTreeNode("Style"); DefaultMutableTreeNod

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
import javax.swing.*; import javax.swing.tree.DefaultMutableTreeNode
TreeExample { JFrame f; TreeExample(){ f=new JFrame();
DefaultMutableTreeNode style=new
DefaultMutableTreeNode("Style");
DefaultMutableTreeNode color=new DefaultMutableTreeNode("color");
D. DefaultMutableTreeNode font=new DefaultMutableTreeNode("font");
style.add(font); DefaultMutableTreeNode red=new DefaultMutableTr
DefaultMutableTreeNode blue=new DefaultMutableTreeNode("blue");
DefaultMutableTreeNode black=new DefaultMutableTreeNode("
DefaultMutableTreeNode green=new
DefaultMutableTreeNode("green");
DefaultM
u yle");

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
color.add(blue); color.add(black); color.add(green); JTree j
} public static void main(String[] args) { new Tr

Answer optionb

Marks: 2

Choose correct output for following code:

import javax.swing.*;
public class RadioButtonExample {
JFrame f;
RadioButtonExample(){ f=new
JFrame();
JRadioButton r1=new JRadioButton("A) Male");
JRadioButton r2=new JRadioButton("B)
Female"); r1.setBounds(75,50,100,30);
775 r2.setBounds(75,100,100,30); ButtonGroup
bg=new ButtonGroup();
bg.add(r1);bg.add(r2);
f.add(r1);f.add(r2);
f.setSize(300,300);
f.setLayout(null);
f.setVisible(true);
}
public static void main(String[] args)
{ new RadioButtonExample();
}}

A.

B.

C.

D. all the above

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

black");
eeExample();

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 2

776 What is the difference between scrollbar and scrollpane

A Scrollpane is a Component, but not a Container whereas Scrol


A.
handles its own events and perform its own scrolling.

A Scrollbar is a Component, but not a Container whereas Scrollp


B.
is handles its own events and perform its own scrolling

A Scrollbar is handles not its own events and perform its own
C.
Scrollpane handles not its own events and perform its own scr

D. all the above

Answer optionb

Marks: 1

777 What does x mean in javax.swing

A. x mean in javax.swing is Extension of java

B. x mean in javax.swing is Extreme of java

C. x mean in javax.swing is Ex. of java

D. x mean in javax.swing is Extra of java

Answer optiona

Marks: 1

778 A layout manager is basically an object, Its mainly used to or

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
olling

A. components in a container

B. Objects in a container

C. components in a window

D. Objects in a panel

Answer optiona

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
ganize
Find missing statement to get the output
ner{
shown import javax.swing.*; import
java.awt.*; import java.awt.event.*;
public class LabelExample extends Frame implements
ActionListe
JTextField tf; JLabel l; JButton
b; LabelExample(){
tf=new JTextField();
tf.setBounds(50,50, 150,20);
l=new JLabel();
l.setBounds(50,100, 250,20);
b=new JButton("Find IP");
b.setBounds(50,150,95,30);
b.addActionListener(this);
779 add(b);add(tf);add(l);
setSize(400,400);
setLayout(null);
setVisible(true);
}
public void actionPerformed(ActionEvent e) {
try{
String host=tf.getText();
____________________________________________
l.setText("IP of "+host+" is: "+ip);
}catch(Exception ex){System.out.println(ex);}
}
public static void main(String[] args) {
new LabelExample();
} }

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. String ip=java.net.InetAddress.getHostAddress();

String
B.
ip=java.net.InetAddress.getByName(host).getHostAddress(

C. String ip=java.net.InetAddress.getByName(host);

D. None of the above

Answer optionb

Marks: 2

Choose correct output for following


code: import javax.swing.*; import
java.awt.*; import java.awt.event.*;
public class DialogExample {
private static JDialog d;
DialogExample() {
JFrame f= new JFrame();
d = new JDialog(f , "Dialog Example", true);
d.setLayout( new FlowLayout() );
JButton b = new JButton ("OK");
b.addActionListener ( new ActionListener()
{
public void actionPerformed( ActionEvent e )
780 {
DialogExample.d.setVisible(false);
}
});
d.add( new JLabel ("Click button to continue."));
d.add(b);
d.setSize(300,300);
d.setVisible(true);
}
public static void main(String args[])
{
new DialogExample();
}
}

);

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A.

B.

C.

D. none of the above

Answer optionc

Marks: 2

781 TreeNode and MutableTreeNode is___________

A. Both are classes

B. class and interface

C. Both are interfaces

D. interface and class

Answer optionc

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Find Correct Output for given Code :

import javax.swing.*;
public class ToolTipExample {
public static void main(String[] args) {
782 JFrame f=new JFrame("Password Field Example");
JPasswordField value = new JPasswordField();
value.setBounds(100,100,100,30);
value.setToolTipText("Enter your Password");
JLabel l1=new JLabel("Password:");

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
l1.setBounds(20,100, 80,30);
f.add(value); f.add(l1);
f.setSize(300,300);
f.setLayout(null);
f.setVisible(true); } }

A. Error

B.

C.

D.

Answer optionb

Marks: 2

Which method is used to change size and position of


783 Components

A. void set(int x,int y,int width,int height)

B. void setBounds(int width,int height,int x)

C. void setbounds(int x,int y,int width,int height)

D. void setBounds(int x,int y,int width,int height)

Answer optiond

Marks: 1

784 JRadioButton is a subclass of ________ class.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
?
A. AbstractButton

B. ButtonGroup

C. JButton

D. ImageIcon

Answer optiona

Marks: 1

To implement swings which package is to be imported from the


785 following

A. javax.JSwing

B. java.swing

C. java.javax

D. javax.swing

Answer optiond

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
import java.awt.*; import
java.applet.*;
public class ListExapp extends Applet
/* <applet code="ListExapp" width=300 height=300></applet>*/
{
public void init()
786 {

List c=new List(6);


c.add("C");
c.add("C++");
c.add("Java");
c.add("PHP");

c.add("Android");
add(c);

}
} What is the ouput of above code ?

A.

B.

C.

D.

Answer optiona

Marks: 2

The default layout manager for the content pane of a swing based
787 apple

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. GridBoxLayout

B. CardLayout

C. FlowLayout

D. Border-Layout

Answer optionc

Marks: 1

Which of the following GridBagLayout variable defines the external


788 pad around the component in its display area?

A. gridwidth, gridheight

B. gridx, gridy

C. ipadx, ipady

D. insets

Answer optiond

Marks: 1

Which of the following GridBagLayout variables defines the padding


789 tha each side of the component?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. gridwidth, gridheight

B. gridx, gridy

C. ipadx, ipady

D. insets

Answer optionc

Marks: 1

Which of the following GridBagLayout variables specifies the number of


790 the component horizontally and vertically in the grid?

A. gridwidth, gridheight

B. gridx, gridy

C. ipadx, ipady

D. insets

Answer optiona

Marks: 1

Which component displays information in hierarchical manner with


791 paren relationship?

A. AWT

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Frame

C. Swing

D. Window

Answer optionc

Marks: 1

792 What is the name of the Swing class that is used for frames?

A. SwingFrame

B. Window

C. Frame

D. JFrame

Answer optiond

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

Swing is the set of ____________ that provides more powerful &


793 compare to Abstract Window Tooklit (AWT).

A. constructors

B. methods

C. classes

D. destructors

Answer optionc

Marks: 1

794 Which method is used to close a swing frame

A. WINDOW_CLOSING

B. WindowEvent(Window src, int type, Window other)

C. windowClosing(WindowEvent we)

D. setDefaultCloseOperation()

Answer optiond

Marks: 1

795 Select the correct code for following output

import java.awt.*; import java.applet.*; public class ListExapp


A.
exte
flexibl

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
publ

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
<applet code="ListExapp" width=300 height=300></applet>*/ {
c2=new Checkbox("Server Side");
c.add("C++"); c.add("Java"); c.add("PHP");
c.add("Android"); add(c1); add(c2);

import java.awt.*; import java.applet.*; public class ListExa


exte
<applet code="ListExapp" width=300 height=300></applet>*/ {
c2=new Checkbox("Server Side");
B. c.add("C++"); c.add("Java"); c.add("PHP");
c.add("Android"); add(c1); add(c2);

add(b2); } }

import java.awt.*; import java.applet.*; public class ListExa


exte
<applet code="ListExapp" width=300 height=300></applet>*/ {
C. c2=new Checkbox("Server Side");
c.add("C++"); c.add("Java"); c.add("PHP");
c.add("Android"); add(c1); add(c);
add(b2); } }
import java.awt.*; import java.applet.*; public class ListExa
exte
<applet code="ListExapp" width=300 height=300></applet>*/ {
c2=new Checkbox("Server Side"); List
D. c.add("C++"); c.add("Java"); c.add("PHP");
c.add("Android"); add(c1); add(c2);

Answer optiond

Marks: 2

796 Which of the following is not a swing class?

A. JComboBox

B. JFrame

C. JComponent

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. canvas

List c=new List(5); c.

publ
List c=new List(5); c.

add(

publ
List c=new List(5); c.

publ
c=new List(5); c.

Answer optiond

Marks: 1

__________ is a Swing class that allows the user to enter a


797 multipleli

A. JLabel

B. JTextField

C. JTextArea

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. JComboBox

Answer optionc

Marks: 1

798 _____________________ is not a Swing Component

A. CheckboxGroup

B. CheckBox

C. JComboBox

D. all the above

Answer optiona

Marks: 1

799 which AWT components are added in given output ?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. Button,TextField

B. Label,TextField

C. Button,Label ,TextArea

D. TextField,Button,TextArea

Answer optionc

Marks: 1

The Jtable of swings is used to display data in form


800 of______

A. JTable object displays rows and columns of data.

B. JTable object displays rows ONLY.

C. JTable object displays columns ONLY

D. none of the above

Answer optiona

Marks: 1

801 Which of the following view file types are supported in MVC?

A. .cshtml

B. .vbhtml

C. .aspx

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
_______

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. All of the above

Answer optiond

Marks: 1

Observe the following


code import java.awt.*;
import java.applet.*;
public class LayoutDemo5 extends Applet
{
public void init()
{
int i,j,k,n=4;

setLayout(new BorderLayout());
Panel p1=new Panel();
Panel p2=new Panel();

p1.setLayout(new FlowLayout());
802
p1.add(new TextField(20)); p1.add(new
TextField(20));

p2.setLayout(new GridLayout(5,3));
p2.add(new Button("OK"));
p2.add(new Button("Submit"));

add(p1,BorderLayout.EAST); add(p2,BorderLayout.WEST);
}
}
/*<applet code=LayoutDemo5.class width=300 height=400>
</applet>*/

What will be the output of the above program?

The output is obtained in Frame with two layouts: Frame layout and
A.
Flo

The output is obtained in Applet with two layouts: Frame layout and
B.
Fl

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
The output is obtained in Applet with two layouts: Frame layout and
C.
Bo

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
The output is obtained in Applet with two layouts: Border layou
D.
F

Answer optiond

Marks: 2

803 Term in MVC architecture that receives events is called as____

A. Receiver

B. Controller

C. Transmitter

D. Modulator

Answer optionb

Marks: 1

804 Which is the best approach to assign a session in MVC?

A. System.Web.HttpContext.Current.Session["LoginID"] =7;

B. Current.Session["LoginID"] =7;

C. Session["LoginID"] =7;

D. None

Answer optionb

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
_____

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
___________Constructs a new scroll bar with the specified
805 orientation

A. Scrollbar()

B. Scrollbar(int )

C. Scrollbar(int , int , int , int , int)

D. All of above

Answer optionb

Marks: 1

The class JList is a component which displays _________and allows


806 the or more items.

A. List of lists

B. list of objects

C. MVC Model

D. Item List

Answer optionb

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
import java.awt.*; public
class microGUI
{
807 public static void main ( String[] args )
{
Frame frm = new ___________();
frm.___________( 150, 100 );

frm.___________( true );
}
}
Fill in the blanks with correct sequence of methods.

A. Form, setVisible, setOn

B. Frame, setSize, setVisible

C. Frame, setVisible, setSize

D. Window, setSize, paint

Answer optionb

Marks: 2

808 Which is the correct constructor of GridLayout

A. GridLayout(int numrows)

B. GridLayout(int numrows, int numcols,intx)

C. GridLayout(int numrows, int numcols,intx,inty)

D. GridLayout(int numrows, int numcols)

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiond

Marks: 1

class helloFrame ___________ Frame


{
809 public void ___________( Graphics g )
{
g.___________("Hello", 10, 50 );

}
}
public class Tester
{
public static void main ( String[] args )
{
helloFrame frm = new helloFrame();
frm.setSize( 150, 100 );
frm.setVisible( true );
} } fill in the blanks with correct
option.

A. import, drawString, paint

B. extends, paint, drawString

C. extends, draw, paint

D. include, drawString, paint

Answer optionb

Marks: 2

810 Panel is a concrete subclass of _______________.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. Window

B. Container.

C. Panel

D. Frame

Answer optionb

Marks: 1

811 From Following list which is not a swing class?

A. ImageIcon

B. JIcon

C. JButton

D. JPane

Answer optionb

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
import java.awt.*;
import java.applet.*;

public class buttonDemo extends Applet


/* <applet code="buttonDemo" width=300 height=300></applet>*/
{
public void init()

Button a1=new Button("ok");


812 Button a2=new Button("Cancel");
Button a3=new Button("Submit");
a2.setLabel("Welcome");
a3.setEnabled(false);
add(a1);
add(a2);
add(a3);

}
}
What will be the output ?

A.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B.

C.

D.

Answer optiond

Marks: 2

A ___________________ array of strings is created


813 JTable.

A. two-dimensional

B. one-dimensional

C. multi dimensional

D. none of these

Answer optionb

Marks: 1

814 JProgressBar() of swings creates______________

A. Vertical Progress Bar Only

B. Horizontal Progress Bar with Progress String.

C. Horizontal and Vertical Progress Bar without progress string.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
for
D. Horizontal Progress Bar without progress string.

specifying the

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiond

Marks: 1

Which is correct statement from given option for using a table


815 an

A. Create aJScrollPaneobject

B. Add the table to the scroll pane.

C. Create aJTableobject

D. All of the above

Answer optiond

Marks: 1

816 Java Swings is used to create ______________________ applicat

A. mobile enabled

B. web based

C. window based

D. package based

Answer optionc

Marks: 1

817 To add tab to the panel which method is used?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
ions.
{

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. addTab()

B. addJPanel()

C. addPanel()

D. addJTab()

Answer optiona

Marks: 1

818 How to change the current layout managers for a container?

A. ChangeLayout() method

B. isLayout() method

C. setLayout() method

D. getLayout() method

Answer optionc

Marks: 1

819 Select the correct code for given output?

import java.awt.*; import java.applet.*; public class buttonDemo1


ext
<applet code="buttonDemo1" width=300 height=300></applet>*/
A. init() {
Button a2=new Button("Cancel");

add(a1); add(a2); add(a3);

import java.awt.*; import java.applet.*; public class buttonDemo1


B.
ext

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Button a1=new Button("ok");
Button a3=new Button(

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
<applet code="buttonDemo1" width=300 height=300></applet>*/
init() { Button
a2=new Button("Cancel");
a2.setEnabled(false); add(a1); add(
add(a3); } }
import java.awt.*; import java.applet.*; public class buttonDe
ext
<applet code="buttonDemo1" width=300 height=300></applet>*/
C. init() { Button
a2=new Button("Cancel");
a2.setEnabled(true); add(a1); add(
add(a3); } }
import java.awt.*; import java.applet.*; public class butt
<applet code="buttonDemo1" width=300 height=300></applet>*/
init() { Button
D.
a2=new Button("Cancel");
a1.setEnabled(false); add(a1); add(
add(a3); } }

Answer optionb

Marks: 2

820 JComboBox control initially displays _____ entry

A. One

B. Two

C. Empty

D. NULL

Answer optiona

Marks: 1

Button a1=new Button("ok");

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Button a3=new Button(
a2);

{
Button a1=new Button("ok");
Button a3=new Button(
a2);

onDemo1 ext
{
Button a1=new Button("ok");
Button a3=new Button(
a2);

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
What does the File dialog constructor Dialog(Frame parent,String
821 titl

A. Creates a file dialog window with the specified title ONLY.

Creates a file dialog window with the specified title for loading or
B.
s

Creates a file dialog window with the specified title for loading
C.
ONLY

Creates a file dialog window with the specified title for saving a
D.
fil

Answer optionb

Marks: 1

822 The title of the dialog box is stored in ____________

A. dialog variable

B. Window variable

C. Title variable

D. Frame Variable

Answer optionc

Marks: 1

823 Dialog box is closed then which method is called?

A. Exit()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. dialog_close()

C. close()

D. dispose()

Answer optiond

Marks: 1

824 AbstractButton is the template class for________________

A. Push Buttons

B. Radio Buttons

C. Check boxes

D. All of the above.

Answer optiond

Marks: 1

What is use of 5th parameter in given constructor


825 Scrollbar(int,int,in

A. orientation

B. visible

C. maximum

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. minimum

Answer optionc

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

In given constructor what 3rd parameter indicates Scrollbar


826 s= Scrollbar(0,10,20,0,1000)

A. orientation

B. visible

C. thumbsize

D. none of these

Answer optionc

Marks: 1

827 What is purpose of default constructor of Scrollbar( ) class?


B. GUI Components, Graphics, Code
A. To create vertical Scrollbar
C. GUI Components, Event Listeners, Application Code
B. To create horizontal Scrollbar
D. Frames, Code, Events
C. Both
Answer optionc
D. all of above
Marks: 1
Answer optiona

Marks: 1

828 The three software parts of a GUI program are:

A. Windows, Buttons, Mice

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Consider the following code segment. Insert correct code at blank
spa

checkbox._____________ (new ItemListener()


{
public void _______________(ItemEvent ie)
{
829 if (checkbox.getState() == true)
{
JOptionPane.showMessageDialog(null, "checkbox is che
}
else { JOptionPane.showMessageDialog(null, "checkbox is
unch
}
});

A. itemStateChanged, addItem

B. ItemListener, itemChanged

C. StateChanged, addItem

D. addItemListener, itemStateChanged

Answer optiond

Marks: 2

830 Which of the following sets the frame to 300 pixels wide by 20

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. frm.setSize( 300, 200 );

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. frm.setSize( 200, 300 );

C. frm.paint( 300, 200 );

D. frm.setVisible( 300, 200 );

Answer optiona

Marks: 1

831 What is a container object in GUI programming?

A. A container is another name for an array or vector.

B. A container is any class that is made up of other classes.

A container is a primitive variable that contains the actual


C.
d

A container is an object like a Frame that has other GUI components


D.
pl

Answer optiond

Marks: 1

Which of the following is the Java toolkit used to write GUI


832 programs

A. GUI toolkit

B. Abstract Windowing Toolkit

C. Graphics Event Toolkit

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. Java Enhancement Toolkit

Answer optionb

Marks: 1

1. import java.awt.*;
2. import java.awt.event.*;
3. public class ItemEx1 implements ItemListener {
4. Frame jf;
5. Checkbox chk1, chk2;
6. Label label1;
7. ItemEx1() {
8. jf= new Frame("Checkbox");
9. chk1 = new Checkbox("Happy");
10. chk2 = new Checkbox("Sad");
11. label1 = new Label();
12. jf.add(chk1);
13. jf.add(chk2);
14. chk1.addItemListener(this);
15. chk2.addItemListener(this);
16. jf.setLayout(new FlowLayout());
17. jf.setSize(220,150);
18. jf.setVisible(true);
833 19. }
20. // Line no 20
21. Checkbox ch =(Checkbox) ie.getItemSelectable(); 22.
if(ch.getState()==true) {
23. label1.setText(ch.getLabel()+ " is
check
24. jf.add(label1);
25. jf.setVisible(true);
26 }
27 else {
28 label1.setText(ch.getLabel()+ " is
uncheck
29 jf.add(label1);
30 jf.setVisible(true);
31 }
32 }
33 public static void main(String... ar) {
34 new ItemEx1();
35 }

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
36 } new
Identify correct code at line no 20

cke

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
d")

; 0

hig

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
h?

ata

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
ed"

);

A. public void itemModified(ItemEvent ie) {

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. public void itemStateSelectable(ItemEvent ie) {

C. public void itemChange(ItemEvent ie) {

D. public void itemStateChanged(ItemEvent ie) {

Answer optiond

Marks: 2

834 When is the paint() method of a frame object called?

A. The user calls it to display the frame.

B. The main() method calls it once when the program starts.

C. The Java system calls it every time it decides to display the

D. The Java system calls it once when the program starts.

Answer optionc

Marks: 1

1. public void itemStateChanged(ItemEvent


ie) {
2. Checkbox ch
=(Checkbox)ie.setItemSelectable();
3. if(ch.getState()==true) {
835 4. label1.setText(ch.getLabel()+ " is
checked");
5. jf.add(label1);
6. jf.setVisible(true);
7 .}
Which statement is true ?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
ed");
A. There are syntax errors on line no. 1 frame.

B. There are syntax errors on line no. 2

C. There are syntax errors on line no. 4

D. There are syntax errors on line no. 6

Answer optionb

Marks: 2

836 What is a Graphics object?

The Graphics object represents the part of the Frame that you can
A.
draw

B. The Graphics object represents the whole Frame.

C. The Graphics object represents the entire monitor.

D. The Graphics object represents the graphics board.

Answer optiona

Marks: 1

Which of the following determines how the components of a container


837 ar

A. Display Manager

B. Component Manager

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. Stage Manager

D. Layout Manager

Answer optiond

Marks: 1

838 Which method of a Frame is used to set the layout manager?

A. setLayout()

B. add()

C. actionPerformed()

D. setVisible()

Answer optiona

Marks: 1

1. public void itemStateChanged(ItemEvent ie ) {


2. JCheckBox cb = (JCheckBox) ie.getItem( );
3. int state ie.getStateChange( );
4. // Line no 4
839
5. System.out.println(cb.getText( ) + "selected");
6. else
7. System.out.println(cb.getText( ) + "cleared"); 8. }
Identify correct code at line no 4

A. if (state == ItemEvent.Change)

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. if (state == ItemEvent.Modified)

C. if (state == ItemEvent.SELECTED)

D. if (state == ItemEvent.getText)

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionc

Marks: 1

840 Which are the not types of key events-

A. KEY_PRESSED

B. KEY_DOUBLE

C. KEY_RELEASED

D. KEY_TYPED

Answer optionb

Marks: 1

Interface MouseMotionListener belongs to _____________


841 package

A. java.listener

B. java.util.event

C. java.awt.event

D. java.motion

Answer optionc

Marks: 1

842 _____________is the super class of all event classes.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
.

A. Event

B. Object

C. EventObject

D. EventClass

Answer optionc

Marks: 1

Which of this interface is defines a method adjustmentValueChanged(


843 )

A. ComponentListener

B. ContainerListener

C. ItemStateListener

D. AdjustmentListener

Answer optiond

Marks: 1

844 Which of these interfaces define a method keyPressed()?

A. MouseMotion Listener

B. MouseListener

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. KeyBoardListener

D. KeyListener

Answer optiond

Marks: 1

From following options which of these is method of


845 MouseMotionListener

A. mouseMoved()

B. MouseMotionListener()

C. MouseClick()

D. MousePressed()

Answer optiona

Marks: 1

Fill in the blank:


846 MouseMotionListener interface defines___________methods

A. one

B. two

C. three

D. four

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionb

Marks: 1

847 A source is an ________ that generates an event .

A. class

B. interface

C. object

D. variable

Answer optionc

Marks: 1

Assuming we have a class which implements the ActionListener interface


848 should be used to register this with a Button? ;

A. addListener(*)

B. addActionListener(*);

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. addButtonListener(*);

D. setListener(*);

Answer optionb

Marks: 1

windowGainedFocus() and windowLostFocus() methods are belongs to


849 _____

A. WindowInterface

B. WindowFocused Interface

C. WindowFocusListener

D. WindowAction Interface

Answer optionc

Marks: 1

Fill in the blank:


850 MouseListener interface define…........methods

A. 2

B. 5

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. 7

D. 4

Answer optionb

Marks: 1

851 KEY_TYPED Event generated when....

A. key pressed or released

B. only when character is generated

C. only key pressed

D. only key released

Answer optionb

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

852 Which of these methods are used to register a Window listener?

A. windowListener()

B. addListener()

C. addWindowListener()

D. eventWindowListener()

Answer optionc

Marks: 1

853 Which of these methods are used to register a mouse motion lis

A. addMouse()

B. addMouseListener()

C. addMouseMotionListner()

D. eventMouseMotionListener()

Answer optionc

Marks: 1

KeyEvent Constructor-
854 KeyEvent(Component src, int type, long when, int modifiers, i
Here when means-

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
tener?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. a reference to the component that generated the event.

B. The type of event occured.

C. virtual key codes

D. The system time at which the key was pressed.

Answer optiond

Marks: 1

855 What is a listener in context to event handling?

A listener is a variable that is notified when an event


A.
occurs

B. A listener is a object that is notified when an event occurs.

C. A listener is a method that is notified when an event occurs.

D. None of the mentioned.

Answer optionb

Marks: 1

856 The KeyEvent class methods-

A. getKeyCode ( )

B. geyKeyTyped( )

C. getKeyChar ( )

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. both a and c

Answer optiond

Marks: 1

857 Which of these are methods of TextListener Interface?

A. textChange()

B. textModified()

C. textValueChanged()

D. textValueModified()

Answer optionc

Marks: 1

If no valid character is available then geyKeyChar( )


858 returns

A. VK_UNDEFINED

B. CHAR_UNDEFINED

C. VK_CONTROL

D. CHAR_ERROR

Answer optionb

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
-

859 Which of these are methods of KeyListener Interface?

A. keyPressed()

B. keyReleased()

C. keyTyped()

D. All of this

Answer optiond

Marks: 1

860 KeyEvent is a subclass of-

A. InputEvent

B. TextEvent

C. ItemEvent

D. MouseEvent

Answer optiona

Marks: 1

861 Which source generates adjustment events?

A. Button

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. List

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. Scroll bar

D. Text components

s of--
Answer optionc --

Marks: 1

DatagramPacket(byte data[ ], int size)


862 DatagramPacket(byte data[ ], int offset, int size) are
example

A. package

B. class

C. Interface

D. constructors

Answer optiond

Marks: 1

863 ___________ method is used to register a Component listener.

A. addMouse()

B. addComponentListener( )

C. addMouseMotionListener()

D. eventMouseMotionListener()

Answer optionb

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

MouseEvent Constructor-
864 MouseEvent(Component src, in type, long when, int modifiers, int x,
i boolean triggersPopup) Here x and y means- .....

A. co-ordinates of the mouse passed

B. The click count

C. Reference to the component

D. The system time at which the mouse event occured.

Answer optiona

Marks: 1

865 getPoint( ) , method to obtain ..............................

A. x - co-ordinates of the mouse.

B. y- co-ordinates of the mouse.

C. both x and y co-ordinates of the mouse.

D. The total number of click count.

Answer optionc

Marks: 1

The following statement return- Point


866 getPoint( )

A. to obtain the coordinates of the mouse.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. returns Point int that contains the Y

C. returns Point object that contains the X

D. to obtain the coordinates of the key

Answer optiona

Marks: 1

867 The, int getClickCount( ) method returns-

A. number of mouse clicks for widgets.

B. number of mouse clicks for graphical user interface.

C. number of mouse clicks for this event.

D. number of mouse clicks from application started.

Answer optionc

Marks: 1

868 The isPopupTrigger( ) methods returns-

A. int

B. void

C. object

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. boolean

Answer optiond

Marks: 1

869 The, getButton( ) method returns-

A. returns int value that represents the button that caused the e

returns boolean value that represents the button that caused th


B.
event

C. returns void and generates events.

D. returns object and generates events.

Answer optiona

Marks: 1

870 The __________interface handles item event.

A. ActionListener

B. ItemListener

C. ItemHandler

D. WindowListener

Answer optionb

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
vent.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
871 Which method not use to obtain the coordinates of the mouse-

A. Point getLocationOnScreen( )

B. int getKeyCode( )

C. int getXOnScreen( )

D. int getYOnScreen( )

Answer optionb

Marks: 1

Which of these method are used to register a keyboard event


872 Li

A. KeyListener()

B. addKeyListener()

C. RegisterKeyListener()

D. addKeyBoard()

Answer optionb

Marks: 1

873 The TextEvent generated by-

A. text fields and text areas when characters are entered.

B. text fields and text areas when mouse entered.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
stener

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. text fields and text areas when mouse clicked

D. text fields and text areas when keyboard press.

Answer optiona

Marks: 1

Which is the correct general form of method of the ActionListener


874 int

A. void ActionPerformed(ActionEvent ae)

B. void ActionPerformed(Actionevent ae)

C. void actionPerformed(ActionEvent ae)

D. void ActionPerformed(actionEvent ae)

Answer optionc

Marks: 1

The TextEvent Constructor-


875 TextEvent(Object src, int type)
Here type means-

A. The type of text

B. The type of object passed.

C. The type of event.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. The type of source generated events.

Answer optionc

Marks: 1

876 keyTyped() is method of __________ interface.

A. KeyBoard Interface

B. Mouse Interface

C. WindowListener Interface

D. KeyListener Interface

Answer optiond

Marks: 1

877 keyPressed() is method of __________ interface.

A. KeyBoard Interface

B. Mouse Interface

C. WindowListener Interface

D. KeyListener Interface

Answer optiond

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

878 keyReleased() is method of __________ interface.

A. KeyBoard Interface

B. Mouse Interface

C. WindowListener Interface

D. KeyListener Interface

Answer optiond

Marks: 1

879 windowDeiconified() is method of ________interface

A. WindowListener Interface

B. Window Interface

C. Window Conified Interface

D. Action Interface

Answer optiona

Marks: 1

880 windowIconified() is method of ________interface

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. WindowListener Interface

B. Window Interface

C. WindowConified Interface

D. Action Interface

Answer optiona

Marks: 1

881 WindowActivated() is method of ________interface.

A. WindowListener Interface

B. Window Interface

C. Window Activated Interface

D. Action Interface

Answer optiona

Marks: 1

882 windowClosed() is method of ________interface.

A. WindowListener Interface

B. Window Interface

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. WindowClosed Interface

D. Action Interface

Answer optiona

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
883 windowClosing() is method of ________interface

A. WindowListener Interface

B. Window Interface

C. WindowConified
TextField field1;Interface
Button button1, button2, button3;
Dialog d1, d2, d3;
D. Action Interface
DialogEx()
{
Answer frame
optiona = new Frame("Frame");
button1 = new Button("Open Modal Dialog");
label1 = new Label("Click on the button to open a Modal
Marks: Dialog
1 frame.add(label1); frame.add(button1);
button1.addActionListener(this); frame.pack();
frame.setLayout(new FlowLayout());
When a ------------- Dialog
frame.setSize(330,250); box is active, it blocks user input to
frame.setVisible(true);
884 all the program.
}
public void actionPerformed(ActionEvent ae)
{
A. modal
if(ae.getActionCommand().equals("Open Modal Dialog"))
{
B. ---------------------------------------
modeless
Label label= new Label("You must close this dialog window to use
Frame window",Label.CENTER); d1.add(label);
C. d1.addWindowListener(this);
file d1.pack();
d1.setLocationRelativeTo(frame); d1.setLocation(new
Point(100,100)); d1.setSize(400,200);
D. ---------------------------------------
none of the above
} }
public void windowClosing(WindowEvent we)
Answer {
optiona
d1.setVisible(false);
}
Marks: 1public static void main(String...ar)
{
new DialogEx();
Find
} the missing Statements in the following program to get the
given import java.awt.*; import java.awt.event.*;
}
public class DialogEx extends WindowAdapter implements ActionL
885 {
Frame frame;
Label label1;

A. d1= new Dialog(frame,"Modal Dialog",true);

B. d1.setVisible(true);

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
istener
");

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. d1= new Dialog(frame,"Modal Dialog",true); d1.setVisible(true)

D. d1= new Dialog(frame,"Modal Dialog",true);d1.setVisible(false)

Answer optionc

Marks: 2

Following method returns true if a cookie contains the session


886 Oth false.

A. boolean RequestedSessionIdFromCookie( )

B. boolean isRequestedSessionId( )

C. boolean isRequestedFromCookie( )

D. boolean isRequestedSessionIdFromCookie( )

Answer optiond

Marks: 1

Which of the following method returns true if the URL contains


887 se Otherwise, returns false.

A. boolean isRequestedSessionIdFromURL( )

B. int requestedSessionIdFromURL( )

C. boolean isRequestedSessionIdFromcookie( )

D. int isRequestedSessionIdFromURL( )

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
;

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 1

_________ method returns true if the requested session ID is valid


888 in context.

A. boolean RequestedSessionIdValid( )

B. boolean isRequestedSessionId( )

C. boolean isRequestedValid( )

D. boolean isRequestedSessionIdValid( )

Answer optiond

Marks: 1

Which of the following method returns the session for this request.
889 I not exist, one is created and then returned.

A. httpsession getsession( )

B. HttpServlet getSession( )

C. HttpSession getSession( )

D. Session getsession( )

Answer optionc

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

890 Text Fields is also know as ___________

A. Single line control

B. Active Control

C. Passive Control

D. Edit Control

Answer optiond

Marks: 1

All the methods of HttpSession interface throw an _____________ if


891 the already been invalidated.

A. IllegalState

B. IllegalException

C. LegalStateException

D. IllegalStateException

Answer optiond

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Following method returns an enumeration of the attribute names
892 associa session..

A. Enumeration getAttributeNames( )

B. String getAttributeNames( )

C. void getAttributeNames( )

D. none of the above

Answer optiona

Marks: 1

Echoing of characters can be disabled as they are typed by


893 using______

A. echoChar()

B. isEchochar()

C. setEchochar()

D. echoCharIsSet()

Answer optionc

Marks: 1

Following method returns the time (in milliseconds since midnight,


894 Jan when this session was created.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. int getcreationtime( )

B. long CreationTime( )

C. long getCreationTime( )

D. long getCreation( )

Answer optionc

Marks: 1

895 JChoice control of swings is a kind of_____________

A. Menu

B. Item

C. Radio

D. List

Answer optiona

Marks: 1

Which of the following method invalidates the session and removes


896 it

A. String invalidate( )

B. void invalidate( )

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. int invalidate( )

D. void setinvalidate( )

Answer optionb

Marks: 1

897 JLabels are ____________ Control.

A. Active

B. User

C. Passive

D. Interactive

Answer optionc

Marks: 1

Which of the following classes represents event notifications for


898 cha within a web application

A. Cookie

B. HttpServlet

C. HttpSessionEvent

D. HttpSessionBindingEvent

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionc

Marks: 1

899 Which Property is wrong for JLabel

A. Label.LEFT

B. Label.CENTER

C. Label.RIGHT

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. Label.BOTTOM

Answer optiond

Marks: 1

900 URLEncoder , URLConnection , URLDecoder are examples of

A. package

B. class

C. interface

D. method

Answer optionb

Marks: 1

ContentHandlerFactory , CookiePolicy,CookieStore are


901 examples

A. package

B. class

C. interface

D. method

Answer optionc

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
of

Which of the following are the different methods of ResultSet


interfac
1. public boolean next()
902 2. public boolean previous()
3. public boolean back()
4. public boolean last()

A. 1,2,3

B. 1,2,4

C. 2,3,4

D. All of the above.

Answer optionb

Marks: 1

Which of the following are the different methods of Statement


interfac
1. public int[] executeBatch()
903 2. public boolean execute(String sql)
3. public int executeUpdate(String sql)
4. public int insert(String sql)

A. 1,2,3

B. 2,3,4

C. 1,3,4

D. All of the above.

Answer optiona

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Consider the following program, Select the statement that shoul
ad to get correct output.
import java.sql.*;
public class MyData
{
public static void main(String args[])throws Exception
904 {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection c=DriverManager.getConnection("jdbc:odbc:MyDSN","","
Pre s=c.prepareStatement( "update student set Na s.setString(2,
s.executeUpdate();
s.close();
c.close(); } }

A. a. use s.executeQuery() method

B. Use ; in main method

C. Use s.setString(2,1) method

D. use ? in PreparedStatement

Answer optiond

Marks: 2

6. Which is the incorrect statement in the following Code?


java.sql.*; public class Sample1 { public static void m
Exception { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Con
=DriverManager.getConnection("jdbc:odbc:DSN2","",""); PreparedS
905 s=c.createStatement( ); ResultSet rs=s.executeQuery("select* fr
System.out.println("Name"+" "+"Roll no"+"
System.out.println(rs.getString(1)+" "+rs.getInt(2)+"
s.close(); c.close(); } }

A. ResultSet rs=s.executeQuery();

B. Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

me=* where Roll_no=*");


s.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
nection

"+"Avg"); while(rs.next(
"+rs.getDo

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. PreparedStatement s=c.createStatement();

D. None of the above

Answer optionc

Marks: 2

Consider the following program. What should be the correction d


correct output? import java.sql.*; public class DataBase{ publ
static void main(Str
906 Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection conn
DriverManager.getConnection("jdbc:odbc:abc", "", ""); String s1
values(1,'abc'); s.executeUpdate(s1); s.close(); conn.close();}
e){System.out.println(e);} } }

A. Insert try and catch(FileNotFoundException fe)

B. Use s.executeQuery(s1);

C. Insert try and catch(Exception e)

D. Insert catch(Exception e)

Answer optionc

Marks: 2

Fill in the blanks respectively.

import java.io.*; import


javax.servlet.*; import
javax.servlet.http.*;
907 public class GetCookiesServlet extends HttpServlet
{
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOExcep

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
=

tion

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
{
Cookie[] cookies = request._____________;

response.setContentType("text/html"); PrintWriter
pw = response.getWriter(); pw.println("<B>");
for(int i = 0; i < cookies.length; i++) {
String name = cookies[i].______________; String
value = cookies[i].____________ ;
pw.println("name = " + name + "; value = " + value);

}
pw.close();
}
}

A. getname(); getvalue(); getcookies();

B. doHead(); doOptions(); doTrace()

C. service(); doHead(); doTrace();

D. getCookies(); getName(); getValue();

Answer optiond

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Fill in the blanks at the line number 4 and 8 respectively.
1. import java.io.*;
2. import javax.servlet.*;
3. import javax.servlet.http.*;
4. public class GetCookiesServlet extends __________ {
5. public void doGet(HttpServletRequest request,
HttpServletRespons
908 ServletException, IOException {
6. Cookie[] cookies = request.getCookies();
7. response.setContentType(""text/html"");
8. PrintWriter pw =__________.getWriter();
9. pw.println(""<B>"");
10. for(int i = 0; i < cookies.length; i++) {
11. String name = cookies[i].getName();

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
12. String value = cookies[i].getValue();
13. pw.println(""name = "" + name + ""; value = "" + value)
A. 14. }
image will be inserted into the database
15. pw.close();
16. }
B. Image
17. will
} be retrieved from the database.

C. ; missing
A. GenericServlet , request

D. } missing
B. HttpServlet , response

Answer optionb
C. HttpServlet , request

Marks: 2
D. GenericServlet , response

setAttribute( ), getAttribute( ), getAttributeNames( ), and removeAttr


910 ____________ interface.
Answer optionb

A.
Marks: HttpSession
2

B. HttpServlet
What will be the output of the following
program. import java.sql.*; import
C. java.io.*;
HttpServletResponse
public class RetrieveImage {
public static void main(String[] args) { try{
D. Class.forName("oracle.jdbc.driver.OracleDriver");
HttpServletRequest
Connection con=DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:xe","system","oracle");
Answer optiona
PreparedStatement ps=con.prepareStatement("select * from
imgtable");
909
ResultSet rs=ps.executeQuery();
Marks: 1if(rs.next()){ Blob
b=rs.getBlob(2); data
byte barr[]=b.getBytes(1,(int)b.length());
FileOutputStream fout=new FileOutputStream("d:\picture.jpg");
fout.write(barr); fout.close(); }//end of if
con.close();
}catch (Exception e) {e.printStackTrace(); }
}
}

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
; /
import java.awt.*; import
java.applet.*;

public class checkboxDemo extends Applet


911 /* <applet code="checkboxDemo" width=300 height=300></applet>*
{
public void init()

Checkbox cb1,cb2;
CheckboxGroup cbg=new CheckboxGroup();
cb1=new Checkbox("Java",true,cbg);
cb2=new Checkbox("C++",false,cbg);
add(cb1);add(cb2);

}
}
What is expected output of above code ?

A. Creates two checkboxes named "Java" and "C++"

Creates two radio buttons with "Java" and "C++" with "Java" button
B.
as

Creates two radio buttons with "Java" and "C++" with "C++" button as
C.
s

D. None of these

Answer optionb

Marks: 2

void setPath(String p)
void setSecure(boolean secure)
912 void setValue(String v)
void setVersion(int v)
Identify the class where above methods belong to.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. HttpSession

B. HttpServlet

C. Cookie

D. GenericServlet

Answer optionc

Marks: 1

import java.awt.*;
import javax.swing.*;

public class LayoutDemo{


JFrame f;
LayoutDemo(){
f=new JFrame();

JButton b1=new JButton("1");


JButton b2=new JButton("2");
JButton b3=new JButton("3");
JButton b4=new JButton("4");
JButton b5=new JButton("5");
913
f.add(b1);f.add(b2);f.add(b3);f.add(b4);f.add(b5);

f.setLayout(new FlowLayout(FlowLayout.RIGHT));
//setting flow layout of right alignment

f.setSize(300,300);
f.setVisible(true);
}
public static void main(String[] args) {
new LayoutDemo();
}
}
Find the output.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A.

B.

C.

D.

Answer optionc

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 2

Select correct option to get the proper


output: import java.awt.*; import
java.applet.*;
public class LayoutDemo extends Applet
con=DriverManager.getConnection("odbc:oracle:thin:@localhost:1512:xe",
{
static final int n = 4;
Connection
public void init()
B.
{
con=DriverManager.getConnection("jdbc:thin:ora
setLayout(new GridLayout(n, n));
setFont(new Font("SansSerif", Font.BOLD, 24));
Connection
for(int i = 0; i < n; i++)
C.
914 con=DriverManager.getConnection("odbc:oracle:thin:@localhost:1521:xe",
{
for(int j = 0; j <n; j++)
{
Connection
D. int k = i * n + j;
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe",
if(k > 0)
add(new Button("" + k));
Answer optiond }
}
}
Marks: 1}
/*<applet code="LayoutDemo.class" width=100 height=100></apple

916 Which layout is used to align fixed width components at the ed


A.
A. java.awt.BorderLayout
B.
B. java.awt.FlowLayout

C.
C. java.awt.GridLayout

D.
D. java.awt.CardLayout

Answer optiona

Marks:
Marks: 12

917 Which of the following class is used


statement to apply
is used the grid layout?
for connectivity with
915 Oracle

A. java.awt.BorderLayout
A. Connection

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. java.awt.FlowLayout

t>*/
cle:@lo
calhost
:1512:x
e",

ges?

C. java.awt.GridLayout

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. java.awt.CardLayout

Answer optionc

Marks: 1

918 -------------------- class is used to apply flow layout.

A. java.io.FlowLayout

B. java.awt.FlowLayout

C. javax.awt.GridLayout

D. javax.awt.CardLayout

Answer optionb

Marks: 1

Which of the following methods are used to navigate through the


919 differ layout?

A. public void next(Container parent)

B. public void previous(Container parent)

C. public void first(Container parent)

D. All of the above

Answer optiond

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

920 Which of the following method is used to show the specific ca

A. public void show(Container parent, String name)

B. public void show(Container parent)

C. public void first(Container parent, String name)

D. public void next(Container parent, String name)

Answer optiona

Marks: 1

We can control the alignment of components in a flow layout


921 arrangemen ----- FlowLayout Fields.

A. FlowLayout.RIGHT

B. FlowLayout.LEFT

C. FlowLayout.CENTER

D. All of the above

Answer optiond

Marks: 1

922 Identify the Layout and alignment of components in the given o


B. FlowLayout and RIGHT alignment

A. FlowLayout and LEFT alignment


C. GridLayout and LEFT alignment

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. GridLayout and RIGHT alignment

Answer optionb

Marks: 1

Consider the following code. Fill the proper method in the blank space
total records updated. import java.sql.Statement; public class
MyExecuteMethod {
public static void main(String a[] ){
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.
getConnection
getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle")
Statement stmt = con.createStatement();
//The query can be update query or can be select q
String query = "select * from emp"; boolean status =
stmt.execute(query); if(status){
923 ResultSet rs = stmt.getResultSet();
while(rs.next()){
System.out.println(rs.getString(1));
}
rs.close();
} else {
int count = stmt.-------------------------;
System.out.println("Total records updated: "+c
}
}
catch (SQLException e) { e.printStackTrace();}
}
}

A. getUpdateCount();

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
rd?

utput.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
uery

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
ount);

B. getCount();

C. readCount();

D. readUpdateCount();

Answer optiona

Marks: 2

924 Identify the layout in the given output.

A. BorderLayout

B. GridLayout

C. GridBagLayout

D. CardLayout

Answer optionb

Marks: 1

925 insert() is the method of _____ class.

A. TextArea

B. TextField

C. Button

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. None of above

Answer optiona

Marks: 1

A programmer uses a Java class known as ___________ to connect to a


926 d

A. JDBC driver

B. Package

C. JDBC Interface

D. none of the Above

Answer optiona

Marks: 1

927 Identify the layout in the given output.

A. BorderLayout

B. GridLayout

C. GridBagLayout

D. CardLayout

Answer optionc

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

928 ____________ is a call-level interface.

A. Oracle's Oracle Call Interface (OCI)

B. Microsoft's Open Database Connectivity (ODBC)

C. JDBC

D. All of the Above

Answer optiond

Marks: 1

929 Identify the layout in given output.

A. BorderLayout

B. GridLayout

C. FlowLayout

D. CardLayout

Answer optionc

Marks: 1

Because of ________ coupling a 2 tiered application will run


930 ________.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. loose, faster

B. tight, faster

C. loose, slower

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. tight, slower

Answer optionb

Marks: 1

931 Which of the following code is used to retrieve auto generated primary

public class MyAutoGeneratedKeys {


{ Class.forName("oracle.jdbc.driver.OracleDriver"); con
= DriverManager. getConnection
getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","
String query = "insert into emps (name, dept, salary) values (?
A. PreparedStatement pstmt = con.prepareStatement(query,Statement
pstmt.setString(1, "John"); pstmt.setStrin
pstmt.setInt(3, 10000); pstmt.executeUpdate
pstmt.putGeneratedKeys(); if(rs != null && rs.next()){
System.out.println("Generated Emp Id: "+rs.getInt(1));
(SQLException e) { e.printStackTrace();}}}

public class MyAutoGeneratedKeys { public static void main(S


Class.forName("oracle.jdbc.driver.OracleDriver"); con = DriverM
getConnection
getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle")
query = "insert into emps (name, dept, salary) values (
B. PreparedStatement pstmt = con.prepareStatement(query,Statemen
pstmt.setString(1, "John"); pstmt.setString(2, "Acc
pstmt.setInt(3, 10000); pstmt.executeUp
pstmt.getAutoGeneratedKeys(); if(rs != null && rs.n
System.out.println("Generated Emp Id: "+rs.getInt(1)); }
(SQLException e) { e.printStackTrace();}}}

public class MyAutoGeneratedKeys { public s


{ Class.forName("oracle.jdbc.driver.OracleDriver"); con
= DriverManager. getConnection
getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle")
query = "insert into emps (name, dept, salary) values (?
C. PreparedStatement pstmt = con.prepareStatement(query,Statement
pstmt.setString(1, "John"); pstmt.setString(2, "Ac pstmt.s
10000); pstmt.executeUpdate(); pstmt.get
if(rs != null && rs.next()){ System.out.println("Generated
"+rs.getInt(1)); }

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
public static void main(String

oracle")

g(2, "Acc Dept")

tatic void main(String

c Dept")

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
(SQLException e) { e.printStackTrace();}}}

public class MyAutoGeneratedKeys { public static void main(S


Class.forName("oracle.jdbc.driver.OracleDriver"); con = DriverM
getConnection
getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle")
query = "insert into emps (name, dept, salary) values (?
D. PreparedStatement pstmt = con.prepareStatement(q
pstmt.setString(1, "John"); pstmt.setString(2, "Acc
pstmt.setInt(3, 10000); pstmt.executeUp
pstmt.getGeneratedKeys(); if(rs != null && rs.n
System.out.println("Generated Emp Id: "+rs.getInt(1)); }
(SQLException e) { e.printStackTrace();}}}

Answer optiond

Marks: 2

932 Which of the Following is NOT true for Two Tier Architecture

A. The direct communication takes place between client and server

B. There is no intermediate between client and server.

C. A 2 tiered application will run faster.

D. In two tier architecture the server can respond multiple request same

Answer optiond

Marks: 1

933 Which of the following methods are used to set the Hgap and Vgap in fl

A. setHgap (int)

uery,Statement.RETUR
N

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. int setVgap (int), int setHgap (int)

C. void setHgap (int),void setVgap (int)

D. None of the above

Answer optionc

Marks: 1

934 A driver is used to ___________ to a particular database.

A. issue sql queries

B. open a connection

C. load database

D. load resultset

Answer optionb

Marks: 1

----------------method is used to set the alignment in flow


935 la

A. setAlignment (int)

B. getAlignment ()

C. setAlignment ()

D. getAlignment (int)

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
yout.

Answer optiona

Marks: 1

The core API in java.sql consists of ___ interfaces, ___ classes,


936 and

A. 16, 8

B. 32,8

C. 8, 4

D. 32,4

Answer optiona

Marks: 1

By using which interface one can store images in the database in


937 java

A. ResultSet interface

B. PreparedStatement interface

C. Connection interface

D. None of the above

Answer optionb

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
938 The constructors in BorderLayout class are------------

A. BorderLayout()

B. BorderLayout(int hgap, int vgap)

C. Both a and b

D. None of the above

Answer optionc

Marks: 1

The core API in java.sql consists of ___ interfaces, 8 classes, and


939 __

A. 8, 4

B. 16, 8

C. 4, 4

D. 16, 4

Answer optiond

Marks: 1

940 The constructors in GridLayout class are-----------

A. GridLayout()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. GridLayout(int rows, int cols)

C. GridLayout(int rows, int cols, int hgap, int vgap)

D. All of the above

Answer optiond

Marks: 1

941 The JDBC interface is contained in the......

A. java.sql Package

B. javax.sql Package

C. Both of the Above

D. None of the Above

Answer optionc

Marks: 1

Which method is used to find out the number of rows in the grid
942 layou

A. int getRows()

B. void getRows()

C. void getRows(int)

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. None of the above

Answer optiona

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
The----------method is used to know number of columns in the gr
943 layo

A. int getColumns()

B. void getColumns()

C. void getColumns(int)

D. None of the above

Answer optiona

Marks: 1

TextArea a2=new TextArea("Advanced is multitasking",5,30);


944 Which method is used to get output as "Advanced Java is
multitasking."

A. insert("Java ",9)

B. append("Java",9)

C. getRows("Java",10)

D. None of these

Answer optiona

Marks: 1

The ------------------ and ----------------- and


945 columns in the grid layout respectively.

A. void setRows(int rows) , void setColumns(int cols)

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
methods are used to set
t

B. void setColumns(int cols)

C. void setColumns(int cols), void setRows(int rows)

D. void setRows(int rows)

Answer optiona

Marks: 1

946 Identify the layout in given output

A. BorderLayout

B. GridLayout

C. FlowLayout

D. CardLayout

Answer optionc

Marks: 1

947 Identify the layout in given output

A. BorderLayout

B. GridLayout

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. FlowLayout

D. CardLayout

Answer optiona

Marks: 1

948 Identity the Driver in the Figure

A. Type 1 Driver

B. Type 2 Driver

C. Type 3 Driver

D. Type 4 Driver

Answer optiona

Marks: 1

949 To execute a statement ,we invoke method_________

A. executeUpdate()

B. executeRel()

C. executeStmt()

D. exectuteCon()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 1

The -------------------- constructor is used to create FileDialog


950 with

A. FileDialog(Dialog parent)

B. FileDialog(Dialog parent, String title)

C. FileDialog(Frame parent)

D. None of the above

Answer optionb

Marks: 1

951 Identify the Type of Following Driver

A. Type 1 Driver

B. Type 2 Driver

C. Type 3 Driver

D. Type 4 Driver

Answer optionc

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
952 Identify the JDBC Driver

A. Type 1 Driver

B. Type 2 Driver

C. Type 3 Driver

D. Type 4 Driver

Answer optiond

Marks: 1

953 Which of the Following is Type 1 Driver

A.

B.

C.

D.

Answer optiona

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
954 Which of the Following is Type 2 Driver

A.

B.

C.

D.

Answer optionb

Marks: 1

955 Identify the Type 3 Driver From the following Figures

A.

B.

C.

D.

Answer optionc

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
956 Identify the Type 4 Driver From the following Figures

A.

B.

C.

D.

Answer optiond

Marks: 1

Consider Following Program


import java.sql.*;
public class JdbcSelectTest
{
957 public static void main(String args[]){
try {
-----------------------------
----------------
Statement stmt = conn.createStatement();

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
String strSelect = "select rollno, name, marks from stude
System.out.println("The SQL query is: " + strSelect);

ResultSet rset = stmt.executeQuery(strSelect);


System.out.println("The records selected are:");
int rowCount = 0; while(rset.next()) {
String rollno = rset.getString("rollno");
String name = rset.getString("name"); int
marks = rset.getInt("marks");
System.out.println(rollno + ", " + name + ", " + m
++rowCount;
}
System.out.println("Total number of records = " + row
conn.close();
}
catch(SQLException ex) {
ex.printStackTrace();
}

}
}
Chose correct response to fill the blank.

Connection conn = DriverManager.getConnection("jdbc:mysql://localh


A.
"root", "root");

Connection conn; conn =


B.
DriverManager.getConnection("jdbc:mysql://localhost:3306/mydata",

Connection conn = DriverManager.getConnection("jdbc:mysql://192.1


C.
"root", "root");

D. All of the Above

Answer optiond

Marks: 1

Consider following Program


958 import java.sql.*; public
class JdbcSelectTest

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
arks);

Count);

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
{
public static void main(String args[]){
try {
Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/mydata",
Statement stmt = conn.createStatement();
String strSelect = "select rollno, name, marks from stude
System.out.println("The SQL query is: " + strSelect);

ResultSet rset = stmt.executeQuery(strSelect);


System.out.println("The records selected are:");
int rowCount = 0; while(rset.next()) {
String rollno = _____________________;
String name = rset.getString("name"); int
marks = _____________________;
System.out.println(rollno + ", " + name + ", " + m
++rowCount;
}
System.out.println("Total number of records = " + row
conn.close();
}
catch(SQLException ex) {
ex.printStackTrace();
}

}
}
Choose Correct Option to replace Blank

A. rs.getInt(

B. rset.getString(1); & rset.getInt(3);

C. stmt.getString(

D. Both A and B

Answer optionb

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
arks)

Count);

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
y("selec

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Fill in the blanks to insert values in
Student(rollno,name,marks,conta import java.sql.*; public class
SampleInsert {
public static void main(String args[])throws Exception
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
959 Connection c =DriverManager.getConnection("jdbc:odbc:DSN2","","
Pre
s=c.prepareStatement("______" ); int n=s. .executeUpdate();
Statement st=con.createStatement();ResultSet rs=st.executeQuer
System.out.println("Name"+" "+"Roll no"+" "+"Avg");
while(rs.next()) { System.out.println(rs.getInt(1)+"
"+rs.getDouble(3) +"

A. Insert into student values(?,?,?)

B. Insert into table student (?,?,?,?)

C. Insert into table student values(?,?,?)

D. Insert into student values(?,?,?,?)

Answer optiond

Marks: 2

The ----------- method is used to move to the first card in car


960 layou

A. public void previous(Container parent)

B. public void first(Container parent)

C. public void next(Container parent)

D. All of the above

Answer optionb

"+rs.getString(2)

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
"+rs.getInt(4)); } s.close();
c.close

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

Predict the output of Following program import


java.sql.*;
public class JdbcSelectTest
{
public static void main(String args[]){
try {
Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/mydat
Statement stmt = conn.createStatement();
String strSelect = "select rollno, name, marks from
student";
System.out.println("The SQL query is: " + strSelect);

ResultSet rset = stmt.executeQuery(strSelect);


System.out.println("The records selected are:");
961 int rowCount = 0; while(rset.first()) {
String rollno = rset.getString("rollno");
String name = rset.getString("name"); int
marks = rset.getInt("marks");
System.out.println(rollno + ", " + name + ", " + m
++rowCount;
}
System.out.println("Total number of records = " + row
conn.close();
}
catch(SQLException ex) {
ex.printStackTrace();
}

}
}

A. print all the columns of student table

B. print roll no, name and marks from student table

C. print roll no, name and marks of first student from student ta

D. None of the Above

a", "roo

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
arks);

Count);

ble

Answer optionc

Marks: 2

962 Which method is used to know the mode of the FileDialog.?

A. int getMode()

B. void getMode()

C. int getMode(int)

D. void getMode(int)

Answer optiona

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
The ----------------- method is used to set the mode of the
963 FileDialog

A. void setMode(int mode)

B. int setMode(int mode)

C. void setMode()

D. int setMode()

Answer optiona

Marks: 1

Consider Following Program import


964 java.sql.*;

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
public class JdbcSelectTest
{
public static void main(String args[]){
try {
Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/mydata",
Statement stmt = conn.createStatement();
String strSelect = "select rollno, name, marks from stude
System.out.println("The SQL query is: " + strSelect);

ResultSet rset = stmt.executeQuery(strSelect);


System.out.println("The records selected are:");
int rowCount = 0; while(rset.next()) {
String rollno = rset.getString("rollno");
String name = rset.getString("name");
_____ marks = _______________;
System.out.println(rollno + ", " + name + ", " + m
++rowCount;
}
System.out.println("Total number of records = " + row
conn.close();
}
catch(SQLException ex) {
ex.printStackTrace();
}

}
}

Choose Correct Option to replace Blank.

A. int, rset.getInt

B. String, a.getString

C. Both of the Above

D. None of the Above

Answer optiona

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
arks)

Count);

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

Predict the Output of following program import


java.sql.*;
public class JdbcSelectTest
{
public static void main(String args[]){
try {
Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/mydata",
Statement stmt = conn.createStatement();
String strSelect = "select rollno, name, marks from stude
System.out.println("The SQL query is: " + strSelect);

ResultSet rset = stmt.executeQuery(strSelect);


System.out.println("The records selected are:");
int rowCount = 0; while(rset.last()) {
965 String rollno = rset.getString("rollno");
String name = rset.getString("name"); int
marks = rset.getInt("marks");
System.out.println(rollno + ", " + name + ", " + m
++rowCount;
}
System.out.println("Total number of records = " + row
conn.close();
}
catch(SQLException ex) {
ex.printStackTrace();
}

}
}

A. print all the columns of student table

B. print roll no, name and marks from student table

C. print roll no, name and marks of last student from student tab

D. generate sql Exception

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
arks);

Count);

le

Answer optionc

Marks: 1

966 _____class implements a single line text-entry area.

A. Button

B. TextField

C. Checkbox

D. TextArea

Answer optionb

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Return type for method next(), first() and last() method of
967 resultset

A. int

B. String

C. boolean

D. ResultSet Object

Answer optionc

Marks: 1

Identify Correct Syntax for following method of ResulSet


968 ______ absolute (______);

A. boolean, int

B. boolean, void

C. void, int

D. void, void

Answer optiona

Marks: 1

Identify Correct Syntax for following method of ResulSet


969 ______ first (______);

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. boolean, int

B. boolean, void

C. void, int

D. void, void

Answer optionb

Marks: 1

Which is the correct syntax of next() method of


970 ResultSet() interface ?

A. boolean next()

B. void next()

C. void first()

D. void new()

Answer optiona

Marks: 1

Which driver provides JDBC access via one or more ODBC


971 drivers

A. Type 1 driver

B. Type 2 driver

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. Type 3 driver

D. Type 4 driver

Answer optiona

Marks: 1

972 Which type of driver is called partly java driver?

A. Type 1 driver

B. Type 2 driver

C. Type 3 driver

D. Type 4 driver

Answer optionb

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

__________ method of ResultSet object is called to retrieve Bin


973 lar database.

A. getBigDecimal

B. getBlob

C. getBinaryStream

D. getASCIIStream

Answer optionb

Marks: 1

What should be enter at the blank space? import


java.sql.*;

class PreparedUpdate
{
public static void main(String a[])
{ try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
974 con=DriverManager.getConnection("jdbc:odbc:javadb")
Statement st=con.createStatement();
String stm = "update employee set name=? where name=?";

PreparedStatement ps = con.________________(stm);
ps.setString(1,"Ram"); ps.setString(2,"Ramesh");

ps.executeUpdate(stm);

ResultSet rs = st.executeQuery("select * from employee");

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
;

while(rs.next())
{
System.out.println(" ID : "+ rs.getInt(1));
System.out.println(" Name : "+ rs.getString(2));
System.out.println(" Salary : "+ rs.getInt(3));
System.out.println();
}
con.close();

}
catch(SQLException e)
{
System.out.println("SQL Error");
}
catch(Exception e)
{
System.out.println("Error");
}

}
}

A. PreparedStatement

B. ParameterizedStatement

C. prepareStatement

D. None of the above

Answer optionc

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Which statement should be missing in the following program?
class PreparedInsert
975 {
public static void main(String a[])
{

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:javadb") ;
System.out.println(" Connection to DataBase created");
)";
String a1 = "Insert into employee(id,name,salary)
values(?,?,?

PreparedStatement ps = con.prepareStatement(a1);

ps.setInt(1,5);
ps.setString(2,"sahil");
ps.setInt(3,5000);
ps.execute(a1);

System.out.println("Record Inserted");
String querySel = "Select * from employee";
ResultSet rs = ps.executeQuery(querySel);
System.out.println("After Insertion");

while(rs.next())
{
System.out.println(" ID : "+ rs.getInt(1));
System.out.println(" Name : "+ rs.getString(2));
System.out.println(" Salary : "+ rs.getInt(3));
System.out.println();
}
con.close();

}
catch(SQLException e)
{
System.out.println("SQL Error");
}
catch(Exception e)
{
System.out.println("Error");
}

}
}

A. Missing semicolon

B. Missing {

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. Missing }

D. Missing package statement.

Answer optiond

Marks: 2

976 Which AWT components are used to produce given output ?

A. Button,TextArea,Choice

B. List,TextArea,Label,Button

C. Label,TextField,Choice,CheckboxGroup

D. List,Label,TextField,Button

Answer optionc

Marks: 1

977 Return type of execute() method is _______

A. boolean

B. int

C. ResultSet

D. None of the Above

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 1

What should be added at the blank spaces? import


java.sql.*;

class ConnectDB
{
public static void main(String a[])
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("Driver Loaded");
String url="jdbc:odbc:javadb";
__________________con=DriverManager.getConnection(url);
978 System.out.println(" Connection to DataBase
created");
}
catch(SQLException e)
{
System.out.println(" Error"+e);
}
catch(Exception e)
{
System.out.println(" Error"+e);
}
}
}

A. DriverManager

B. Connection

C. Statement

D. None of the above

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionb

Marks: 2

979 import java.awt.*;

import java.applet.*;
public class checkboxDemo extends Applet
/* <applet code="checkbox" width=300 height=300></applet>*/
{
public void init()

Checkbox cb1,cb2;
------------------------------------
cb1=new Checkbox("Java",true); cb2=new
Checkbox("C++",true,cbg);
add(cb1);add(cb2);

}
}
Fill in the blanks with correct statement.

A. CheckboxGroup cbg=new CheckboxGroup();

B. CheckboxGroup cbg=new CheckboxGroup(true);

C. CheckboxGroup cbg=new CheckboxGroup("Male",true);

D. None of the above

Answer optiona

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
_____________ interface defines methods that enable user to send SQL
980 q data from the database.

A. Statement

B. Connection

C. DriverManager

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. None of the above

Answer optiona

Marks: 1

Which method moves record cursor to the next row of result


981 set

A. beforeFirst()

B. afterLast()

C. first()

D. next()

Answer optiond

Marks: 1

982 _____________object is used for precompiled SQL statements.

A. PreparedStatement

B. ParameterizedStatement

C. prepareStatement

D. None of the above

Answer optiona

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Identify Problem in the following code import
java.sql.*;
public class JdbcSelectTest
{
public static void main(String args[]){
Connection conn =
DriverManager.getConnection("jdbc:mysql://192.168.1.1:3306/mydata",
Statement stmt = conn.createStatement();
String strSelect = "select rollno, name, marks from student
System.out.println("The SQL query is: " + strSelect);
983
ResultSet rset = stmt.executeQuery(strSelect);
System.out.println("The records selected are:");
int rowCount = 0; while(rset.next()) {
String rollno = rset.getString("rollno");
String name = rset.getString("name"); int
marks = rset.getInt("marks");
System.out.println(rollno + ", " + name + ", " + m
++rowCount;
}
System.out.println("Total number of records = " + row }
}

A. Try catch not used

B. ResultSet object not created

C. wrong getConnection() method syntax

D. Both A&B

Answer optiona

Marks: 1

984 __________package contains the various interfaces and classes used b

A. java.sql

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
arks);

Count);

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. java.io

C. java.net

D. java.lang

Answer optiona

Marks: 1

985 windowDeactivated() is method of ________interface

A. WindowListener Interface

B. Window Interface

C. WindowConified Interface

D. Action Interface

Answer optiona

Marks: 1

986 windowOpened() is method of ________interface

A. WindowListener Interface

B. Window Interface

C. Window Conified Interface

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. Action Interface

Answer optiona

Marks: 1

987 mouseClicked() is method of _________interface.

A. Mouse Interface

B. MouseMotionListener Interface

C. MouseClick Interface

D. MouseListener Interface

Answer optiond

Marks: 1

988 mouseEntered() is method of _________interface .

A. Mouse Interface

B. MouseMotionListener Interface

C. MouseEntered Interface

D. MouseListener Interface

Answer optiond

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

989 mouseExited() is method of _________interface.

A. Mouse Interface

B. MouseMotionListener Interface

C. MouseExited Interface

D. MouseListener Interface

Answer optiond

Marks: 1

990 mousePressed() is method of _________interface.

A. Mouse Interface

B. MouseMotionListener Interface

C. MousePressed Interface

D. MouseListener Interface

Answer optiond

Marks: 1

991 mouseReleased() is method of _________interface.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. Mouse Interface

B. MouseMotionListener Interface

C. MouseReleased Interface

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. MouseListener Interface

Answer optiond

Marks: 1

Which of the following statements are true?


1) The MouseMotionListener interface defines methods for handling
mou
2) The ActionListener interface defines methods for handling the
992 clic
3) The MouseClickListener interface defines
4) The MouseListener interface defines methods for handling mouse
dra

A. Statement 1 and 3 are true

B. Only first statement is true

C. Only second statement is true

D. All statements are true

Answer optionc

Marks: 1

Which of the following statements is true?


1) keyPressed() is method of KeyListerner Interface
993 2) keyPressed() is method of MouseListener Interface
3) keyPressed() is method of ActionListener Interface
4) keyPressed() is method of KeyBoardListener Interface

A. Statement 1 is true

B. Statement 2 is true

C. Statement 3 is true

methods for handling


mouse

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. Statement 4 is true

Answer optiona

Marks: 1

Which package is required for events?


994

A. java.listener

B. java.util.event

C. java.awt.event

D. java.motion

Answer optionc

Marks: 1

The Following steps are required to perform


995 1) Implement the Listener interface and overrides its methods
2) Register the component with the Listener

A. Exception Handling

B. String Handling

C. Event Handling

D. Listener Handling

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionc

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

Consider following three statement


1) ActionListener Interace defines one method to receive
actio
996 2) ItemListener Interface defines one method to recognize
when the stchange..
3) MouseListener interface defines mouseMoved() method

A. Statement 1 and 2 are true

B. Only first statement is true

C. Only second statement is true

D. All statements are true

Answer optiona

Marks: 1

Which of the following statements are false


1)windowlistener define seven method
2)mouseMotionListerne define 2 method
997 3) ActionListener Interace defines three method to receive acti
even
4)KeyListener Interface define Three method

A. Statement 1 is false

B. Statement 2 is false

C. Statement 3 is false

D. Statement 4 is false

Answer optionc

n event

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

Consider following two statement


1) Implement the Listener interface and overrides its methods
998 is requievent handling.
2) ActionListener Interace defines one method to receive acti

A. Only first statement is true

B. Only second statement is true

C. Both statements are true

D. Both statements are False

Answer optionc

Marks: 1

Which of the following method of a Frame is used to change it'


999 color

A. setBackground(Color c )

B. setForeground( Color c )

C. add()

D. getBackground()

Answer optiona

Marks: 1

1000 ContentHandler , MulticastSocket , URL, SocketImpl are exampl

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
n event

A. package

B. class

C. Interface

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
es of
D. Method ----

Answer optionb

Marks: 1

URLEncoder , URLConnection , URLDecoder are examples of ----


1001 -

A. package

B. class

C. Interface

D. All of the above ning-

Answer optionb

Marks: 1

The WindowEvent class, WINDOW_ICONIFIED, integer constants


1002 mea

A. Showing a window for the first time.

B. The window which contains the focus owner.

C. Reducing the window from to minimized.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. Restoring the window to its original size.

Answer optionc

Marks: 1

ItemEvent constructor-
ItemEvent(ItemSelectable src, int type, Object entry,
1003 sta
Here src means......

A. The specific item that generated the item event is passed

B. The type of object

C. a reference to the component that generated event

D. The current state of that item.

Answer optionc

Marks: 1

1004 The WindowEvent class, WINDOW_DEICONIFIED, integer constants m

A. Reducing the window to an icon on the desktop

B. The window which contains the focus owner.

C. Showing a window for the first time.

D. Restoring the window to its original size.

Answer optiond

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

1005 Choose the incorrect statement ?

A. List l=new List(4);

B. List l1=new List(6,true);

C. Choice c=new Choice();

D. Choice c1=new Choice(3);

Answer optiond

Marks: 1

1006 What does URL stands for?

A. Uniform Resource Locator

B. Uniform Resource Latch

C. Universal Resource Locator

D. Universal Resource Latch

Answer optiona

Marks: 1

The WindowEvent class, WINDOW_DEACTIVATED, integer constants


1007 m

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. Reducing the window to an icon on the desktop

B. The window which contains the focus owner.

C. This window has lost the focus

D. Restoring the window to its original size.

Answer optionc

Marks: 1

Which of the following are true?


A. The event-inheritance model has replaced the event-
B. The event-inheritance model is more efficient than the even
1008 C. The event-delegation model uses event listeners to define
the metho handling classes.
D. The event-delegation model uses the handleEvent( ) method to
suppor

A. Statement 1 is true

B. Statement 2 is true

C. Statement 3 is true

D. Statement 4 is true

Answer optionc

Marks: 1

1009 WindowEvent is a subclass of __________________.

A. ComponentEvent

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. TextEvent

eaning-
eaning-
delegat
ion
model
t-
delega

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. InputEvent

D. Window

Answer optiona

Marks: 1

Which of these exceptions is thrown by URL classes


1010 constructor

A. URLNotFound

B. URLSourceNotFound

C. MalformedURLException

D. URLNotFoundException

Answer optionc

Marks: 1

1011 Which of these methods is used to know host of an URL?

A. host()

B. getHost()

C. GetHost()

D. gethost()

Answer optionb

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
s?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

WindowEvent Constructor-
1012 WindowEvent(Window src, int type, Window other, int fromState, int
toS Here fromState means-

A. the new state of the window

B. prior state of the window.

C. opposite window when a focus or activation event occurs.

D. reference to the object that generated this event.

Answer optionb

Marks: 1

1013 Which of the following components generate action events?

A. Button

B. Labels

C. Check boxes

D. Windows

Answer optiona

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
1014 getWindow ( ) method returns

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. int value of window

B. Location of window

ling
C. void value
mouse

D. Window object

Answer optiond

Marks: 1

Which of the following are true?


A) The MouseListener interface defines methods for handling mouse
clic
1015 B) The MouseMotionListener interface defines methods for handling
mousC) The MouseClickListener interface defines methods for hand
D) The ActionListener interface defines methods for handling the
click

A. Only Statement A is true

B. Only Statement D is true

C. Statement A and D are true

D. Statement B and D are true

Answer optionc

Marks: 1

1016 WindowEvent class methods are-

A. getOppositeWindow()

B. getNewState()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. getOldState()

D. All of above

Answer optiond

Marks: 1

Which of these class is used to access actual bits or content


1017 informat

A. URL

B. URLDecoder

C. URLConnection

D. All of the mentioned

Answer optiond

Marks: 1

What is the output of this program?

import java.net.*;
class networking
{
1018
public static void main(String[] args) throws M
{
URL obj = new URL("https://www.sanfoundry.c
System.out.print(obj.getProtocol()); }
}

A. http

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
alforme

om/java

object?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. https

C. www

ii.
D. com

Answer optionb

Marks: 2

1019 Which of these methods is used to know the full URL of an URL

A. fullHost()

B. getHost()

C. ExternalForm()

D. toExternalForm()

Answer optiond

Marks: 1

Match the correct pairs-


a. getKeyLocation() i. Set the keyCode value
to indic
b. getKeyCode() in this event.
1020
c. getKeyChar() iii. Returns the
location of toriginated this key event.
d. setKeyCode(int keyCode) iv. Returns the integer ke
key in this event.

A. d-i, c-ii, a-iii, b-iv

B. d-ii, c-i, a-iii, b-iv

Returns the character associ

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
yCode as

C. d-i, c-ii, a-iv, b-iii

D. d-iv, c-ii, a-iii, b-i

Answer optiona

Marks: 2

1021 Which of the following statements is true?

A. keyTyped() is method of KeyListerner Interface

B. keyTyped() is method of MouseListener Interface

C. keyTyped() is method of ActionListener Interface

D. keyTyped() is method of KeyBoardListener Interface

Answer optiona

Marks: 1

.ContentHandlerFactory , SocketOptions , FileNameMap are included


1022 in

A. .net

B. .util

C. . io

D. .lang

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 1

1023 .com,.gov,.org are examples of--------

A. domain

B. server name

C. client name

D. package

Answer optiona

Marks: 1

1024 Which of the following option is true?

A. keyReleased() is method of KeyListerner Interface

B. keyReleased() is method of MouseListener Interface

C. keyReleased() is method of ActionListener Interface

D. keyReleased() is method of KeyBoardListener Interface

Answer optiona

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Consider following code segment-
1. public void keyReleased(getKeyChar( ) ) {
1025 2. str+=" -Key Released- ";
3. label2.setText(str);
4. jf.setVisible(true);

5. str="";
6.}
7. public void keyTyped(KeyEvent ke) {
8. str+=" -Key Typed- ";
9. label2.setText(str);
10. jf.setVisible(true);
11. }
Which statement is true ?

A. There are syntax errors on line no. 1

B. There are syntax errors on line no. 3

C. There are syntax errors on line no. 7

D. There are syntax errors on line no. 10

Answer optiona

Marks: 2

1026 Select true statement from the following options.

A. mousePressed() is method of MouseMotionListener Interface

B. mousePressed() is method of Mouse Interface

C. mousePressed() is method of MousePressed Interface

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. mousePressed() is method of MouseListener Interface

Answer optiond

Marks: 1

Select correct general form of Mouse Clicked method of Mouse


1027 Listener

A. void mouseClicked(mouseEvent me)

B. void MouseClicked(mouseEvent me)

C. void MouseClicked(MouseEvent me)

D. void mouseClicked(MouseEvent me)

Answer optiond

Marks: 1

public void removeTypeListener(TypeListener el) Here


1028 Type means-

A. reference to the event listener

B. name of the event

C. type of multicasting of event

D. None of the above

Answer optionb

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

Which of these methods is used to know when was the URL last
1029 modified?

A. LastModified()

B. getLastModified()

C. GetLastModified()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. getlastModified()()

Answer optionb
C. html/text

Marks: 1
D. text/html
Which of these methods is used to know the type of content used
1030 the
Answer optiond

A. ContentType()
Marks: 2

B. contentType()
What is the output of this program?

C. import java.net.*;
getContentType()
class networking
{
D. GetContentType()
public static void main(String[] args) throws Exceptio
1032 {
URL obj = new URL("https://www.sanfoundry.com/java
Answer optionc obj1 = obj.openConnection();
URLConnection
int len = obj1.getContentLength();
System.out.print(len);
Marks: 1}
}
What is the output of this program?
A. 127
import java.net.*;
class networking
-1 {
B.
public static void main(String[] args) throws Exceptio
1031 {
C. Compilation Error URL obj = new URL("https://www.sanfoundry.com/java
URLConnection obj1 = obj.openConnection();
System.out.print(obj1.getContentType());
D. Runtime Error }
}
Answer optionb
A. html

Marks: 2
B. text

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Select correct general form of Mouse Entered method of Mouse n
1033 Listener
mcq");

A. void mouseEntered(mouseEvent me) n

mcq");

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. void MouseEntered(mouseEvent me)

C. void MouseEntered(MouseEvent me)

D. void mouseEntered(MouseEvent me)

Answer optiond

Marks: 1

Consider following code segment-


1. public void mouseClicked(MouseEvent event){
2. setBackground(Color.blue);Â
3.int x = event.getX();Â
1034 4.int y = event.getY();Â
5.int c = getClickCount( );
6. }
Which statement is true?

A. There are syntax errors on line no. 1

B. There are syntax errors on line no. 2

C. There are syntax errors on line no . 4

D. There are syntax errors on line no. 5

Answer optiond

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Consider following code segment-
1. public void mouseClicked(MouseEvent event){
1035 2. boolean d = event.isPopupTrigger( );
3. }
In above code segment Line no. 2 specifies:

tform.

atform.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. tests if this event causes a pop-up menu to appear on this pla

B. tests if this event response pop-up menu to appear on this pl

C. tests if this event is pop-up window.

D. tests if this event is pop-up Trigger.

Answer optiona

Marks: 1

Find the Error in given code for implementing Mouse motion even
handl import java.awt.*; import java.awt.event.*;
public class MouseEventsDemo extends Frame implements KeyListe
{
String msg=""
int mouseX=0, mouseY=0; public
MouseEventsDemo() {
addMouseMotionListener(this);
addWindowListener(new MyWindowAdapter());
}
public void mouseDragged(MouseEvent me)
{
mouseX=me.getX();
1036 mouseY=me.getY();
msg= "* " + "mouse at " +
repaint();
}
public void mouseMoved(MouseEvent me)
{
msg="Moving mouse at " + me.getX() + " , " + me.getY
repaint();
}
public void paint(Graphics g)
{
g.drawString(msg, mouseX, mouseY);
}
public static void main(String [] args) {

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
ner

mouseX + " , " +

mo

();

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
MouseEventsDemo M1= new MouseEventsDemo();
M1.setSize(new Dimension(300,300));
M1.setTitle("MouseEventsDemo");
M1.setVisible(true);
}
}
class MyWindowAdapter extends WindowAdapter
{

Public void windowClosing(WindowEvent we)


{
System.exit(0);
}

A. Error in registering Listener

B. All methods of Interface are not implemented

C. Implements Wrong name of interface class

D. Required packages are not implemented.

Answer optionc

Marks: 2

Consider following code segment-


public void mousePressed(MouseEvent event) {
1037 System.out.println(event.getPoint());
}
Following code segement output is-

A. Print value of x and y co-ordinates

B. Print value of x co-ordinates

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. Print value of y co-ordinates

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. Print value of event object.

Answer optiona

Marks: 1

Find the Error in given code for implementing Mouse motion even
handl import java.awt.*; import java.awt.event.*;
public class MouseEventsDemo extends Frame implements MouseMoti
{
String msg=" "
int mouseX=0, mouseY=0; public
MouseEventsDemo() {
addMouseMotionListener(this);
addWindowListener(new MyWindowAdapter());
}
public void mouseMoved(MouseEvent me)
{
msg="Moving mouse at " + me.getX() + " , " + me.getY
repaint();
}
public void paint(Graphics g)
{
g.drawString(msg, mouseX, mouseY);
1038 }
public static void main(String [] args)
{
MouseEventsDemo M1= new MouseEventsDemo();
M1.setSize(new Dimension(300,300));
M1.setTitle("MouseEventsDemo");
M1.setVisible(true);
}
}
class MyWindowAdapter extends WindowAdapter
{

Public void windowClosing(WindowEvent we)


{
System.exit(0);
}

();

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Error in registering Listener
A. M1.setSize(new Dimension(300,300));
M1.setTitle("MouseEventsDemo");
B. M1.setVisible(true);
All methods of Interface are not implemented
}
}
C. class Correct
MyWindowAdapter
Interfaceextends WindowAdapter
class not implemented
{

D. Public Required packages are not implemented.


void windowClosing(WindowEvent we)
{
System.exit(0);
Answer optionb
}

}
Marks: 2

A. Listener not registered


Find the Error in given code for implementing Mouse motion even
handl import java.awt.*; import java.awt.event.*;
B. publicofclass
All methods MouseEventsDemo
Interface extends Frame implements MouseMoti
are not implemented
{
String msg=""
C. CorrectintInterface class
mouseX=0, not implemented
mouseY=0; public
MouseEventsDemo() {
addWindowListener(new MyWindowAdapter());
D. Required packages are not implemented.
}
public void mouseDragged(MouseEvent me)
Answer optiona {
mouseX=me.getX();
mouseY=me.getY();
Marks: 2 msg= "* " + "mouse at " + mouseX + " , "+
1039 mous repaint();
Consider} following code segment-
1. public voidvoid
public mouseMoved(MouseEvent me) event) {
mouseClicked(MouseEvent
2. { // Line 2
1040 3. msg="Moving
} mouse at " + me.getX() + " , "+ me.getY(
repaint();
Following code segment, identify statement to print co-
ordinat}
public void paint(Graphics g)
A. int p ={ getLocationOnScreen( );
g.drawString(msg, mouseX, mouseY);
}
B. Point ppublic static void main(String
= getLocationOnScreen( ); [] args)
{
MouseEventsDemo M1= new MouseEventsDemo();
C. int x,y = getLocationOnScreen( );

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. None of above

Answer optionb

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
); es -
Find the Error in given code for implementing Mouse motion event );
handl import java.lang*; import java.util.event.*;
public class MouseEventsDemo extends Frame implements MouseMotionListe
{
String msg=""
int mouseX=0, mouseY=0; public
MouseEventsDemo() {
addMouseMotionListener(this);
addWindowListener(new MyWindowAdapter());
}
public void mouseDragged(MouseEvent me)
{
mouseX=me.getX();
mouseY=me.getY();
msg= "*" + "mouse at " + mouseX + " , " +
mou repaint();
}
public void mouseMoved(MouseEvent me)
1041 {
msg="Moving mouse at " + me.getX() + ", " + me.getY(
repaint();
}
public void paint(Graphics g)
{
g.drawString(msg, mouseX, mouseY);
}
public static void main(String [] args)
{
MouseEventsDemo M1= new MouseEventsDemo();
M1.setSize(new Dimension(300,300));
M1.setTitle("MouseEventsDemo");
M1.setVisible(true);
}
}
class MyWindowAdapter extends WindowAdapter
{

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Public void windowClosing(WindowEvent we)
{
System.exit(0);
}

A. Listener not registered

B. All methods of Interface are not implemented

C. Correct Interface class not implemented

D. Required packages are not imported

Answer optiond

Marks: 2

Which constructor is used to set the grid layout with vertical gap
1042 and

A. GridLayout()

B. GridLayout(int rw, int cl)

C. GridLayout(int rw, int cl, int hgap, vgap)

D. All of the above

Answer optionc

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Write the correct code at blank spaces:
1043
import java.awt.*;

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
import java.awt.event.*;
public class MouseMotionListenerExample extends Frame implements Mouse
{
MouseMotionListenerExample()
{
addMouseMotionListener(this); s
setSize(300,300); KeyLis
setLayout(null);
setVisible(true);
}
public void ___________(MouseEvent e) {
Graphics g=getGraphics();
g.setColor(Color.RED);
g.drawOval(e.getX(),e.getY(),20,20); }
public void _____________(MouseEvent e) {}

public static void main(String[] args) {


new MouseMotionListenerExample();
}
}

A. mouseDragged, mouseMoved

B. mousePressed,mouseDragged

C. mouseClicked,mouseMoved

D. mouseReleased,mouseClicked

Answer optiona

Marks: 2

Find error in given program


1. import java.awt.*;
2. import java.awt.event.*;
1044 3. public class KeyListenerExample extends Frame implement
MyLAbel;
4. TextArea area;
5. KeyListenerExample(){

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
6. MyLabel=new Label();
7. MyLabel.setBounds(20,50,100,20);
8. area=new TextArea();
9. area.setBounds(20,80,300, 300);
10. add(MyLabel);add(area);
11. setSize(400,400); 12. setLayout(null);
13. setVisible(true);
14. }
15. public void keyPressed(KeyEvent e) {
16. MyLabel.setText("Key Pressed");
17. }
18. public void keyReleased(KeyEvent e) {
19. MyLabel.setText("Key Released");
20. }
21. public void keyTyped(KeyEvent e) {
22. MyLabel.setText("Key Typed");
23. }

24. public static void main(String[] args)


{
25. new KeyListenerExample();
26. }
27. }

A. Listener not registered

B. All methods of Interface are not implemented

C. Wrong name of Interface class

D. Required packages are not imported

Answer optiona

Marks: 2

1045 The ______________ method changes the location of the event.

A. int getX( )

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Point getPoint( )

C. translatePoint( )

D. isPopupTrigger( )

Answer optionc

Marks: 1

Find error in given program


1 import java.awt.*;
2 import java.awt.event.*;
3 public class KeyListenerExample extends Frame implement
MyLAbel;
4 TextArea area;
5 KeyListenerExample(){
6 MyLabel=new Label();
7 MyLabel.setBounds(20
8 area=new TextArea();
9 area.setBounds(20,80,
10 area.addKeyListener(t
11 add(MyLabel);add(area
12 setSize(400,400);
1046
13 setLayout(null);
14 setVisible(true);
15 }
16 public void keyPressed(KeyEvent e) {
17 Pressed");
18 19 public void keyReleased(KeyEvent e) {
20
Released");
21
22 public static void main(String[] args) {
23
KeyListenerExample();
24
25 }

A. Listener not registered

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
s
KeyLis

,50,100
, 300,
300
his);
);

MyLabe

MyL

ne }

B. All methods of Interface are not implemented

C. Wrong name of Interface class

D. Required packages are not imported

Answer optionb

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Find error in given program
import java.awt.*; import
java.awt.event.*;
public class KeyListenerExample extends Frame implements
KeyBoardListe
{ Label MyLAbel;
TextArea area;
KeyListenerExample()
{
MyLabel=new Label();
MyLabel.setBounds(20,50,100,20); area=new
TextArea();
area.setBounds(20,80,300, 300);
area.addKeyListener(this);
add(MyLabel);add(area);
setSize(400,400);
1047 setLayout(null);
setVisible(true);
}
public void keyPressed(KeyEvent e)
{
MyLabel.setText("Key Pressed");
}
public void keyReleased(KeyEvent e)
{
MyLabel.setText("Key Released");
}
public void keyTyped(KeyEvent e)
{
l.setText("Key Typed");
}
public static void main(String[] args) {

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
new KeyListenerExample();
}
}

A. Listener not registered

B. All methods of Interface are not implemented

C. Implements Wrong name of Interface class

D. Required packages are not imported

Answer optionc

Marks: 2

ContentHandler , MulticastSocket , URL, SocketImpl are


1048 includ

A. .net

B. .util

C. . io

D. .lang

Answer optiona

Marks: 1

HttpURLConnection , URLConnection , URL are included in


1049 -

A. .net

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
ed in --

------p

B. .util

C. . io

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. .lang

Answer optiona

Marks: 1

Find error in given program


import java.util.*;
import java.util.event.*;
public class KeyListenerExample extends Frame implements
KeyListener{ Label MyLAbel;
TextArea area;
KeyListenerExample()
{
MyLabel=new Label();
MyLabel.setBounds(20,50,100,20); area=new
TextArea();
area.setBounds(20,80,300, 300);
area.addKeyListener(this);
add(MyLabel);add(area);
setSize(400,400);
setLayout(null);
1050 setVisible(true);
} public void keyPressed(KeyEvent
e) { MyLabel.setText("Key
Pressed");
} public void keyReleased(KeyEvent
e) {
MyLabel.setText("Key Released");
} public void keyTyped(KeyEvent
e) {
l.setText("Key Typed");
}
public static void main(String[] args)
{
new KeyListenerExample();
}
}

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. Listener not registered

B. All methods of Interface are not implemented

C. Wrong name of Interface class

D. Required packages are not imported

Answer optiond

Marks: 2

Consider following code segment- 1.


public void textValueChanged(TextEvent e) {
2. TextComponent tc = (TextComponent) e.getSource();
1051 3. // Line No. 3
4. }
Above segment of code, identify code a Line No 3 to display tex
Te

A. System.out.println("Typed value in TextComponent "+tc.getText(

B. System.out.println("Typed value in TextComponent "+tc.paramStr

C. System.out.println("Typed value in TextComponent "+tc.getSourc

D. System.out.println("Typed value in TextComponent "+tc.getValue

Answer optiona

Marks: 2

Consider following code segment-


1. t=new TextField(20);
1052 2. public void textValueChanged(TextEvent te) {
3. // Line No. 3
4. }

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
));

ing());

e());

());

Above segment of code, identify the code at Line No 3 to set the


frame

A. setTitle(t.getValue());

B. setTitle(te.getText());

C. setTitle(te.getValue());

D. setTitle(t.getText());

Answer optiond

Marks: 2

Consider following code segment-


1. TextArea typeText, displayText;
2. public void textValueChanged(TextEvent e) {
1053 3.String str=typeText.getText();
4.// Line No. 4 5.}
Following segment of code, identify code a Line No 4 to read text
from display to displayText

A. displayText.setText(e.str);

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. displayText.setText(e.getText());

C. displayText.setText(str);

D. displayText.setText(e.typeText);

Answer optionc

Marks: 2

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Fill the blank at line no 5.
1. public class WindowExample extends Frame
implements Win
2. {
3. WindowExample()
1054 4. {
5. _______________ (this);
6. setSize(400,400);
7. setLayout(null);
8. setVisible(true);
9. }

A. addWindowListener

B. addwindow

C. WindowListener()

D. addwindowlistener

Answer optiona

Marks: 1

-------------------- layout lays out the components in a directional


1055 f

A. Grid Layout

B. Card Layout

C. FlowLayout

D. BorderLayout

Answer optionc

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
dowList
e

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
1056 Identify the incorrect Integer constants for WindowEvent.

A. WINDOW_ACTIVATED

B. WINDOW_DEACTIVATED

C. WINDOW_LOST_FOCUS

D. WINDOW_GOT_FOCUS

Answer optiond

Marks: 2

Write the correct code at blank space: public class


____________ extends Frame implements WindowListe {
WindowExample()
{
addWindowListener(this);
setSize(400,400);
1057 setLayout(null);
setVisible(true);
}
public static void main(String[] args) {
new WindowExample();
}

A. addWindowListener

B. WindowExample

C. Window

D. WindowListener

ner

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionb

Marks: 1

Which top-level class provides methods to add and remove keyboard


1058 and listeners-

A. Object

B. ActionEvent

C. EventObject

D. Component

Answer optiond

Marks: 1

1059 The getActionCommand( ) method returns-

A. String

B. Object

C. int

D. void

Answer optiona

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
--------------------- class displays a dialog window from which the
1060 us

file.

A. java.awt.FileDialog

B. java.awt.Dialog

C. java.awt.File

D. All of the above

Answer optiona

Marks: 1

1061 The getItem( ) method returns-

A. String

B. Object

C. void

D. int

Answer optionb

Marks: 1

1062 Which method used to capture ALT, CTRL, META OR SHIFT keys-

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. getWhen( )

B. getActionCommand( )

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. getModifiers( )

D. getAdjustable( )

Answer optionc

Marks: 1

1.public void textValueChanged(TextEvent e) {


2.TextComponent tc =Â (TextComponent)Â e.getSource();
1063 3.System.out.println("Typed value in TextComponent "Â + e.getT
4. }
Following segment of code, Identify syntax error-

A. There are syntax errors on line no. 1

B. There are syntax errors on line no. 2

C. There are syntax errors on line no. 3

D. There are syntax errors on line no. 2 and 3

Answer optionc

Marks: 1

1.Label label;
2.TextField textField=new TextField();
3.public void keyPressed(KeyEvent ke) {
1064 4.// Line No 4
5. }
Identify code at Line No. 4 to get key code-

A. char keyChar=key.getKeyChar();

B. charkeyChar = textField.getKeyChar();

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
ext());

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. char keyChar=label.getKeyChar();

D. char keyChar = KeyEvent.getKeyChar();

Answer optiona

Marks: 1

1065 Select the interface which define a method actionPerformed()?

A. ComponentListener

B. ContainerListener

C. ActionListener

D. InputListener

Answer optionc

Marks: 1

1.Label label;
2.TextField textField=new TextField();
3.public void keyPressed(KeyEvent ke) {
1066 4.// Line No 4
5.}
Identify code at Line No. 4 to get key code-

A. char keyChar =KeyEvent. getKeyCode ();

B. char keyChar =textField. getKeyCode ();

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. char keyChar =label. getKeyCode ();

D. char keyChar =ke. getKeyCode ();

Answer optiond

Marks: 1

1067 The translatePoint( ) method-

A. changes the location of the event.

B. changes x co-ordinates of the event.

C. changes y co-ordinates of the event.

D. returns the translate co-ordinates.

Answer optiona

Marks: 1

1068 Select the method of MouseMotionListener Interface.

A. mouseDragged()

B. MouseMotionListener()

C. MouseClick()

D. MousePressed()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 1

Select the interface:


1069
Which defines a method itemStateChanged()?

A. ItemState

B. ContainerListener

C. ActionListener

D. ItemListener

Answer optiond

Marks: 1

1070 How many method define in FocusListener interface

A. one

B. two

C. four

D. seven

Answer optionb

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
1071 How many method define in ContainerListener interface.

A. seven

B. two

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. five

D. one

Answer optionb

Marks: 1

------types of exceptions are occurred in networking


1072 programmi

A. UnknownHostException

B. MalformedURLExeption

C. Exception

D. All of the above

Answer optiond

Marks: 1

1073 .net,.util,.lang are examples of -------

A. package

B. class

C. Interface

D. Method

Answer optiona

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
ng

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

1074 .net,.util,.lang,.gov, from this -----is a domain

A. .net

B. .util

C. .lang

D. .gov

Answer optiond

Marks: 1

1075 From following which is package?

A. .com

B. .util

C. .gov

D. All of the above

Answer optionb

Marks: 1

Networking classes encapsulate the "socket" paradigm pioneered in


1076 the abbreviation of BSD?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. Berkeley Software Distribution

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Berkeley Socket Distribution

C. Berkeley System Distribution

D. None of the above

Answer optiona

Marks: 1

1077 Datagrams are ------------------

A. bundles

B. sets

C. none of A and B

D. Both A and B

Answer optiona

Marks: 1

1078 TCP/IP style of networking provides ------------------

A. serialized stream of packet data

B. predictable stream of data

C. reliable stream of data

D. All of the above

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
of information passed between
machin

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiond

Marks: 1

--
1079 TCP includes many complicated algorithms for dealing with-----

A. congestion control on crowded networks

B. pessimistic expectations about packet loss

C. inefficient way to transport data

D. All of the above

Answer optiond

Marks: 1

-------- constructor specifies only a buffer that will receive data


1080 a packet.

A. DatagramPacket(byte data[], int size)

B. DatagramPacket(byte data[], int offset, int size)

DatagramPacket(byte data[], int offset, int size , InetAddress


C.
ipAd

D. All of the above

Answer optiona

Marks: 1

1081 DatagramPacket has ----------- methods

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. int getPort()
Marks: 2

B. byte[] getData()
import java.net.*;
class networking {
C. int getLength()
public static void main(String[] args) throws
Exceptio
URL obj = new URL("http://www.oracle.com");
D. All of the above
URLConnection obj1 = obj.openConnection();

1083 int len = obj1.getContentLength();


Answer optiond
System.out.print(len);
Marks: 1
}
What is the output of this program?
}
import java.net.*;
class networking
A. 0 {
public static void main(String[] args) throws
127 MalformedURLExce {
B.
1082
URL obj = new
C. compileURL("http://www.sanfoundry.com/javam
time error
System.out.print(obj.getPort());

D. run time error }

}
Answer optiona

A. 1
Marks: 2

B. 0
Which steps occur when establishing a TCP connection between two
1084 comp sockets?
C. -1

The server instantiates a ServerSocket object, denoting which port


A. D. num is garbage
to occurvalue
on

The server
Answer invokes the accept() method of the ServerSocket class.
optionc
B.
This a client connects to the server on the given port

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
cq"); n
{

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
After the server is waiting, a client instantiates a Socket obj
C.
sp name and port number to connect to

D. All of the above

Answer optiond

Marks: 2

Which of these transfer protocol must be used so that URL can b


1085 acces URLConnection class object?

A. http

B. https

C. Any Protocol can be used

D. None of the mentioned

Answer optiona

Marks: 1

What is the output of following


1086 program? import java.io.*; import
java.net.*; public class URLDemo {
public static void main(String[] args) {
try {
URL url=new URL("http://www.sanfoundry.com/java-mc
System.out.println("Protocol: "+url.getProtocol())
System.out.println("Host Name: "+url.getHost());

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
q");
;

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
System.out.println("Port Number:
"+url.getPort());
} catch(Exception e){System.out.println(e);}
}
}

A. Protocol: http

B. Host Name: www.sanfoundry.com

C. Port Number: -1

D. all above mentioned

Answer optiond

Marks: 2

What is the output of this program?

import java.net.*;
class networking
{
public static void main(String[] args) throws
Exceptio
{
1087 URL obj = new
URL("https://www.sanfoundry.com/java
URLConnection obj1 = obj.openConnection();
System.out.print(obj1.getLastModified);
}
}

Note: Host URL was last modified on june 18 tuesday 2018 .

A. july

B. 18-6-2013

C. Tue 18 Jun 2013

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
n

mcq")

D. Tue Jun 18 2018

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiond

Marks: 2

In Uniform Resource Locator (URL), path is pathname of file where


1088 info

A. Stored

B. Located

C. to be transferred

D. Transferred

Answer optionb

Marks: 1

The class ________is used for accessing the attributes of remote


1089 resou

A. URI

B. URLConnection

C. URL

D. URLLoader

Answer optionb

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
1090 How many forms of constructors URL class have?

A. 1

B. 2

C. 3

D. 4

Answer optionc

Marks: 1

1091 How many forms of constructors URLConnection class have?

A. 1

B. 2

C. 3

D. none of the above

Answer optiond

Marks: 1

1092 openConnection() method present in which class?

A. URL

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. URLConnection

C. InetAddress

D. HTTPURLConnection

Answer optiona

Marks: 1

1093 getContentType() method present in which class?

A. URL

B. URLDecoder

C. URLConnection

D. none of the above

Answer optionc

Marks: 1

1094 getContentLength() method present in which class?

A. URL

B. URLConnection

C. URLDecoder

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. URLNotFoundException

Answer optionb

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

1095 Which of these classes can be added to a Frame component ?

A. Component

B. Window

C. Button

D. Applet

Answer optionc

Marks: 1

1096 getDate() method present in which class?

A. URL

B. URLDecoder

C. URLConnection

D. All of the mentioned

Answer optionc

Marks: 1

Which of the following method of Applet class execute only


1097 onc

A. stop()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
e ?

B. paint()

C. start()

D. init()

Answer optiond

Marks: 1

1098 getConnectionTimeout() method present in which class?

A. URL

B. URLDecoder

C. URLConnection

D. URLNotFoundException

Answer optionc

Marks: 1

1099 getProtocol() method present in which class?

A. URL

B. URLDecoder

C. URLConnection

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. none of the above

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona

Marks: 1

___________method of DatagramPacket is used to find the port


1100 n

A. port()

B. GetPort()

C. getPort()

D. findPort()

Answer optionb

Marks: 1

1101 getInetAddress( ) method present in which class?

A. URL

B. Socket

C. ServerSocket

D. none of the above

Answer optionb

Marks: 1

1102 getLocalPort( )method present in which class?

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
umber.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. Socket

B. URLDecoder

C. URLConnection

D. URLNotFoundException

Answer optiona

Marks: 1

1103 getQuery() method present in which class?

A. URL

B. URLDecoder

C. URLConnection

D. none of the above

Answer optiona

Marks: 2

1104 getRef() method present in which class?

A. URLNotFound

B. URLDecoder

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. URLConnection

D. URL

Answer optiond

Marks: 1

1105 getPath() method present in which class?

A. URL

B. URLDecoder

C. URLConnection

D. none of the above

Answer optiona

Marks: 1

1106 URLConnection class present in which package?

A. url

B. urlconnection

C. URL

D. .net

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiond

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
1107 getExpiration( ) method present in which class?
C. addMenuItem()

A. URL
D. setItem()

B. URLDecoder
Answer optiona

C. URLConnection
Marks: 1
none of the above
D. ----------------------method is used to add the menubar to
1110 the
Answer optionc
A. setMenu()

Marks: 1
B. setMenuBar()
To create menus on the container which of the following classes
1108 us
C. addMenuBar()

A. Menu
D. All of the above

B. MenuBar
Answer optionb

C. MenuItem
Marks: 1

D. All of the above


Which of the following components allow multiple selections?
1111 A. Checkbox B.Radio buttons C.Choice D.List
Answer optiond

A. A and B
Marks: 1

B. B and C
1109 ---------------------method is used to add the menu items to m

C. C and D
A. add()

D. A and D
B. addComponent();

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
enus.
Answer optiond frame.

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1

1112 _____ is immediate super class of Menu class.

A. MenuBar

B. MenuItem

C. MenuComponent

D. Object

Answer optionb

Marks: 1

Which of the following creates a List with 5 visible items and


1113 multipl enabled?

A. new List(5,true)

B. new List(true,5)

C. new List(5,false)

D. new List(false,5)

Answer optiona

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Which of the following may a menu contain?
A) separator
1114 B) check box
C) menu item

D) panel

A. A and B

B. B and C

C. A and D

D. A and C

Answer optiond

Marks: 1

1115 How could you set the frame surface color to pink ?

A. s.setBackground(Color.pink);

B. s.setColor(PINK);

C. s.Background(pink);

D. s.color=Color.pink

Answer optiona

Marks: 1

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
which of the following method is used to retrieve whether checkbox
1116 is

A. getState()

B. getLabel()

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. setState()

D. setLabel()

Answer optiona

Marks: 1

Which of the following statements are true? A)


A Dialog can have a MenuBar.
1117 B) Menu extends MenuItem
C) A MenuItem can be added to a Menu.
D) A Menu can be added to a Menu.

A. A and B

B. B and C

C. A and D

D. C and D

Answer optionb

Marks: 1

write output of
following import
java.net.*; class
networking16 {

public static void main(String[] args) throws


1118 MalformedURLExce
URL obj = new URL("http://www.sanfoundry.com/javam
System.out.print(obj.toExternalForm());

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. sanfoundry

B. sanfoundry.com

C. www.sanfoundry.com

D. http://www.sanfoundry.com/javamcq

Answer optiond

Marks: 2

cq");

Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material

You might also like