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

Assignment Chapter 3MCQ

Uploaded by

sanskrutinile06
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Assignment Chapter 3MCQ

Uploaded by

sanskrutinile06
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Unit III Event Handling

Q. 1. The Following steps are required to perform Implement the Listener interface and overrides

its methods Register the component with the Listener

(a) Exception Handling

(b) String Handling

(c) Event Handling

(d) None of the above

Q. 2 In which places can put the event handling code

(a) Same class

(b) Other class

(c) Annonymous class

(d) All mentioned above

Q. 3 Which package provides many event classes an

(a) java.awt

(b) java.awt.Graphics

(c) java.awt.event

(d) None of the above

Q. 4 To use the ActionListener interface it must be implemented by a class there are several ways

to do that find in the following?

(a) Creating a new class

(b) using the class the graphical component

(c) an anonymous inner class

(d) All mentioned above

Q. 5 The ActionListener interface is not used for handling action events?

(a) True

(b) False

Q. 6 The ActionListener interface is used for handling action events, For example, it's used by a

(a) JButton(b) JCheckbox(c) All of these(d) JMenuItem


Q. 7 Which class is used for this Processing Method processActionEvent( )?

(a) Button,List,MenuItem

(b) Button,Checkbox,Choice

(c) Scrollbar,Component,Button

(d) None of the above

Q. 8 In Graphics class Which method is used to set the graphics current color to the specified color?

(a) public abstract void setFont(Font font)

(b) public abstract void setColor(Color c)

(c) public abstract void drawString(String str, int x, int y)

(d) None of the above

Q. 9 Which of the following method is used to determine the type of adjustment event?

(a) getType( )(b) getEventType( )(c) getAdjustmentType( )(d) getEventObjectType( )

Q. 10 TextField generates event.

(a) ActionEvent,ItemEvent

(b) ActionEvent, TextEvent

(c) ScrollEvent,TextEvent

(d) ActionEvent, ScrollEvent

Q. 11 void keyTyped(KeyEvent ke) called when a key on the keyboard is .

(a) pressed and then released.

(b) pressed

(c) released

(d) none of the above

Q. 12 Which event is generated when the position of scrollbar is changed?

(a) KeyEvent

(b) MouseEvent (c) ItemEvent (d) AdjustmentEvent


Q. 13 The signature for the registration method for a ActionEvent should be .

(a) public void addActionListener(ActionEvent L)

(b) public void setAction(ActionListener L)

(c) public void setActionListener(ActionListener L)

(d) public void addActionListener(ActionListener L)

Q. 14 Which of the following component generates ActionEvent?

(a) Window

(b) RadioButton

(c) ScrollBar

(d) None

Q. 15 method is used to register a keyboard event listener.

(a) KeyListener( )(b) addKeyListener( )(c) addKeyListenerEvent( )(d) eventKeyboardListener( )

Q. 16 Name the method defined in EventObject class that returns the object generated from the event.

(a) getEvent( )

(b) getObject( )

(c) getId( )

(d) getSource( )

Q. 17 The MouseListener interface is used to make mouse handling.

(a) True(b) False

Q. 18 ActionEvent is applied on

(a) Frame(b) Checkbox, Choice, List(c) Scrollbar(d) Button, TextField, List, Menu

Q. 19 ComponentEvent is the super class of .

(a) FocusEvent(b) MouseEvent(c) WindowEvent(d) All of the above

Q. 20 If we close an applet window events will be generated.

(a) ActionEvent(b) ComponentEvent(c) AdjustmentEvent(d) WindowEvent

Q. 21 Which of the following component generate ActionEvent?

(a) ScrollBar(b) Window(c) RadioButton(d) None of these


Q. 22 Which Listener handles all List related Events?

(a) ItemListener

(b) InputEvent

(c) SelectEvent

(d) ListEvent

Q. 23 How to obtain the command name for invoking ActionEvent?

(a) getCommandName( )

(b) getActionEventCommand( )

(c) getActionCmd( )

(d) getActionCommand( )

Q. 24 ComponentEvent is the superclass of

(a) ActionEvent

(b) ItemEvent

(c) TextEvent

(d) All of above

Q. 25 When we need to use Checkbox or Item from the list or use a checkable Menu an is generated.

(a) ActionEvent(b) ItemEvent(c) MenuEvent(d) ClickEvent

Q. 26 Which of the following constant is not defined in WindowEvent class?

(a) WINDOW_ACTIVATED

(b) WINDOW_CLOSED

(c) WINDOW_DEICONIFIED

(d) None of these

Q. 27 Which of the following is not the method of handling window event?

(a) void windowClosed(WindowEvent we)

(b) void windowClosing(WindowEvent we)


(c) void windowAfterClosing(WindowEvent we) (d) All of these

Q. 28 Which method is used to process mouse click?

(a) public void mouseClicked(MouseListener m)

(b) public void mouseIsClicked(MouseEvent m)

(c) public void mouseClicked(MouseEvent m)

(d) public void mouseClick(MouseEvent m)

Q. 29 Which class is used for this processing method processActionEvent( ) method?

(a) Button, List, MenuItem

(b) Button,Checkbox,Choice

(c) ScrollBar, Component, Button

(d) None of the above.

Q. 30 Which of this package contains all the classes and methods required for event handling in Java.

(a) java.applet(b) java.awt(c) java.event(d) java.awt.event

Q. 31 Name the method defined in EvenObject class that returns the object generated from the event.

(a) getEvent( )(b) getObject( )(c) getId( )(d) getSource( )

Q. 32 Which of these interfaces define a method actionPefiormed()

(a) ComponentListener

(b) ContainerListener

(c) ActionListener

(d) InputListener

Q. 33 Button Control implements following listener interface.

(a) ItemListener

(b) ActionListener

(c) FlowListener

(d) Adapter

Q. 34 Clicking the closing button on the upper right corner of a frame generates a (n) ‐event.

(a) ItemEvent (b) WindowEvent(c) MouseMotionEvent(d) ComponentEvent

Q. 35 Which of the following method must be overridden in the order to handle KeyEvent.

(a) keyPressed(KeyEvent obj)


(b) KeyReleased(KeyEvent obj)

(c) KeyTyped(KeyEvent obj)

(d) All of these

Q. 36 Which of these methods can be used to know the degree of adjustment made by the user?

(a) getValue( )

(b) getAdjustmentType( )

(c) getAdjustmentValue( )

(d) getAdjustmentAmount( )

Q. 37 MouseEvent is subclass of which of the following class?

(a) ComponentEvent

(b) ContainerEvent

(c) ItemEvent

(d) InputEvent

Q. 38 The is an object that is notified when an event occurs.

(a) Listener

(b) Sources

(c) Event

(d) None of the above

Q. 39 What is the use of String getActionCommand( ) method of ActionEvent class?

(a) to obtain the label (caption) of Button

(b) to obtain the reference of Button

(c) to obtain object of Button

(d) to obtain the label (caption) and object of Button

You might also like