UNIT 4 MCQ QUESTIONS
1) How many ways are there to access package from another package?
A) 3
B) 2
C) 1
D) 5
ANSWER: A) 3
2) In the following which package is used for analyzing code during run time?
A) java.lang.reflect
B) java.awt
C) java.io
D) java.applet
ANSWER: A) java.lang.reflect
3) Which of these package is used for graphical user interface?
a) java.applet
b) java.awt
c) java.awt.image
d) java.io
Answer: b
4) What is the length of the application box made in the following Java program?
Import java.awt.*;
Import java.applet.*;
Public class myapplet extends Applet
{
, Graphic g;
g.drawString(“A Simple Applet”,20,20);
}
a) 20
b) Default value
c) Compilation Error
d) Runtime Error
View Answer
Answer: c
5) What is an event in delegation event model used by Java programming language?
a) An event is an object that describes a state change in a source
b) An event is an object that describes a state change in processing
c) An event is an object that describes any change by the user and system
d) An event is a class used for defining object, to create events
Answer: a
6) Which of these methods are used to register a mouse motion listener?
a) addMouse()
b) addMouseListener()
c) addMouseMotionListner()
d) eventMouseMotionListener()
Answer: c
6) Event class is defined in which of these libraries?
a) java.io
b) java.lang
c) java.net
d) java.awt.event
Answer: d
7) Which of these events will be notified if scroll bar is manipulated?
a) ActionEvent
1) How many ways are there to access package from another package?
A) 3
B) 2
C) 1
D) 5
ANSWER: A) 3
2) In the following which package is used for analyzing code during run time?
A) java.lang.reflect
B) java.awt
C) java.io
D) java.applet
ANSWER: A) java.lang.reflect
3) Which of these package is used for graphical user interface?
a) java.applet
b) java.awt
c) java.awt.image
d) java.io
Answer: b
4) What is the length of the application box made in the following Java program?
Import java.awt.*;
Import java.applet.*;
Public class myapplet extends Applet
{
, Graphic g;
g.drawString(“A Simple Applet”,20,20);
}
a) 20
b) Default value
c) Compilation Error
d) Runtime Error
View Answer
Answer: c
5) What is an event in delegation event model used by Java programming language?
a) An event is an object that describes a state change in a source
b) An event is an object that describes a state change in processing
c) An event is an object that describes any change by the user and system
d) An event is a class used for defining object, to create events
Answer: a
6) Which of these methods are used to register a mouse motion listener?
a) addMouse()
b) addMouseListener()
c) addMouseMotionListner()
d) eventMouseMotionListener()
Answer: c
6) Event class is defined in which of these libraries?
a) java.io
b) java.lang
c) java.net
d) java.awt.event
Answer: d
7) Which of these events will be notified if scroll bar is manipulated?
a) ActionEvent