0% found this document useful (0 votes)
2 views

Chapter 3 MCQ 1 ajp

The document presents the online exam results for a student named Kapadia Kush Amit, detailing their performance in an event handling exam. The student answered a total of 20 questions, scoring 12 out of 20 marks. Each question includes the student's answer, the correct answer, and the marks awarded.

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)
2 views

Chapter 3 MCQ 1 ajp

The document presents the online exam results for a student named Kapadia Kush Amit, detailing their performance in an event handling exam. The student answered a total of 20 questions, scoring 12 out of 20 marks. Each question includes the student's answer, the correct answer, and the marks awarded.

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/ 8

10/12/22, 8:29 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
If a class MyWindowAdapter extends WindowAdapter and
implements the windowClosing() method. How to register this
class ?
a) this.addWindowListener(new b) addWindowListener(new
1 MyWindowAdapter()); MyWindowAdapter()); b a 0
c)
d) addWindowListener(new
this.addListener(new
MyAdapter());
MyWindowAdapter());

Which of these methods are used to register a mouse motion


listener?

2 a) addMouse() b) addMouseListener() c d 0
d)
c) addMouseMotionListner()
eventMouseMotionListener()

Which of the following method is invoked when a window is


changed from a normal to a minimized state?

b)
3 a a 1
a) windowIconfified()
windowClosed()

c) d)

windowDeactivated() windowOpened()

4 Consider the following output. Find the missing statement in the c c 1


program.

import java.awt.*;

import java.awt.event.*;

import java.applet.*;

import javax.swing.*;

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

Sr. Your Correct


Question Marks
No Answer Answer
/* */

public class SimpleKey1 extends JApplet implements


KeyListener

String msg = "";

int X = 10, Y = 20;

public void init()

addKeyListener(this);

requestFocus();

public void keyPressed(KeyEvent ke)

showStatus("Key Down");

public void keyReleased(KeyEvent ke)

showStatus("Key Up");

public void keyTyped(KeyEvent ke)

msg += ke.getKeyChar();

repaint(); }

public void paint(Graphics g)

g.drawString(msg, X, Y);

a) Missing Semicolon b) Missing {

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

Sr. Your Correct


Question Marks
No Answer Answer
c) d)

Missing } Missing()

Which of the following components generate action events?

a) b)
5 a a 1
Button Label

c) d)

CheckBox Window

Which of the following are true?

a) The event-inheritance model b) The event-inheritance model


has replaced the event-delegationis more efficient than the event-
model. delegation model.
6 c) b c 0
d)
The event-delegation model uses
event listeners to define the The event-delegation model uses
methods of event-handling the handleEvent( ) method to
classes support event handling.

Which of these methods can be used to obtain the coordinates of a


mouse?

7 d a 0
a) getPoint() b) getCoordinates()
c)
d) getMouseCordinates()
getMouseXY()

Which of the following method does not belongs to


WindowListerner interface?

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

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

Sr. Your Correct


Question Marks
No Answer Answer

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


9 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.

In case of______ we can implement only required methods of any


interface.

a) b)
10 a a 1
adapter classes Event

c) d)

EventObject Listener

Which of these packages contains all the classes and methods


required for even handling in Java?
11 d d 1
a) java.applet b) java.awt
c) java.event d) java.awt.event
Which of the following is the highest class in the event delegation
model?

12 a) java.util.EventListener b) java.util.EventObject c b 0
c)
d) java.awt.event.AWTEvent
java.awt.AWTEvent

The Following steps are required to perform


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

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

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

Sr. Your Correct


Question Marks
No Answer Answer

Which of these methods can be used to change location of an


event?

a) changePoint() b)
14 a b 0
translatePoint()

c)
d) translateCordinates()
changeCordinates()

15 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);

JRadioButton b2=new JRadioButton("blue");

b2.addActionListener(this);

c.add(b2);

JRadioButton b3=new JRadioButton("green");

b3.addActionListener(this);

c.add(b3);
https://mycollege.vpt.edu.in/student/end_practice_exam_new.php 5/8
10/12/22, 8:29 PM Vidyalankar Polytechnic | VP

Sr. Your Correct


Question Marks
No Answer Answer

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);

/**/

b) ActionListener
a) ItemListener

d)
c) MouseListener
WindowListener

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

Sr. Your Correct


Question Marks
No Answer Answer

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

a) event
16 b) Source a a 1

c) d)

None of the Above All of the above

Which of these methods are used to register a keyboard event


listener?

17 c c 1
a) KeyListener() b) addListener()
d)
c) addKeyListener()
eventKeyboardListener()

The ___________method returns a reference to the component


that was added to or removed from the container.

a) b)
18 b c 0
getParent() getComponent()

c) d)

getChild() geoReferenced()

Which of these methods will respond when you click any button
by mouse?

a) mouseClicked() b) mouseEntered()
19 a d 0
c)
d)
mousePressed()
All of the above

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

Sr. Your Correct


Question Marks
No Answer Answer
Complete the following signature:

void
addTreeExpansionListener(___________________________ tel)
20 b b 1
a) TreeExpansionlistener b) TreeExpansionListener
d)
c) TreeListener
treeListener

Total Marks : 20

Obtained : 12

Student Signature _____________________________

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

You might also like