NEW
Font size
Worksheetsadvance Java Quiz – MCQs and Answers
Total questions: 50
Worksheet time: 25mins
AWT stands for?
Abstract Window Table
Advanced Window Toolkit
Abstract Window Toolkit
Application Window Toolkit
Which class is the base class for all AWT elements?
Window
Frame
Component
Panel
Which method makes a Frame visible?
show()
display()
setVisible(true)
open()
setSize(300,200) means?
200 width & 300 height
300 width & 200 height
pixels in diagonal
None
Which layout is used when we setLayout(null)?
BorderLayout
GridLayout
FlowLayout
No layout (manual positioning)
Graphics class is used for?
Database
Drawing shapes, text
File handling
Multithreading
Which method draws a rectangle?
drawRect()
rect()
rectangle()
makeRect()
FontMetrics is used for?
Measuring size & width of fonts
Drawing rectangle
Managing colors
Creating frames
Which AWT control is used to accept single-line input?
TextArea
TextField
Label
Scrollbar
Checkbox is used for?
Entering numbers
True/False selection
Drawing shapes
Changing font
Scrollbar default orientation is?
Horizontal
Vertical
Both
None
Which method adds a component to Frame?
insert()
add()
put()
attach()
Label is used for?
Editing text
Non-editable text display
Drawing shapes
Input numbers
Multithreading in Java means?
Running multiple programs
Running multiple threads in same program
Running multiple JVMs
Running multiple processes only
Smallest unit of execution in Java?
Process
Method
Thread
Object
Default thread priority in Java?
1
5
10
0
Which method starts a thread?
run()
start()
execute()
init()
Which method checks if thread is still running?
running()
check()
isAlive()
alive()
Which method pauses a thread temporarily?
wait()
sleep()
stop()
kill()
join() method is used for?
Pause thread permanently
Waiting for thread to finish
Killing thread
Creating thread
Synchronization in Java is used for?
Faster execution
Avoiding data inconsistency in threads
Reducing memory
None
Which is automatically created thread in Java program?
Worker thread
Main thread
User thread
Daemon thread
Which Applet method is called first when Applet is loaded?
start()
init()
stop()
destroy()
When Applet is minimized which method is called?
stop()
destroy()
init()
start()
Delegation Event Model in Java is used for?
File handling
GUI event handling
Thread execution
Database access
What is Swing in Java?
A database connectivity tool
A GUI toolkit
A web framework
A compiler
Which package contains Swing classes?
java.awt
java.swing
javax.swing
java.util
AWT components are?
Lightweight
Heavyweight
Both
None
Which architecture does Swing follow?
MVC
OOP
JDBC
None
JFrame is subclass of?
JApplet
Frame
JPanel
Window
Which method is used to close JFrame?
EXIT_ON_CLOSE
setDefaultCloseOperation()
close()
shutdown()
Which Swing component is used for single line text input?
JTextArea
JTextField
JLabel
JPasswordField
Which component is used for multiple selections?
JCheckBox
JRadioButton
JButton
JLabel
Which allows only one choice from a group?
JCheckBox
JRadioButton
JComboBox
JList
Which Swing component creates a dropdown menu?
JList
JComboBox
JMenu
JTextField
Which Swing class is used to display a menu bar?
JMenu
JMenuBar
JMenuItem
JDialog
Which Swing component is used to group components?
JPanel
JFrame
JApplet
JTextArea
Which component is used to show a dialog box?
JFrame
JDialog
JMenu
JList
Which method is used to get text from JTextField?
getValue()
getText()
setText()
valueOf()
Which method sets text in JTextField?
setValue()
getText()
setText()
writeText()
JDBC stands for?
Java Database Connectivity
Java Data Compiler
Java Development Connectivity
Java Debugger Connector
Which package contains JDBC classes?
java.sql
java.jdbc
javax.jdbc
java.db
Which class is used to manage JDBC drivers?
Driver
DriverManager
Connection
Statement
Which JDBC object is used to store the result of SQL query?
Statement
ResultSet
PreparedStatement
Connection
Which JDBC statement is used for precompiled SQL?
Statement
ResultSet
PreparedStatement
CallableStatement
Which JDBC object is used for calling stored procedures?
CallableStatement
Statement
Connection
PreparedStatement
Which method is used to execute a SELECT query?
executeUpdate()
executeQuery()
execute()
runQuery()
Which method is used for INSERT, UPDATE, DELETE?
execute()
executeQuery()
executeUpdate()
runUpdate()
Which component in Swing is used to display multiple lines of text?
JLabel
JTextField
JTextArea
JList
Which is true about Swing?
Platform dependent
Lightweight
Written in C++
Not customizable
