wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

advance Java Quiz – MCQs and Answers

Total questions: 50

Worksheet time: 25mins

Name
Class
Date
1.

AWT stands for?

a)

Abstract Window Table

b)

Advanced Window Toolkit

c)

Abstract Window Toolkit

d)

Application Window Toolkit

2.

Which class is the base class for all AWT elements?

a)

Window

b)

Frame

c)

Component

d)

Panel

3.

Which method makes a Frame visible?

a)

show()

b)

display()

c)

setVisible(true)

d)

open()

4.

setSize(300,200) means?

a)

200 width & 300 height

b)

300 width & 200 height

c)

pixels in diagonal

d)

None

5.

Which layout is used when we setLayout(null)?

a)

BorderLayout

b)

GridLayout

c)

FlowLayout

d)

No layout (manual positioning)

6.

Graphics class is used for?

a)

Database

b)

Drawing shapes, text

c)

File handling

d)

Multithreading

7.

Which method draws a rectangle?

a)

drawRect()

b)

rect()

c)

rectangle()

d)

makeRect()

8.

FontMetrics is used for?

a)

Measuring size & width of fonts

b)

Drawing rectangle

c)

Managing colors

d)

Creating frames

9.

Which AWT control is used to accept single-line input?

a)

TextArea

b)

TextField

c)

Label

d)

Scrollbar

10.

Checkbox is used for?

a)

Entering numbers

b)

True/False selection

c)

Drawing shapes

d)

Changing font

11.

Scrollbar default orientation is?

a)

Horizontal

b)

Vertical

c)

Both

d)

None

12.

Which method adds a component to Frame?

a)

insert()

b)

add()

c)

put()

d)

attach()

13.

Label is used for?

a)

Editing text

b)

Non-editable text display

c)

Drawing shapes

d)

Input numbers

14.

Multithreading in Java means?

a)

Running multiple programs

b)

Running multiple threads in same program

c)

Running multiple JVMs

d)

Running multiple processes only

15.

Smallest unit of execution in Java?

a)

Process

b)

Method

c)

Thread

d)

Object

16.

Default thread priority in Java?

a)

1

b)

5

c)

10

d)

0

17.

Which method starts a thread?

a)

run()

b)

start()

c)

execute()

d)

init()

18.

Which method checks if thread is still running?

a)

running()

b)

check()

c)

isAlive()

d)

alive()

19.

Which method pauses a thread temporarily?

a)

wait()

b)

sleep()

c)

stop()

d)

kill()

20.

join() method is used for?

a)

Pause thread permanently

b)

Waiting for thread to finish

c)

Killing thread

d)

Creating thread

21.

Synchronization in Java is used for?

a)

Faster execution

b)

Avoiding data inconsistency in threads

c)

Reducing memory

d)

None

22.

Which is automatically created thread in Java program?

a)

Worker thread

b)

Main thread

c)

User thread

d)

Daemon thread

23.

Which Applet method is called first when Applet is loaded?

a)

start()

b)

init()

c)

stop()

d)

destroy()

24.

When Applet is minimized which method is called?

a)

stop()

b)

destroy()

c)

init()

d)

start()

25.

Delegation Event Model in Java is used for?

a)

File handling

b)

GUI event handling

c)

Thread execution

d)

Database access

26.

What is Swing in Java?

a)

A database connectivity tool

b)

A GUI toolkit

c)

A web framework

d)

A compiler

27.

Which package contains Swing classes?

a)

java.awt

b)

java.swing

c)

javax.swing

d)

java.util

28.

AWT components are?

a)

Lightweight

b)

Heavyweight

c)

Both

d)

None

29.

Which architecture does Swing follow?

a)

MVC

b)

OOP

c)

JDBC

d)

None

30.

JFrame is subclass of?

a)

JApplet

b)

Frame

c)

JPanel

d)

Window

31.

Which method is used to close JFrame?

a)

EXIT_ON_CLOSE

b)

setDefaultCloseOperation()

c)

close()

d)

shutdown()

32.

Which Swing component is used for single line text input?

a)

JTextArea

b)

JTextField

c)

JLabel

d)

JPasswordField

33.

Which component is used for multiple selections?

a)

JCheckBox

b)

JRadioButton

c)

JButton

d)

JLabel

34.

Which allows only one choice from a group?

a)

JCheckBox

b)

JRadioButton

c)

JComboBox

d)

JList

35.

Which Swing component creates a dropdown menu?

a)

JList

b)

JComboBox

c)

JMenu

d)

JTextField

36.

Which Swing class is used to display a menu bar?

a)

JMenu

b)

JMenuBar

c)

JMenuItem

d)

JDialog

37.

Which Swing component is used to group components?

a)

JPanel

b)

JFrame

c)

JApplet

d)

JTextArea

38.

Which component is used to show a dialog box?

a)

JFrame

b)

JDialog

c)

JMenu

d)

JList

39.

Which method is used to get text from JTextField?

a)

getValue()

b)

getText()

c)

setText()

d)

valueOf()

40.

Which method sets text in JTextField?

a)

setValue()

b)

getText()

c)

setText()

d)

writeText()

41.

JDBC stands for?

a)

Java Database Connectivity

b)

Java Data Compiler

c)

Java Development Connectivity

d)

Java Debugger Connector

42.

Which package contains JDBC classes?

a)

java.sql

b)

java.jdbc

c)

javax.jdbc

d)

java.db

43.

Which class is used to manage JDBC drivers?

a)

Driver

b)

DriverManager

c)

Connection

d)

Statement

44.

Which JDBC object is used to store the result of SQL query?

a)

Statement

b)

ResultSet

c)

PreparedStatement

d)

Connection

45.

Which JDBC statement is used for precompiled SQL?

a)

Statement

b)

ResultSet

c)

PreparedStatement

d)

CallableStatement

46.

Which JDBC object is used for calling stored procedures?

a)

CallableStatement

b)

Statement

c)

Connection

d)

PreparedStatement

47.

Which method is used to execute a SELECT query?

a)

executeUpdate()

b)

executeQuery()

c)

execute()

d)

runQuery()

48.

Which method is used for INSERT, UPDATE, DELETE?

a)

execute()

b)

executeQuery()

c)

executeUpdate()

d)

runUpdate()

49.

Which component in Swing is used to display multiple lines of text?

a)

JLabel

b)

JTextField

c)

JTextArea

d)

JList

50.

Which is true about Swing?

a)

Platform dependent

b)

Lightweight

c)

Written in C++

d)

Not customizable