0% found this document useful (0 votes)
18 views7 pages

Chapter 3 MCQ 3 Ajp

The document presents the online exam results for a student named Kapadia Kush Amit, enrolled in the AJP - Chapter 3 - Event Handling course. The student answered a total of 20 questions, scoring 17 out of 20 marks. Each question includes the correct answers and the student's responses.

Uploaded by

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

Chapter 3 MCQ 3 Ajp

The document presents the online exam results for a student named Kapadia Kush Amit, enrolled in the AJP - Chapter 3 - Event Handling course. The student answered a total of 20 questions, scoring 17 out of 20 marks. Each question includes the correct answers and the student's responses.

Uploaded by

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

10/12/22, 8:55 PM Vidyalankar Polytechnic | VP

Online Exam Result

Exam : AJP - Chapter 3 - Event Handling Class : CO5I Div : A

Student Name : KAPADIA KUSH AMIT Roll No. : 20203A0055 Enrollment No.
: 2005680051

Sr. Your Correct


Question Marks
No Answer Answer

Which of these is a superclass of all Adapter classes?

a) b)
1 d b 0
Panel Applet

c) d)

Component Event

Which methods are used to close the window?

a) setVisible(false) b) windowClosing()
2 c) d) d d 1

stop() both a and b

Which is the integer constants of TextEvent class?

b)
a) TEXT_CHANGED
TEXT_FORMAT_CHANGED
3 c c 1

c) TEXT_VALUE_CHANGED
d) TEXT_SIZE_CHANGED

In case of______ we can implement only required methods of any


interface.

a) b)
4 a a 1
adapter classes Event

c) d)

EventObject Listener

https://mycollege.vpt.edu.in/student/end_practice_exam_new.php 1/7
10/12/22, 8:55 PM Vidyalankar Polytechnic | VP

Sr. Your Correct


Question Marks
No Answer Answer
Which of these methods are used to register a mouse motion
listener?

5 a) addMouse() b) addMouseListener() d d 1
d)
c) addMouseMotionListner()
eventMouseMotionListener()

Event class is defined in which of these libraries?

6 a) java.io b) java.lang d d 1
d)
c) java.net
java.util

The Following steps are required to perform


1) Implement the Listener interface and overrides its methods
2) Register the component with the Listener

7 c c 1
a) Exception Handling b) String Handling
d)
c) Event Handling
None of the above

Which of these events will be generated if we close an applet’s


window?

a) ActionEvent
8 b) ComponentEvent d d 1

c) d)

AdjustmentEvent WindowEvent

Which event is generating when checkable menu item is selected


or deselected?

b)
9 a) KeyEvent ListEvent c c 1

c)
d) MouseEvent
ItemEvent

https://mycollege.vpt.edu.in/student/end_practice_exam_new.php 2/7
10/12/22, 8:55 PM Vidyalankar Polytechnic | VP

Sr. Your Correct


Question Marks
No Answer Answer
Identify correct methods in the place of blank space:

public class Test extends Applet implements


_______________
{
String msg="";
public void init()
{
addKeyListener(this);
}
public void keyPressed(_____________ k)
{
showStatus("KeyPressed");
}
public void keyReleased(KeyEvent k)
{
showStatus("KeyRealesed");
}
10 public void keyTyped(KeyEvent k) a a 1
{
msg = msg+k.getKeyChar();
repaint();
}
public void paint(Graphics g)
{
g.drawString(msg, 20, 40);
}
}

a) b)

KeyListener, KeyEvent MouseListener,MouseEvent

c) d)

ActionListener, ActionEvent WindowListener, WindowEvent

The ___________method returns a reference to the component


that was added to or removed from the container.

a) b)
11 c c 1
getParent() getComponent()

c) d)

getChild() geoReferenced()

https://mycollege.vpt.edu.in/student/end_practice_exam_new.php 3/7
10/12/22, 8:55 PM Vidyalankar Polytechnic | VP

Sr. Your Correct


Question Marks
No Answer Answer

Which of the following components generate action events?

a) b)
12 a a 1
Button Label

c) d)

CheckBox Window

What is a listener in context to event handling?

b)
a)
A listener is a variable that is A listener is a object that is
notified when an event occurs. notified when an event occurs.
13 c b 0

c)
d)
A listener is a method that is
notified when an event occurs. None of the mentioned

14 Select correct Listener from given option for ******. b b 1

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

public class JR extends JApplet implements ***********

Container c=getContentPane();

public void init()

c.setLayout(new FlowLayout());

JRadioButton b1=new JRadioButton("red");

b1.addActionListener(this);

c.add(b1);

https://mycollege.vpt.edu.in/student/end_practice_exam_new.php 4/7
10/12/22, 8:55 PM Vidyalankar Polytechnic | VP

Sr. Your Correct


Question Marks
No Answer Answer

JRadioButton b2=new JRadioButton("blue");

b2.addActionListener(this);

c.add(b2);

JRadioButton b3=new JRadioButton("green");

b3.addActionListener(this);

c.add(b3);

ButtonGroup bg=new ButtonGroup();

bg.add(b1);

bg.add(b2);

bg.add(b3);

public void actionPerformed(ActionEvent e)

String str;

str=e.getActionCommand();

if(str=="red")

c.setBackground(Color.red);

else if(str=="blue")

c.setBackground(Color.blue);

else if(str=="green")

c.setBackground(Color.green);

/**/
https://mycollege.vpt.edu.in/student/end_practice_exam_new.php 5/7
10/12/22, 8:55 PM Vidyalankar Polytechnic | VP

Sr. Your Correct


Question Marks
No Answer Answer

b) ActionListener
a) ItemListener

d)
c) MouseListener
WindowListener

An event is generated when the internal state of the event source


is_____

b)
15 b b 1
a) Not Changed
Changed

c) d)

Both a and b None of these

Which of the following method is invoked when a window is


changed from a normal to a minimized state?

b)
16 a a 1
a) windowIconfified()
windowClosed()

c) d)

windowDeactivated() windowOpened()

______ is an object that describes a state change in the source.

a) event
17 b) Source a a 1

c) d)

None of the Above All of the above

Which of the following method does not belongs to


WindowListerner interface?

18 b b 1
a) windowActivated b) windowReactivated
d)
c) windowDeiconified
windowClosed()

https://mycollege.vpt.edu.in/student/end_practice_exam_new.php 6/7
10/12/22, 8:55 PM Vidyalankar Polytechnic | VP

Sr. Your Correct


Question Marks
No Answer Answer
In the Delegation Event Model, a user interface element is able to
delegate, the processing of an event............................

a) b)
19 class a separate piece of code d b 0

c) d)

Interface Listener

What is the preferred way to handle an object’s events in Java 2?

a) Override the object’s b) Add one or more event


20 handleEvent( ) method. listeners to handle the events. b b 1
c) d)
Have the object override its
Have the object override its
processEvent( ) methods.
dispatchEvent( ) methods.

Total Marks : 20

Obtained : 17

Student Signature _____________________________

https://mycollege.vpt.edu.in/student/end_practice_exam_new.php 7/7

You might also like