java mcq
java mcq
A. WindowAdapter
B. KeyAdapter
C. MouseAdapter
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;
A.
B.
C.
D.
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionc
Marks: 2
A. KeyListernerAdapter
B. KeyAdapter
C. Adapter
D. None
Answer optionb
Marks: 1
f.addWindowListener(new _____________
{
6 public void windowClosing(WindowEvent e)
{
System.exit(0);
}
________
A. } 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
A. Focusevent, Focusadapter
B. FocusAdapter, Event
C. FocusAdapter, FocusEvent
D. Adapter, FocusEvent
Answer optionc
Marks: 2
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
A. Class
B. Method
C. Package
D. Listener
Answer optiond
Marks: 1
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
A. solve
B. simplify
C. avoid
D. create
Answer optionb
Marks: 1
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
A. InputEvent
B. ContainerEvent
C. TextEvent
D. WindowEvent
Answer optionb
Marks: 1
A. pluggable
B. simple
C. empty
D. Interface
Answer optionc
Marks: 1
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
A. windowActivated()
B. windowClosed()
C. windowClosing()
D. windowIconified()
Answer optiond
Marks: 1
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
A. Yes
B. No
C. Sometimes
Answer optiona
Marks: 1
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
A. Applet
B. ComponentEvent
C. Event
D. InputEvent
Answer optiona
Marks: 1
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
Answer optionc
Marks: 1
A. True
B. False
C. Sometimes
D. Never
Answer optiona
Marks: 1
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
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
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
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
A. FocusListener
B. FocusAdapter
C. AdapterFocus
D. AdapterListerner
Answer optionb
Marks: 1
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
Answer optiond
Marks: 1
A. COMPONENT_HIDDEN
B. COMPONENT_ICONIFIED
C. COMPONENT_MOVED
D. COMPONENT_SHOWN
Answer optionb
Marks: 1
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. Inner Class
B. Simple Class
C. Adapter Class
D. Inherited Class
Answer optionc
Marks: 1
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
Answer optiond
Marks: 1
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
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
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
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
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
A. FocusEvent
B. InputEvent
C. WindowEvent
D. TextEvent
Answer optionb
Marks: 1
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
A. Code Extension
B. Code Inheritance
C. Code Optimization
D. Code Development
Answer optionc
Marks: 1
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
A. Inner Class
B. Inherited Class
C. Nested Interfaces
D. Static Class
Answer optiona
Marks: 1
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
A. getParent( )
B. get( )
C. getTime( )
D. getChild( )
Answer optiond
Marks: 1
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
A. TextEvent
B. ItemEvent
C. InputEvent
D. ActionEvent
Answer optiond
Marks: 1
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
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
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
B. BLOCK_DECREMENT, BLOCK_INCREMENT,TRACK
D. UNIT_INCREMENT,UNIT_DECREMENT,SHIFT
Answer optionb
Marks: 1
A. ->(arrow)
B. .(dot)
C. * (asterisk)
D. &(ampersand)
Answer optionb
Marks: 1
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
A. event class
B. class
C. adapter classes
D. inner classes
Answer optiond
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
C. to develop more readable and maintainable code
D. all of these
Answer optiond
Marks: 1
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();
}
}
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.
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
D. static class
Answer optionc
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 2
A. host name
C. interface
A. local host
D. B. remote package
host
73 The getByName()
Answer optionc method returns an ________________ with host n
A. IP address
Marks: 1
C. port number
A. getModifiers( )
D. IPv4
B. getAdjustable( )
Answer optiona
C. Modifiers( )
Marks: 1
D. Adjustable( )
A. host names
Marks: 1
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
B. iPAddress/Host name
C. IPAddress
D. Host name
Answer optiona
Marks: 2
A. ParameterizedStatement
B. PreparedStatement
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
Answer optiond
Marks: 1
A. PreparedStatement
B. ParameterizedStatement
C. CallableStatement
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
Marks: The meaning depends on the type of data source, and the type an
D. 1
versi you use with this data source
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
Answer optiona
Marks: 1
A. Regular Statement
B. Prepared Statement
C. Callable Statement
D. Interim Statement
Answer optiond
Marks: 1
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
A. executeQuery()
B. executeUpdate()
C. getConnection()
D. prepareCall()
Answer optionc
Marks: 1
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
A. execute()
B. executeQuery()
C. executeUpdate()
D. executeResult()
Answer optionc
Marks: 1
A. No
B. Yes
C. Statement is incorrect
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
Answer optiona
Marks: 1
Answer optiond
Marks: 1
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
Answer optiona
Marks: 1
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
A. fetch method
B. current method
C. next method
D. access method
Answer optionc
Marks: 1
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
A. getNumberOfColumn()
B. getMaxColumn()
C. getColumnCount()
D. getColumns()
Answer optionc
Marks: 1
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
D. none of these
Answer optionc
Marks: 1
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
Answer optiond
Marks: 1
A. int
B. ResultSet
C. boolean
D. void
Answer optionc
Marks: 1
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();
Answer optionc
Marks: 2
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
A. statement.getImage()
B. statement.getDouble()
C. statement.getBLOB()
D. statement.getIcon()
Answer optionc
Marks: 1
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
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);}
}
}
Answer optionb
Marks: 2
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
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();
}
}
Answer optiona
Marks: 2
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
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
A. JButton,JList,JMenuItem
B. JButton Only
C. JScrollbar
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
A. Constructor
B. Layout manager
C. Parameter
D. GUI
Answer optiona
Marks: 2
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
A. Inches
B. Centimetres
C. Dots
D. Pixels
Answer optiond
Marks: 1
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
A. javax.sql.*
B. java.mysql.*
C. java.sql.*
D. com.*
Answer optionc
Marks: 1
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
Answer optionb
Marks: 1
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
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
A. Interpreted Statements
B. Exceuted statements
C. Resultset statements
D. precompile Statement
Answer optiond
Marks: 1
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-
A. Type 1 Driver
B. Type 2 Driver
C. Type 3 Driver
D. Type 4 Driver
Answer optionc
Marks: 1
A. show( )
B. setVisible( )
C. showFrame( )
D. displayFrame( )
Answer optionb
Marks: 1
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
A. ResultSet
B. Connection
C. Statement
D. Result
Answer optiona
Marks: 1
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
A. getByAddress()
B. getHostName()
C. getAddress()
D. getIPAddress()
Answer optiona
Marks: 1
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionc
Marks: 1
A. DriverManager.getConnection()
B. DataSource.Connection()
Answer optiona
Marks: 1
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
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
Answer optiond
Marks: 2
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
public static void main(
o studen
to
stude t
i=stmt
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
Answer optiona
Marks: 2
Answer optionc
Marks: 1
e URL
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. protocol in URL string is always jdbc
Answer optionc
Marks: 1
A. AbstractButton
B. ButtonGroup
C. JButton
D. Button
Answer optionb
Marks: 1
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
A. putConnection()
B. setConnection()
C. Connection()
D. getConnection()
Answer optiond
Marks: 1
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
B. Time consuming
C. both a& b
Answer optionc
Marks: 1
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. JDBC API, Native API calls
Answer optionb
Marks: 1
A. openConnection()
B. getConnection()
C. connect()
D. createConnection()
Answer optionb
Marks: 1
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
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
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
Answer optionb
Marks: 1
A. Database name
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
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
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.
Answer optiona
Marks: 1
Answer optiond
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
Answer optionb
Marks: 1
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
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
Answer optionc
Marks: 2
Answer optiond
Marks: 1
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
D. Native protocol / all-java driver
Answer optiona
Marks: 1
Answer optiona
Marks: 1
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
Answer optionb
Marks: 1
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>.
C. . Does nothing
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>.
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
A. AbstractButton
B. ButtonGroup
C. JButton
D. Button
Answer optionb
Marks: 1
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
A. getContent()
B. getContentPane()
C. Both A & B
D. getContainedPane()
Answer optionb
Marks: 1
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
Answer optionc
Marks: 1
A. AWT
B. Networking
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. Swing
Answer optionc
Marks: 1
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
Answer optionc
Marks: 1
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
Answer optiond
Marks: 2
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
Answer optiond
Marks: 1
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
A. Result
B. Connection
C. Query
D. Both A and B
Answer optionb
Marks: 1
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. button
B. Editable Text
C. Non-Editable Text
D. All of above
Answer optionc
Marks: 1
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);
}
}
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
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
A. Right-Justified
Marks: 1
C. setText(String strLabel)
A. Center-Justifed
D. B. All of getText()
above
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
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
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
l. s
A. A is True But B is False
achines
ine. B
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. Both are False
Answer optiond
Marks: 1
A. Buttons,Scrollbar
B. Label,TabbedPanes
C. Tress,Tables
D. All of above
Answer optiona
Marks: 1
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionb
Marks: 1
A. isMulticastHostName()
B. isMulticastHostAddress()
C. isMulticastAddress()
D. isMulticastIPAddress()
Answer optionc
Marks: 1
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
A. false
B.port number
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
A. www.google.com
B. www.google.com/217.196.214.99
C. 217.196.214.99
Answer optiona
Marks: 2
You can simply use InetAddress class when working with IP addre
205 beca accommodate both ___________ styles.
ion
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. A and B
Answer optionb
Marks: 1
Answer optionc
Marks: 1
Answer optiona
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1
There are two kinds of sockets in java one is for server and other
A.
for
Answer optiona
Marks: 1
A. httpserver
B. ServerSocket
C. DatagramSocket
D. Socket
Answer optionb
Marks: 1
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. The system exits gracefully with appropriate message
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
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Socket (Inetaddress ipAdd, int port )
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionb
Marks: 1
A. int getLocalHost()
B. int getLocalPort()
C. int getPort()
D. int GetLocalHost()
Answer optiona
Marks: 1
C. string getHostName()
D. A and B
Answer optiond
Marks: 1
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
A. ServerSocket(int port)
Answer optiona
Marks: 1
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
A. getByName()
B. GetLocalHost()
C. getByAddress()
D. both A & C
Answer optiond
Marks: 1
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
A. bind()
B. connect()
C. accept()
D. SetHostName()
Answer optionb
Marks: 1
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
A. isbind()
B. bind()
C. bind To()
Answer optiond
Marks: 1
D. Waiting socket
Answer optiona
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1
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
Answer optionb
Marks: 1
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
A. ServerSocket(int port)
Answer optiond
Marks: 1
B. 1349
C. local port
Answer optionb
Marks: 1
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
class
A. Serversocket
B. ClientSocket
C. Socket
Answer optionc
Marks: 1
A. Socket
B. ServerSocket
C. ClientSocket
Answer optiona
Marks: 1
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
A. send()
B. wait()
C. connect()
D. close()
Answer optiond
Marks: 1
A. an exception is thrown
B. an IOException is thrown
D. UnknownHostException is thrown
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionc
Marks: 1
Answer optiona
Marks: 1
Answer optiond
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1
B. 1234
C. local port
Answer optiona
Marks: 2
A. 1234
B. iPAddress of serversocket
Answer optionc
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1
Answer optionb
Marks: 1
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()
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
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
D. B & C
Answer optionc
Marks: 1
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
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)
Answer optiond
Marks: 1
A. httpserver
B. Datagram Socket
C. Socket
D. ClientSocket
Answer optionc
Marks: 1
A. 1349
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
A. byte[] getAddress()
B. string getHostName()
C. A and B
Answer optionc
Marks: 1
A. DatagramSocket(int port)
C. DatagramSoclet()
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
Answer optiona
Marks: 1
A. UnknownException
B. SocketException
C. UnknownSocketException
D. UnknownPortException
Answer optionb
Marks: 1
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
Answer optionb
Marks: 1
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
Answer optionc
Marks: 1
D. A and B
Answer optiond
Marks: 1
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
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);
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);
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
Answer optionb
Marks: 2
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); );
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
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
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
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
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); }
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
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
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Anonymous inner class to h
null)jtf.setTe
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
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
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 :
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
Connection conn =
A.
DriverManager.getConnection(jdbc:mysql://localhost:3306/booksdb,user,p
Connection conn =
C.
DriverManager.getConnection(jdbc:odbc:mysql://localhost:3306/booksdb,u
Answer optiona
Marks: 1
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
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
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
A. paint( )
B. repaint( )
C. draw( )
D. redraw( )
Answer optiona
Marks: 1
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
A. a , b and c
B. a , c and d
C. b,c and d
D. a, b and d
Answer optiond
Marks: 1
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
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
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
Answer optiona
Marks: 1
A. error
B. No Error
Answer optionb
Marks: 2
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()
Answer optiond
Marks: 1
public BgColor()
284
{
red = new JButton("red");
red.addActionListener(this);
add(red);
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);
}
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.
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(
D. bg.add(b1);
Answer optiona
Marks: 2
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
Answer optiond
Marks: 2
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?
Answer optiona
Marks: 1
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
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); } }
Answer optiona
Marks: 2
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
A. Graphics
B. Component
C. Applet
D. Container
Answer optionb
Marks: 1
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
contentPane.add(jtf);
}
}
B. jtf = JTextField(15);
C. Both A & B
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
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());
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
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
Answer optiond
Marks: 1
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
Answer optionb
Marks: 2
A. int
B. connection
C. ResultSet
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
A. java.io
B. java.util
C. java.net
D. java.network
Answer optionc
Marks: 1
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
A. Button
B. Checkbox
C. CheckboxGroup
D. List
Answer optionc
Marks: 1
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
A. TextArea
B. Button
C. Label
D. Checkbox
Answer optiona
Marks: 1
A. TextArea(String str)
D. All of above
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiond
Marks: 1
A. TCP/IP
B. DNS
C. Socket
D. Proxy Server
Answer optiona
Marks: 1
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
A. List()
B. List(int numRows)
D. None of these
Answer optionc
Marks: 1
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
A. getSelectedIndex()
B. getSelectedIndexes()
C. getSelectedItem()
D. getSelectedItems()
Answer optiona
Marks: 1
A. GUI 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
318
A. 8
B. 16
C. 32
D. 64
Answer optionc
Marks: 1
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. Both (a) and (c)
Answer optiond
Marks: 1
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
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
();
Answer optiona
Marks: 2
A. display()
B. print()
C. drawString()
D. String()
Answer optionc
Marks: 1
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. JPanel
B. JButton
C. JFrame
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
Marks: 2
A. CREATE TABLE STUDENT VALUES (ROLLNO 1, STUDNAME "ABC",MARKS 90
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.
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
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
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
A. Container
B. LayoutManger
C. Color
D. Font
Answer optiona
Marks: 1
Answer optionc
Marks: 1
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).
Answer optionb
Marks: 2
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
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
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
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);
}
}
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
webpage?
A.
Answer optionc
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1
A. frame.setVisible(true);
B. frame.setVisible(False);
C. Both A & B
Answer optiona
Marks: 2
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
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
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.
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D.
Answer optiond
Marks: 2
A. update( )
B. paint( )
C. repaint( )
D. reupdate( )
Answer optionb
Marks: 1
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
Butt
B. setLayout (new borderLayout(4,1)); Butt
Answer optiona
Marks: 2
A. update( )
B. paint( )
C. repaint( )
D. reupdate()
Answer optionc
Marks: 1
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
add(b1);add(b2);add(b3); } }
Answer optionb
Marks: 2
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
A. Tabpane
B. Table
C. Scrollpane
Answer optionb
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1
A. paint( )
B. drawstring( )
C. draw( )
D. convert( )
Answer optionb
Marks: 1
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
A.
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B.
C.
D.
Answer optiond
Marks: 1
Answer optiond
Marks: 1
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
Answer optionc
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 2
A. WIDTH=pixels
B. HSPACE=pixels
C. HWIDTH=pixels
D. HBLANK=pixels
Answer optiona
Marks: 1
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
Answer optionc
Marks: 2
A. java.awt.Container
B. java.awt.Component
C. java.awt.Panel
D. java.awt.Layout
Answer optionb
Marks: 1
A. Graphics class
B. Component class
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. Both A & B
Answer optionb
Marks: 1
A. IBMServer
B. SQLServer
C. ReserverSockets
D. Proxy server
Answer optiond
Marks: 1
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
Answer optionc
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
C. Model View Controller
Answer optionc
Marks: 1
A. ContentType()
B. Contenttype()
C. GetContentType()
D. getContentType()
Answer optiond
Marks: 1
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
A. FTP
B. Telnet
C. SMTP
D. HTTP
Answer optionc
Marks: 1
A. Container
B. AWT
C. Both
D. None
Answer optiona
Marks: 1
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. int columnIndex
B. int row
C. Both
Answer optiona
Marks: 1
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
D. jp.addTab()
Answer optionb
Marks: 2
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?
B. Performs routing
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
A. . insert( Component c )
B. add( Component c )
C. draw( Component c )
D. click( Component c )
Answer optionb
Marks: 1
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
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
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
String
column[]={"ID","NAME","
String data[][
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
A. FTP
B. Telnet
C. e-mail
D. HTTP
Answer optiona
Marks: 1
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
TabbedPan
e
tp.add(
TabbedPaneExample(); }}
Answer optionb
Marks: 2
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
Answer optiond
Marks: 1
A. setIcon()
B. getText()
C. setLabel()
D. setBorderLayout()
Answer optiond
Marks: 1
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
Answer optiond
Marks: 1
arranges GUI components into layers such that only one layer is
A.
visibl
C. extends JComponent
Answer optiond
Marks: 1
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;
// 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");
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
___________________
A. m1 = new JMenuItem("MenuItem1");
B. x.add(m1);
C. f.setVisible(true);
D. mb.add(x);
Answer optiond
Marks: 1
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
Answer optiond
Marks: 1
A. addMenus()
B. setMenu()
C. setJMenuBar()
D. addJMenuBar()
Answer optionc
Marks: 1
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.*;
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
Answer optionb
Marks: 2
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. None of above
Answer optiona
Marks: 1
A. Client-side programming
B. Server-side programming
D. web programming
Answer optionb
Marks: 1
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
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
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
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
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
C. Both A and B
Answer optiona
Marks: 1
Answer optionb
Marks: 2
416 Which models do the JDBC API support for the database access?
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Three Tier Model
C. Both A and B
Answer optionc
Marks: 2
Answer optiona
Marks: 1
" ");
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. All mentioned above
Answer optiona
Marks: 2
Answer optionc
Marks: 2
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
C. Both A and B
Answer optiona
Marks: 2
Answer optionc
Marks: 2
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
A. .executeUpdate()
B. executeQuery()
C. execute()
D. noexecute()
Answer optionc
Marks: 2
A. Statement Interface
B. PreparedStatement interface
C. ResultSet Interface
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
Answer optiona
Marks: 1
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
cern?
Answer optiond
Marks: 1
A. Type 4
B. Type 3
C. Type 2
D. Type 1
Answer optiona
Marks: 1
A. Three tiered
B. Multithreaded
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionb
Marks: 1
A. Type-4 driver
B. Type-1 driver
C. Type-2 driver
D. Type-3 driver
Answer optiona
Marks: 1
A. Statement
B. Connection
C. ResultSet
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
A. Grid Layout
B. Card Layout
C. Border Layout
D. Flow Layout
Answer optiond
Marks: 1
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
A. setLayoutManager(new GridLayout());
B. setLayout(new GridLayout(2,2));
C. setGridLayout(2,2);
D. setBorderLayout();
Answer optionb
Marks: 1
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
A. Window
B. Frame
C. Dialog
Answer optiond
Marks: 1
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
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
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
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
A. Window
B. Panel
C. Applet
D. Frame
Answer optionb
Marks: 1
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
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. Panel p=new Panel();
Answer optionb
Marks: 2
A. Layout Manager
B. addComponent();
C. add()
D. Both a and b
Answer optiona
Marks: 1
C. Both a and b
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
A. rollback()
B. rollforward()
C. deleteTransaction()
D. RemoveTransaction()
Answer optiona
Marks: 2
B. When the user name, password and the database does not match
Answer optionc
Marks: 2
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
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
A. HttpServlet
B. GenericServlet
C. HttpSessionEvent
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
D. Type 4 only
Answer optionc
Marks: 2
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
A. List
B. Choice
C. Button
D. TextArea
Answer optiona
Marks: 1
A. List
B. Choice
C. Checkbox
D. CheckboxGroup
Answer optiond
Marks: 1
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
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
D. All of above
Answer optiond
Marks: 2
Answer optionb
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 2
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, ................
D. None of Above
Answer optionb
Marks: 1
A. JButton
B. JApplet
C. AbstractButton
D. JLabel
Answer optionb
Marks: 1
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
A. JButton
B. JApplet
C. AbstractButton
D. None of these
Answer optionb
Marks: 1
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
------
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();
D. setLayout(Obj);
Answer optionb
Marks: 1
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
A. Pressing a button
Answer optiond
Marks: 1
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona
Marks: 1
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 {
Container cp = getContentPane();
483
-------------------------------
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.
Answer optiond
Marks: 2
A. ContainerEvent
B. ComponentEvent
C. WindowEvent
D. EventObject
Answer optiond
Marks: 1
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
cp.setLayout
( .
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.
Marks: 2
B. META_MASK
Answer optiond
A. TextArea,Label,Button
Marks: 1
B. Label,Choice,Button
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
Select proper output for
public
following.. import java.awt.*;
{
import java.applet.*; class list
extends Applet
}}
/*<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
A. getText()
B. setText()
C. getSelectedText()
D. setEditable(false)
Answer optiond
Marks: 1
A. Checkbox(String label)
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Checkbox(String label,boolean state)
D. All of Above
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiond
Marks: 1
A. getSelectedIndex()
B. getSelectedIndexes()
C. getSelectedItem()
D. All of Above
Answer optiond
Marks: 1
A. getItem()
B. getSelectedIndexes()
C. getSelectedItem()
D. All of Above
Answer optionb
Marks: 1
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
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
A. select()
B. isEditable()
C. getText()
D. All of above
Answer optiond
Marks: 1
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
Answer optionc
Marks: 1
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 ?
C. 12.l.add("c",true);
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
B. add(b1);
C. lb.add("Python");
D. None of above
Answer optionc
Marks: 2
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
{
D. add(t1);add(t2);
Answer optionb
Marks: 2
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
Answer optiond
A. Heavyweight
Marks: 1
B. Elements
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
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);
A.
B.
C.
Answer optionc
Marks: 2
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. HttpServlet
B. Cookie
C. HttpSessionEvent
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)
Answer optionb
Marks: 1
A. sendRedirect()
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. sendError()
C. Redirect()
Answer optiona
Marks: 1
A. setAttribute() only
B. getAttribute() only
C. Both A and B
Answer optionc
Marks: 1
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
A. getHeaderNames()
B. getNames()
C. getHeader()
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()
Answer optiona
Marks: 1
A. isRequestedSessionIdFromCookie( )
B. getHeader(String field )
C. getMethodI( )
D. addCookie(Cookie cookie)
Answer optiond
Marks: 1
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
A. encodeRedirectURL(String url)
C. encode(String url)
Answer optionb
Marks: 1
l.
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. boolean containsHeader()
Answer optionb
Marks: 1
A. IP Address
B. Protocol
C. URL
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( )
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionb
Marks: 1
A. SessionBindingListener
B. HttpSessionBindingListener
C. HttpBindingListener
D. HttpListener
Answer optionb
Marks: 1
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
Answer optiond
Marks: 1
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
A. GenericServlet
B. Servlet
C. Throwable
Answer optiona
Marks: 1
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
A. getLastModified()
B. service()
C. init()
Answer optiond
Marks: 1
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
A. getName()
B. getName(String s)
C. getName(String s,String a)
Answer optiona
Marks: 1
A. getName()
B. getSession()
C. getSessionName()
D. putSession()
Answer optionb
Marks: 1
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. doDelete()
B. doGet()
C. doHead()
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();
}
}
B. javax.servlet.*; is missing
C. Both A and B
Answer optionc
Marks: 2
A. Socket
B. ServerSocket
C. Both A and B
Answer optionc
ing?
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1
A. servlet
B. session
C. cookie
D. none of above
Answer optiona
Marks: 1
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
Answer optionb
Marks: 1
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
A. array
B. enum
C. object
Answer optiona
Marks: 1
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()
false
Answer optionc
Marks: 1
A. isRequestedSessionFromCookie()
B. isRequestedFromCookie()
C. isRequestedSessionCookie()
Answer optiona
Marks: 1
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
A. sendRedirect(String url)
B. Redirect(String url)
C. sendError(String url)
Answer optiona
Marks: 1
552 ____ method adds field to the header with date value equal to
Answer optiona
Marks: 1
553 Which method sets status code for this response to 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()
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()
Answer optionb
Marks: 1
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
void destroy(HttpRequest req,HttpServletResponse res) throws
C.
IOExcepti ServletException
Answer optiona
Marks: 1
Answer optionb
Marks: 1
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
B. void removeAttribute()
D. void remove()
Answer optiona
Marks: 1
A. getAttribute()
B. setAttribute()
C. setHeader()
D. isNew()
Answer optionc
Marks: 1
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
Answer optiond
Marks: 1
A. Cookie() 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
D. Never
Answer optionc
Marks: 1
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
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
A. IOException only
B. ServletException only
C. IllegalstateException only
Answer optiond
Marks: 1
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?
Answer optionb
Marks: 1
A. doPut() only
B. doHead() only
C. doTrace()
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
A. session
B. cookie
C. URL
D. request
Answer optionc
Marks: 1
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()
Answer optiona
Marks: 1
A. String getPathInfo()
B. String getPath()
C. String getMethod()
Answer optiona
Marks: 1
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. Cookie[] getCookies()
B. Cookie[] getMaxCookies()
C. Cookie[] getMinCookies()
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()
D. None of these
Answer optionc
Marks: 1
A. String getRemoteUser()
B. String getUser()
C. String getRemote()
D. None of these
Answer optiona
Marks: 1
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
field?
uest.
A. void addCookie()
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
A. setStatus()
B. setStatus(int code)
C. setStatusCode(int code)
Answer optionb
Marks: 1
A. Client-side programming
B. Server-side programming
D. web programming
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionb
Marks: 1
A. Telnet
B. TCP
C. FTP
D. hit
Answer optiond
Marks: 1
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
Answer optiond
Marks: 1
A. Window
B. Frame
C. Panel
D. applet
Answer optiona
Marks: 1
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
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
Answer optiona
Marks: 1
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. server
B. client
C. thread
D. concurrent
Answer optionb
Marks: 1
A. Speed
B. Efficient
C. Security
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
Answer optionc
Marks: 1
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?
Answer optionc
Marks: 1
A. execute()
B. executeQuery()
C. executeUpdate()
Answer optionc
Marks: 1
A. Class.forName()
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. class.forname()
C. Connection con
Answer optiona
Marks: 1
A. Cookie
B. Web Server
C. FTP
D. DATABASE
Answer optiona
Marks: 1
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
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
Answer optionb
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1
A. UDP
B. TCP/IP
C. Proxy server
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); } } }
Answer optionb
Marks: 2
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
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona
Marks: 1
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
Answer optionc
Marks: 1
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
Answer optiona
Marks: 2
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
A. execute()
B. executeQuery()
C. executeUpdate()
D. getResultSet()
Answer optionc
Marks: 2
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
Answer optiona
Marks: 1
Answer optionb
Marks: 1
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__
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 ______
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. The name and expiration date of the cookie only
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. The name of 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 ?
Answer optionb
D. Type 4
Marks: 1
Answer optionc
The Elements Of Flow Layouts are arranged in ---------------
622
Marks: 1-
Answer optionc
D. Type 4
Marks: 1
Answer optionc
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
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
Answer optionb
Marks: 1
A. destroy()
B. service()
C. init()
D. connect()
Answer optionc
Marks: 1
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
A. next()
B. previous()
C. beforefirst()
D. afterLast()
Answer optiona
Marks: 1
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.
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. public void setMaxAge(String 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()
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
A. Cookie getcookies()
Answer optionc
Marks: 1
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
B. It is a container object.
C. It is a component object.
Answer optiona
Marks: 1
B. access name
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. Both of the above.
Answer optiona
Marks: 2
A. Client-Tier
B. Middle_Tier
Answer optiond
Marks: 2
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona
Marks: 1
A. Type 1
B. Type 2
C. Type 3
D. Type 4
Answer optionc
Marks: 1
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
Answer optionb
Marks: 1
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
A. servlet context
B. servlet container
C. servletconfig
Answer optionb
Marks: 1
Answer optiona
Marks: 1
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
Answer optionb
Marks: 1
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
Answer optiona
Marks: 1
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
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
A. RowLayout
B. ColumnLayout
C. GridBagLayout
Answer optionc
Marks: 1
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
A. Session Tracking
B. Cookie tracking
C. HttpServletState
D. Session
Answer optiona
Marks: 1
A. Servlet
B. Servlet Config
C. ServletContext
D. ServletResponse
Answer optiona
Marks: 1
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
A. SingleThreadModel
B. ServletRequest
C. ServletConfig
D. ServletContext
Answer optionc
Marks: 1
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
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
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);
}
}
Answer optionb
Marks: 2
A. HttpServletResponse
B. HttpServletRequest
C. HttpServlet
D. GenericServlet
Answer optionb
Marks: 1
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
A. JComboBox( )
B. JComboBox(Vector v)
C. JComboBox(Vector v,Vector v)
D. both a & b
Answer optiond
Marks: 1
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. getSessionCreate( )
B. setSession( )
C. setsession( )
D. getSession( )
Answer optiond
Marks: 1
A. JProgressBar
B. ProgressMonitor
C. ProgressMonitorInputStream
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
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_____
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
.
Answer optiona
Marks: 1
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
A. doGet()
B. doPost( )
C. doPut()
D. doHead()
Answer optionb
Marks: 1
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
A. HTTP POST
B. HTTP SET
C. HTTP TRACE
D. HTTP GET
Answer optiond
Marks: 1
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
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
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
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
A. LEFT
B. CENTER
C. RIGHT
D. JUSTIFY
Answer optionb
Marks: 1
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
A. 0 Pixel
B. 1 Pixel
C. 5 Pixels
D. 10 Pixels
Answer optiona
Marks: 1
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
A. value
B. context
C. enumeration
D. None of these
Answer optionb
Marks: 1
A. ServletContextgetServletContext()
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
A. ServletContext
B. ServletConfig
C. ServletRequest
D. ServletResponse
Answer optiona
Marks: 1
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()
Answer optiona
Marks: 1
A. String getRemoteHost()
B. String getRemoteAddr()
C. String getProtocol()
D. None of these
Answer optiona
Marks: 1
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
gram?
A. import.java.util.*;
B. import javax.servlet.http.*;
C. import java.awt.*;
D. None of these
Answer optiona
Marks: 2
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
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
A. destroy()
B. service()
C. init()
D. none of above
Answer optiond
Marks: 1
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
Answer optiona
Marks: 1
A. IllegalArgumentException
B. ClassNotFoundExceptin
C. ServletException
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 )
C. void log()
Answer optiond
Marks: 1
B. Enumeration getInitParameterNames()
C. Enumeration getServletNames()
D. None of these
Answer optionc
Marks: 1
A. String getServerInfo()
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. String getMimeType(String File)
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. int getContentLength()
Answer optionc
Marks: 1
A. SingleThreadModel
B. UnithreadModel
C. ThreadModel
D. None of These
Answer optiona
Marks: 1
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
A. Servlet InputStream
B. GenericServlet
C. ServletException
D. Servlet OutputStream
Answer optionb
Marks: 1
A. GenericServlet Class
lasses.
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Servlet OutputStream Class
D. None of These
Answer optiona
Marks: 1
A. ServletConfig
B. servletContext
C. Both A and B
Answer optiona
Marks: 1
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
A. ServletConfig
B. ServletContext
C. ServletRequest
D. None of these
Answer optiona
Marks: 1
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
A. ServletConfig
B. ServletContext
C. ServletRequest
D. None of these
Answer optionb
Marks: 1
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?
B. SinglethreadModel Interface
C. ServletResponse Interface
D. None of These
Answer optiona
Marks: 1
Answer optionb
Marks: 1
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
A. ServletResponse
B. ServletRequest
C. SingleThreadModel
D. ServletConfig
Answer optionc
Marks: 1
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
D. Only one
Answer optiond
Marks: 1
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
A. OS shell
B. JVM
C. Separate thread
D. JRE
Answer optionc
Marks: 1
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......
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
state)
Answer optiona
Marks: 1
Answer optionb
Marks: 1
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
Answer optionb
Marks: 1
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
};
Answer optionc
Marks: 2
A. Negative, Positive
B. Positive
C. Zero
D. Negative
Answer optiond
Marks: 1
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
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
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
{
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.
D. All of above
Answer optiond
Marks: 1
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.*;
A. str+=FontList[i]+ "";
B. String FontList[];
C. For(int i=0;i<fontlist.length;i++)
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
Answer optiona
Marks: 1
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
Answer optiona
Marks: 2
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
A. netnews
B. finger
C. e-mail
Answer optiond
Marks: 1
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
A. String getAuthType( )
B. Cookie[ ] getCookies( )
C. Both A and B
D. Neither A nor B
Answer optionc
Marks: 1
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
package jprogressbardemo;
import java.awt.*;
import
javax.swing.*;
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. } getId( )
String
}
B.
A. void invalidate( )
C. long getLastAccessedTime( )
B.
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiond
age());
rface.
Marks: 1
Answer optionc
Marks: 2
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
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
Answer optionb
Marks: 2
A.
B.
C.
D.
Answer optiona
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 2
A.
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B.
C.
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) {
B.
C.
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);
}
}
Answer optionb
Marks: 2
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. Data Name Service
Answer optionc
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.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
compone
nts are
all
ulti
A. Model-Based
B. component-based framework
C. Relational Based
Answer optionb
Marks: 1
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
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);
}
});
}
}
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)
Answer optiond
Marks: 1
A. JTable()
C. Both A & B
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(); }}
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
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.
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
A Scrollbar is handles not its own events and perform its own
C.
Scrollpane handles not its own events and perform its own scr
Answer optionb
Marks: 1
Answer optiona
Marks: 1
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);
Answer optionb
Marks: 2
);
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A.
B.
C.
Answer optionc
Marks: 2
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
Answer optiond
Marks: 1
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
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 {
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
A. gridwidth, gridheight
B. gridx, gridy
C. ipadx, ipady
D. insets
Answer optiond
Marks: 1
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
A. gridwidth, gridheight
B. gridx, gridy
C. ipadx, ipady
D. insets
Answer optiona
Marks: 1
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
A. constructors
B. methods
C. classes
D. destructors
Answer optionc
Marks: 1
A. WINDOW_CLOSING
C. windowClosing(WindowEvent we)
D. setDefaultCloseOperation()
Answer optiond
Marks: 1
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);
add(b2); } }
Answer optiond
Marks: 2
A. JComboBox
B. JFrame
C. JComponent
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. canvas
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
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
A. CheckboxGroup
B. CheckBox
C. JComboBox
Answer optiona
Marks: 1
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
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
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>*/
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
A. Receiver
B. Controller
C. Transmitter
D. Modulator
Answer optionb
Marks: 1
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 )
D. All of above
Answer optionb
Marks: 1
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.
Answer optionb
Marks: 2
A. GridLayout(int numrows)
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiond
Marks: 1
}
}
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.
Answer optionb
Marks: 2
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
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.*;
}
}
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. two-dimensional
B. one-dimensional
C. multi dimensional
D. none of these
Answer optionb
Marks: 1
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
A. Create aJScrollPaneobject
C. Create aJTableobject
Answer optiond
Marks: 1
A. mobile enabled
B. web based
C. window based
D. package based
Answer optionc
Marks: 1
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
A. ChangeLayout() method
B. isLayout() method
C. setLayout() method
D. getLayout() method
Answer optionc
Marks: 1
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
A. One
B. Two
C. Empty
D. NULL
Answer optiona
Marks: 1
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
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
A. dialog variable
B. Window variable
C. Title variable
D. Frame Variable
Answer optionc
Marks: 1
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
A. Push Buttons
B. Radio Buttons
C. Check boxes
Answer optiond
Marks: 1
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
A. orientation
B. visible
C. thumbsize
D. none of these
Answer optionc
Marks: 1
Marks: 1
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
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 );
Answer optiona
Marks: 1
Answer optiond
Marks: 1
A. GUI 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"
);
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. public void itemStateSelectable(ItemEvent ie) {
Answer optiond
Marks: 2
Answer optionc
Marks: 1
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.
Answer optionb
Marks: 2
The Graphics object represents the part of the Frame that you can
A.
draw
Answer optiona
Marks: 1
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
A. setLayout()
B. add()
C. actionPerformed()
D. setVisible()
Answer optiona
Marks: 1
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
A. KEY_PRESSED
B. KEY_DOUBLE
C. KEY_RELEASED
D. KEY_TYPED
Answer optionb
Marks: 1
A. java.listener
B. java.util.event
C. java.awt.event
D. java.motion
Answer optionc
Marks: 1
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
A. ComponentListener
B. ContainerListener
C. ItemStateListener
D. AdjustmentListener
Answer optiond
Marks: 1
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
A. mouseMoved()
B. MouseMotionListener()
C. MouseClick()
D. MousePressed()
Answer optiona
Marks: 1
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
A. class
B. interface
C. object
D. variable
Answer optionc
Marks: 1
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
A. WindowInterface
B. WindowFocused Interface
C. WindowFocusListener
D. WindowAction Interface
Answer optionc
Marks: 1
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
Answer optionb
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1
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.
Answer optiond
Marks: 1
Answer optionb
Marks: 1
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
A. textChange()
B. textModified()
C. textValueChanged()
D. textValueModified()
Answer optionc
Marks: 1
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
-
A. keyPressed()
B. keyReleased()
C. keyTyped()
D. All of this
Answer optiond
Marks: 1
A. InputEvent
B. TextEvent
C. ItemEvent
D. MouseEvent
Answer optiona
Marks: 1
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
A. package
B. class
C. Interface
D. constructors
Answer optiond
Marks: 1
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- .....
Answer optiona
Marks: 1
Answer optionc
Marks: 1
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. returns Point int that contains the Y
Answer optiona
Marks: 1
Answer optionc
Marks: 1
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
A. returns int value that represents the button that caused the e
Answer optiona
Marks: 1
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
A. KeyListener()
B. addKeyListener()
C. RegisterKeyListener()
D. addKeyBoard()
Answer optionb
Marks: 1
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
Answer optiona
Marks: 1
Answer optionc
Marks: 1
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
A. KeyBoard Interface
B. Mouse Interface
C. WindowListener Interface
D. KeyListener Interface
Answer optiond
Marks: 1
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
A. KeyBoard Interface
B. Mouse Interface
C. WindowListener Interface
D. KeyListener Interface
Answer optiond
Marks: 1
A. WindowListener Interface
B. Window Interface
D. Action Interface
Answer optiona
Marks: 1
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
A. WindowListener Interface
B. Window Interface
D. Action Interface
Answer optiona
Marks: 1
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;
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)
Answer optionc
Marks: 2
A. boolean RequestedSessionIdFromCookie( )
B. boolean isRequestedSessionId( )
C. boolean isRequestedFromCookie( )
D. boolean isRequestedSessionIdFromCookie( )
Answer optiond
Marks: 1
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
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
B. Active Control
C. Passive Control
D. Edit Control
Answer optiond
Marks: 1
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( )
Answer optiona
Marks: 1
A. echoChar()
B. isEchochar()
C. setEchochar()
D. echoCharIsSet()
Answer optionc
Marks: 1
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
A. Menu
B. Item
C. Radio
D. List
Answer optiona
Marks: 1
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
A. Active
B. User
C. Passive
D. Interactive
Answer optionc
Marks: 1
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
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
A. package
B. class
C. interface
D. method
Answer optionb
Marks: 1
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
A. 1,2,3
B. 1,2,4
C. 2,3,4
Answer optionb
Marks: 1
A. 1,2,3
B. 2,3,4
C. 1,3,4
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(); } }
D. use ? in PreparedStatement
Answer optiond
Marks: 2
A. ResultSet rs=s.executeQuery();
B. Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
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();
Answer optionc
Marks: 2
B. Use s.executeQuery(s1);
D. Insert catch(Exception e)
Answer optionc
Marks: 2
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();
}
}
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
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.*;
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 ?
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.*;
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
C.
C. java.awt.GridLayout
D.
D. java.awt.CardLayout
Answer optiona
Marks:
Marks: 12
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
A. java.io.FlowLayout
B. java.awt.FlowLayout
C. javax.awt.GridLayout
D. javax.awt.CardLayout
Answer optionb
Marks: 1
Answer optiond
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1
Answer optiona
Marks: 1
A. FlowLayout.RIGHT
B. FlowLayout.LEFT
C. FlowLayout.CENTER
Answer optiond
Marks: 1
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
A. BorderLayout
B. GridLayout
C. GridBagLayout
D. CardLayout
Answer optionb
Marks: 1
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. JDBC driver
B. Package
C. JDBC Interface
Answer optiona
Marks: 1
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
C. JDBC
Answer optiond
Marks: 1
A. BorderLayout
B. GridLayout
C. FlowLayout
D. CardLayout
Answer optionc
Marks: 1
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
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
public static void main(String
oracle")
c Dept")
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
(SQLException e) { e.printStackTrace();}}}
Answer optiond
Marks: 2
932 Which of the Following is NOT true for Two Tier Architecture
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)
Answer optionc
Marks: 1
B. open a connection
C. load database
D. load resultset
Answer optionb
Marks: 1
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
A. 16, 8
B. 32,8
C. 8, 4
D. 32,4
Answer optiona
Marks: 1
A. ResultSet interface
B. PreparedStatement interface
C. Connection interface
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()
C. Both a and b
Answer optionc
Marks: 1
A. 8, 4
B. 16, 8
C. 4, 4
D. 16, 4
Answer optiond
Marks: 1
A. GridLayout()
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. GridLayout(int rows, int cols)
Answer optiond
Marks: 1
A. java.sql Package
B. javax.sql Package
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)
Answer optiona
Marks: 1
A. insert("Java ",9)
B. append("Java",9)
C. getRows("Java",10)
D. None of these
Answer optiona
Marks: 1
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
methods are used to set
t
Answer optiona
Marks: 1
A. BorderLayout
B. GridLayout
C. FlowLayout
D. CardLayout
Answer optionc
Marks: 1
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
A. Type 1 Driver
B. Type 2 Driver
C. Type 3 Driver
D. Type 4 Driver
Answer optiona
Marks: 1
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
A. FileDialog(Dialog parent)
C. FileDialog(Frame parent)
Answer optionb
Marks: 1
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
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
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
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);
}
}
Chose correct response to fill the blank.
Answer optiond
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
{
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);
}
}
Choose Correct Option to replace Blank
A. rs.getInt(
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) +"
Answer optiond
Marks: 2
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
}
}
C. print roll no, name and marks of first student from student ta
a", "roo
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
arks);
Count);
ble
Answer optionc
Marks: 2
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
C. void setMode()
D. int setMode()
Answer optiona
Marks: 1
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);
}
}
A. int, rset.getInt
B. String, a.getString
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
}
}
C. print roll no, name and marks of last student from student tab
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
arks);
Count);
le
Answer optionc
Marks: 1
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
A. boolean, int
B. boolean, void
C. void, int
D. void, void
Answer optiona
Marks: 1
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
A. boolean next()
B. void next()
C. void first()
D. void new()
Answer optiona
Marks: 1
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
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
A. getBigDecimal
B. getBlob
C. getBinaryStream
D. getASCIIStream
Answer optionb
Marks: 1
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);
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
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 }
Answer optiond
Marks: 2
A. Button,TextArea,Choice
B. List,TextArea,Label,Button
C. Label,TextField,Choice,CheckboxGroup
D. List,Label,TextField,Button
Answer optionc
Marks: 1
A. boolean
B. int
C. ResultSet
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiona
Marks: 1
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
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optionb
Marks: 2
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.
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
A. beforeFirst()
B. afterLast()
C. first()
D. next()
Answer optiond
Marks: 1
A. PreparedStatement
B. ParameterizedStatement
C. prepareStatement
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 }
}
D. Both A&B
Answer optiona
Marks: 1
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
A. WindowListener Interface
B. Window Interface
C. WindowConified Interface
D. Action Interface
Answer optiona
Marks: 1
A. WindowListener Interface
B. Window Interface
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. Action Interface
Answer optiona
Marks: 1
A. Mouse Interface
B. MouseMotionListener Interface
C. MouseClick Interface
D. MouseListener Interface
Answer optiond
Marks: 1
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
A. Mouse Interface
B. MouseMotionListener Interface
C. MouseExited Interface
D. MouseListener Interface
Answer optiond
Marks: 1
A. Mouse Interface
B. MouseMotionListener Interface
C. MousePressed Interface
D. MouseListener Interface
Answer optiond
Marks: 1
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
Answer optionc
Marks: 1
A. Statement 1 is true
B. Statement 2 is true
C. Statement 3 is true
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
D. Statement 4 is true
Answer optiona
Marks: 1
A. java.listener
B. java.util.event
C. java.awt.event
D. java.motion
Answer optionc
Marks: 1
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
Answer optiona
Marks: 1
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
Answer optionc
Marks: 1
A. setBackground(Color c )
B. setForeground( Color c )
C. add()
D. getBackground()
Answer optiona
Marks: 1
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
A. package
B. class
C. Interface
Answer optionb
Marks: 1
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......
Answer optionc
Marks: 1
Answer optiond
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Marks: 1
Answer optiond
Marks: 1
Answer optiona
Marks: 1
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. Reducing the window to an icon on the desktop
Answer optionc
Marks: 1
A. Statement 1 is true
B. Statement 2 is true
C. Statement 3 is true
D. Statement 4 is true
Answer optionc
Marks: 1
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
A. URLNotFound
B. URLSourceNotFound
C. MalformedURLException
D. URLNotFoundException
Answer optionc
Marks: 1
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-
Answer optionb
Marks: 1
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
Answer optionc
Marks: 1
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
A. URL
B. URLDecoder
C. URLConnection
Answer optiond
Marks: 1
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
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
yCode as
Answer optiona
Marks: 2
Answer optiona
Marks: 1
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
A. domain
B. server name
C. client name
D. package
Answer optiona
Marks: 1
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 ?
Answer optiona
Marks: 2
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
Answer optiond
Marks: 1
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");
mcq");
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
B. void MouseEntered(mouseEvent me)
Answer optiond
Marks: 1
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
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
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
{
Answer optionc
Marks: 2
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
{
();
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
{
}
Marks: 2
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);
}
Answer optiond
Marks: 2
Which constructor is used to set the grid layout with vertical gap
1042 and
A. GridLayout()
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) {}
A. mouseDragged, mouseMoved
B. mousePressed,mouseDragged
C. mouseClicked,mouseMoved
D. mouseReleased,mouseClicked
Answer optiona
Marks: 2
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. }
Answer optiona
Marks: 2
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
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
s
KeyLis
,50,100
, 300,
300
his);
);
MyLabe
MyL
ne }
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();
}
}
Answer optionc
Marks: 2
A. .net
B. .util
C. . io
D. .lang
Answer optiona
Marks: 1
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
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
A. Listener not registered
Answer optiond
Marks: 2
Answer optiona
Marks: 2
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
));
ing());
e());
());
A. setTitle(t.getValue());
B. setTitle(te.getText());
C. setTitle(te.getValue());
D. setTitle(t.getText());
Answer optiond
Marks: 2
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
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
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
A. Object
B. ActionEvent
C. EventObject
D. Component
Answer optiond
Marks: 1
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
Answer optiona
Marks: 1
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
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();
Answer optiona
Marks: 1
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-
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
C. char keyChar =label. getKeyCode ();
Answer optiond
Marks: 1
Answer optiona
Marks: 1
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
A. ItemState
B. ContainerListener
C. ActionListener
D. ItemListener
Answer optiond
Marks: 1
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
A. UnknownHostException
B. MalformedURLExeption
C. Exception
Answer optiond
Marks: 1
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
A. .net
B. .util
C. .lang
D. .gov
Answer optiond
Marks: 1
A. .com
B. .util
C. .gov
Answer optionb
Marks: 1
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
Answer optiona
Marks: 1
A. bundles
B. sets
C. none of A and B
D. Both A and B
Answer optiona
Marks: 1
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-----
Answer optiond
Marks: 1
Answer optiona
Marks: 1
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();
}
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
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
Answer optiond
Marks: 2
A. http
B. https
Answer optiona
Marks: 1
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
C. Port Number: -1
Answer optiond
Marks: 2
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);
}
}
A. july
B. 18-6-2013
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
n
mcq")
Free Study Material Buy Ty Diploma Buy Sy Diploma Whatsapp Group for Study Material
Answer optiond
Marks: 2
A. Stored
B. Located
C. to be transferred
D. Transferred
Answer optionb
Marks: 1
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
A. 1
B. 2
C. 3
Answer optiond
Marks: 1
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
A. URL
B. URLDecoder
C. URLConnection
Answer optionc
Marks: 1
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
A. Component
B. Window
C. Button
D. Applet
Answer optionc
Marks: 1
A. URL
B. URLDecoder
C. URLConnection
Answer optionc
Marks: 1
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
A. URL
B. URLDecoder
C. URLConnection
D. URLNotFoundException
Answer optionc
Marks: 1
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
A. port()
B. GetPort()
C. getPort()
D. findPort()
Answer optionb
Marks: 1
A. URL
B. Socket
C. ServerSocket
Answer optionb
Marks: 1
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
A. URL
B. URLDecoder
C. URLConnection
Answer optiona
Marks: 2
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
A. URL
B. URLDecoder
C. URLConnection
Answer optiona
Marks: 1
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
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
A. MenuBar
B. MenuItem
C. MenuComponent
D. Object
Answer optionb
Marks: 1
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
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 {
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