InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Which of these methods is defined in MouseMotionAdapter class?(a) mouseDragged()(b) mousePressed()(c) mouseReleased()(d) mouseClicked()I have been asked this question in final exam.This is a very interesting question from Event Listeners Interfaces topic in chapter Event Handling of Java |
|
Answer» CORRECT OPTION is (a) mouseDragged() Best EXPLANATION: The MouseMotionAdapter class DEFINES 2 methods – mouseDragged() and mouseMoved. |
|
| 2. |
Which of these methods will be invoked if a character is entered?(a) keyPressed()(b) keyReleased()(c) keyTyped()(d) keyEntered()I got this question by my school teacher while I was bunking the class.This intriguing question originated from Event Listeners Interfaces in division Event Handling of Java |
|
Answer» The CORRECT answer is (C) keyTyped() |
|
| 3. |
Which of these interfaces define a method itemStateChanged()?(a) ComponentListener(b) ContainerListener(c) ActionListener(d) ItemListenerThe question was posed to me during an internship interview.My doubt stems from Event Listeners Interfaces topic in section Event Handling of Java |
|
Answer» CORRECT CHOICE is (d) ItemListener To ELABORATE: NONE. |
|
| 4. |
Which of these methods will respond when you click any button by mouse?(a) mouseClicked()(b) mouseEntered()(c) mousePressed()(d) all of the mentionedI have been asked this question in an internship interview.The question is from Event Listeners Interfaces topic in division Event Handling of Java |
|
Answer» The correct answer is (d) all of the mentioned |
|
| 5. |
Which of these interfaces define a method actionPerformed()?(a) ComponentListener(b) ContainerListener(c) ActionListener(d) InputListenerThis question was posed to me by my college director while I was bunking the class.The origin of the question is Event Listeners Interfaces topic in chapter Event Handling of Java |
|
Answer» Correct choice is (c) ActionListener |
|
| 6. |
Which of these interfaces define four methods?(a) ComponentListener(b) ContainerListener(c) ActionListener(d) InputListenerI had been asked this question in homework.My query is from Event Listeners Interfaces in chapter Event Handling of Java |
|
Answer» RIGHT answer is (a) COMPONENTLISTENER Explanation: ComponentListener DEFINES FOUR METHODS componentResized(), componentMoved(), componentShown() and componentHidden(). |
|
| 7. |
Which of these interfaces handles the event when a component is added to a container?(a) ComponentListener(b) ContainerListener(c) FocusListener(d) InputListenerThe question was posed to me in an international level competition.My doubt stems from Event Listeners Interfaces in portion Event Handling of Java |
|
Answer» CORRECT ANSWER is (b) CONTAINERLISTENER To EXPLAIN I would say: The ContainerListener defines methods to recognize when a component is ADDED to or removed from a container. |
|
| 8. |
Which of these are constants defined in WindowEvent class?(a) WINDOW_ACTIVATED(b) WINDOW_CLOSED(c) WINDOW_DEICONIFIED(d) All of the mentionedThe question was posed to me during a job interview.I'm obligated to ask this question of MouseEvent, TextEvent & WindowEvent Class in portion Event Handling of Java |
|
Answer» The CORRECT option is (d) All of the mentioned |
|
| 9. |
Which of these is superclass of WindowEvent class?(a) WindowEvent(b) ComponentEvent(c) ItemEvent(d) InputEventThe question was posed to me during a job interview.I need to ask this question from MouseEvent, TextEvent & WindowEvent Class topic in chapter Event Handling of Java |
|
Answer» CORRECT ANSWER is (b) COMPONENTEVENT Easiest explanation: ComponentEvent is superclass of ContainerEvent, FocusEvent, KEYEVENT, MouseEvent and WINDOWEVENT. |
|
| 10. |
Which of these methods is used to get x coordinate of the mouse?(a) getX()(b) getXCoordinate()(c) getCoordinateX()(d) getPointX()The question was asked in semester exam.The query is from MouseEvent, TextEvent & WindowEvent Class topic in division Event Handling of Java |
|
Answer» The CORRECT OPTION is (a) getX() |
|
| 11. |
Which of these packages contains all the event handling interfaces?(a) java.lang(b) java.awt(c) java.awt.event(d) java.eventThis question was addressed to me in examination.This interesting question is from Event Listeners Interfaces in portion Event Handling of Java |
|
Answer» The CORRECT ANSWER is (C) java.awt.event |
|
| 12. |
Which of these methods is used to obtain the object that generated a WindowEvent?(a) getMethod()(b) getWindow()(c) getWindowEvent()(d) getWindowObject()I got this question in a national level competition.The question is from MouseEvent, TextEvent & WindowEvent Class topic in portion Event Handling of Java |
| Answer» | |
| 13. |
MouseEvent is subclass of which of these classes?(a) ComponentEvent(b) ContainerEvent(c) ItemEvent(d) InputEventThis question was addressed to me in an online quiz.My doubt stems from MouseEvent, TextEvent & WindowEvent Class topic in section Event Handling of Java |
|
Answer» CORRECT OPTION is (d) InputEvent Best EXPLANATION: NONE. |
|
| 14. |
Which of these methods can be used to change location of an event?(a) ChangePoint()(b) TranslatePoint()(c) ChangeCordinates()(d) TranslateCordinates()The question was posed to me in an interview.My enquiry is from MouseEvent, TextEvent & WindowEvent Class in portion Event Handling of Java |
|
Answer» RIGHT CHOICE is (B) TranslatePoint() For EXPLANATION: NONE. |
|
| 15. |
Which of these methods can be used to obtain the coordinates of a mouse?(a) getPoint()(b) getCoordinates()(c) getMouseXY()(d) getMouseCordinates()I had been asked this question in exam.Asked question is from MouseEvent, TextEvent & WindowEvent Class topic in portion Event Handling of Java |
|
Answer» Correct choice is (a) getPoint() |
|
| 16. |
Which of these are integer constants of TextEvent class?(a) TEXT_CHANGED(b) TEXT_FORMAT_CHANGED(c) TEXT_VALUE_CHANGED(d) TEXT_sIZE_CHANGEDI got this question during an online interview.My doubt is from MouseEvent, TextEvent & WindowEvent Class in division Event Handling of Java |
|
Answer» Correct choice is (c) TEXT_VALUE_CHANGED |
|
| 17. |
Which of these methods can be used to know the type of focus change?(a) typeFocus()(b) typeEventFocus()(c) isTemporary()(d) isPermanent()I got this question in an online quiz.I would like to ask this question from ComponentEvent, ContainerEvent & FocusEvent Class topic in section Event Handling of Java |
|
Answer» CORRECT answer is (c) isTemporary() Explanation: There are TWO TYPES of focus events – permanent and temporary. The isTemporary() METHOD indicates if this focus change is temporary, it RETURNS a Boolean value. |
|
| 18. |
Which of these events is generated when the window is closed?(a) TextEvent(b) MouseEvent(c) FocusEvent(d) WindowEventThis question was posed to me by my college director while I was bunking the class.This question is from MouseEvent, TextEvent & WindowEvent Class in section Event Handling of Java |
|
Answer» RIGHT OPTION is (d) WindowEvent Easiest EXPLANATION: A WindowEvent is GENERATED when a window is opened, CLOSE, activated or deactivated. |
|
| 19. |
Which of these events is generated when computer gains or loses input focus?(a) ComponentEvent(b) ContainerEvent(c) FocusEvent(d) InputEventI had been asked this question during an interview for a job.Query is from ComponentEvent, ContainerEvent & FocusEvent Class in section Event Handling of Java |
|
Answer» CORRECT ANSWER is (C) FocusEvent Explanation: NONE. |
|
| 20. |
FocusEvent is subclass of which of these classes?(a) ComponentEvent(b) ContainerEvent(c) ItemEvent(d) InputEventI had been asked this question in an internship interview.This is a very interesting question from ComponentEvent, ContainerEvent & FocusEvent Class topic in portion Event Handling of Java |
|
Answer» RIGHT ANSWER is (a) ComponentEvent Best EXPLANATION: NONE. |
|
| 21. |
Which of these are integer constants of ComponentEvent class?(a) COMPONENT_HIDDEN(b) COMPONENT_MOVED(c) COMPONENT_RESIZE(d) All of the mentionedThis question was posed to me by my college director while I was bunking the class.The above asked question is from ComponentEvent, ContainerEvent & FocusEvent Class topic in section Event Handling of Java |
|
Answer» The correct ANSWER is (d) All of the mentioned |
|
| 22. |
Which of these methods can be used to get reference to a component that was removed from a container?(a) getComponent()(b) getchild()(c) getContainerComponent()(d) getComponentChild()I had been asked this question in homework.The above asked question is from ComponentEvent, ContainerEvent & FocusEvent Class in chapter Event Handling of Java |
|
Answer» RIGHT answer is (b) getchild() Explanation: The getChild() METHOD returns a REFERENCE to the component that was added to or removed from the container. |
|
| 23. |
Which of these methods can be used to obtain the reference to the container that generated a ContainerEvent?(a) getContainer()(b) getContainerCommand()(c) getActionEvent()(d) getContainerEvent()The question was asked in class test.The query is from ComponentEvent, ContainerEvent & FocusEvent Class topic in chapter Event Handling of Java |
|
Answer» CORRECT answer is (d) getContainerEvent() For EXPLANATION I would SAY: NONE. |
|
| 24. |
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()The question was asked by my college director while I was bunking the class.Question is from ActionEvent & AdjustmentEvent Class in division Event Handling of Java |
|
Answer» Correct choice is (a) getValue() |
|
| 25. |
Which of these events is generated when the component is added or removed?(a) ComponentEvent(b) ContainerEvent(c) FocusEvent(d) InputEventI have been asked this question during an online interview.My question is taken from ComponentEvent, ContainerEvent & FocusEvent Class in chapter Event Handling of Java |
|
Answer» The correct answer is (B) CONTAINEREVENT |
|
| 26. |
Which of these events is generated when the size of an event is changed?(a) ComponentEvent(b) ContainerEvent(c) FocusEvent(d) InputEventThe question was posed to me in an interview for internship.My question is based upon ComponentEvent, ContainerEvent & FocusEvent Class in section Event Handling of Java |
|
Answer» CORRECT CHOICE is (a) ComponentEvent For explanation: A ComponentEvent is GENERATED when the size, position or visibility of a COMPONENT is changed. |
|
| 27. |
Which of these methods can be used to determine the type of adjustment event?(a) getType()(b) getEventType()(c) getAdjustmentType()(d) getEventObjectType()The question was asked in an online quiz.I'm obligated to ask this question of ActionEvent & AdjustmentEvent Class topic in chapter Event Handling of Java |
|
Answer» RIGHT CHOICE is (C) getAdjustmentType() EXPLANATION: NONE. |
|
| 28. |
Which of these methods can be used to know which key is pressed?(a) getKey()(b) getModifier()(c) getActionKey()(d) getActionEvent()I have been asked this question in an interview for job.My query is from ActionEvent & AdjustmentEvent Class in division Event Handling of Java |
|
Answer» The CORRECT choice is (b) getModifier() |
|
| 29. |
Which of these events is generated by scroll bar?(a) ActionEvent(b) KeyEvent(c) WindowEvent(d) AdjustmentEventThis question was posed to me in a national level competition.Origin of the question is ActionEvent & AdjustmentEvent Class topic in chapter Event Handling of Java |
|
Answer» CORRECT CHOICE is (d) AdjustmentEvent Best EXPLANATION: NONE. |
|
| 30. |
Which of these methods can be used to obtain the command name for invoking ActionEvent object?(a) getCommand()(b) getActionCommand()(c) getActionEvent()(d) getActionEventCommand()I got this question during an online exam.I need to ask this question from ActionEvent & AdjustmentEvent Class topic in division Event Handling of Java |
|
Answer» RIGHT OPTION is (B) getActionCommand() The EXPLANATION: NONE. |
|
| 31. |
Which of these are integer constants defined in ActionEvent class?(a) ALT_MASK(b) CTRL_MASK(c) SHIFT_MASK(d) All of the mentionedI had been asked this question in quiz.The question is from ActionEvent & AdjustmentEvent Class in portion Event Handling of Java |
|
Answer» The correct OPTION is (d) All of the mentioned |
|
| 32. |
Which of these methods can be used to determine the type of event?(a) getID()(b) getSource()(c) getEvent()(d) getEventObject()This question was posed to me in a job interview.Question is taken from Event Handling Basics topic in chapter Event Handling of Java |
|
Answer» CORRECT ANSWER is (a) getID() The BEST I can explain: getID() can be used to determine the TYPE of an event. |
|
| 33. |
Which of these events will be notified if scroll bar is manipulated?(a) ActionEvent(b) ComponentEvent(c) AdjustmentEvent(d) WindowEventThe question was posed to me in my homework.My doubt stems from Event Handling Basics in portion Event Handling of Java |
|
Answer» RIGHT ANSWER is (c) ADJUSTMENTEVENT To elaborate: AdjustmentEvent is GENERATED when a SCROLL bar is manipulated. |
|
| 34. |
Which of these events is generated when a button is pressed?(a) ActionEvent(b) KeyEvent(c) WindowEvent(d) AdjustmentEventThis question was posed to me by my school teacher while I was bunking the class.The doubt is from ActionEvent & AdjustmentEvent Class topic in portion Event Handling of Java |
|
Answer» The correct choice is (a) ActionEvent |
|
| 35. |
Which of these class is super class of all the events?(a) EventObject(b) EventClass(c) ActionEvent(d) ItemEventI have been asked this question by my school teacher while I was bunking the class.This is a very interesting question from Event Handling Basics in portion Event Handling of Java |
|
Answer» CORRECT choice is (a) EventObject The EXPLANATION is: EventObject class is a SUPER class of all the EVENTS and is defined in java.util package. |
|
| 36. |
Event class is defined in which of these libraries?(a) java.io(b) java.lang(c) java.net(d) java.utilThis question was posed to me in semester exam.The doubt is from Event Handling Basics topic in division Event Handling of Java |
|
Answer» CORRECT ANSWER is (d) java.util Explanation: NONE. |
|
| 37. |
Which of these methods are used to register a keyboard event listener?(a) KeyListener()(b) addKistener()(c) addKeyListener()(d) eventKeyboardListener()The question was posed to me in examination.I'm obligated to ask this question of Event Handling Basics in division Event Handling of Java |
|
Answer» The CORRECT choice is (c) addKeyListener() |
|
| 38. |
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 eventsThis question was addressed to me in final exam.I'm obligated to ask this question of Event Handling Basics in portion Event Handling of Java |
|
Answer» The CORRECT option is (a) An event is an object that DESCRIBES a state change in a source |
|
| 39. |
Which of these methods are used to register a mouse motion listener?(a) addMouse()(b) addMouseListener()(c) addMouseMotionListner()(d) eventMouseMotionListener()I had been asked this question in an international level competition.My query is from Event Handling Basics in chapter Event Handling of Java |
|
Answer» The CORRECT ANSWER is (C) addMouseMotionListner() |
|
| 40. |
What is a listener in context to event handling?(a) A listener is a variable that is notified when an event occurs(b) A listener is a object that is notified when an event occurs(c) A listener is a method that is notified when an event occurs(d) None of the mentionedI got this question during an interview for a job.I want to ask this question from Event Handling Basics topic in section Event Handling of Java |
|
Answer» The correct choice is (b) A LISTENER is a object that is notified when an event occurs |
|
| 41. |
Which of these packages contains all the classes and methods required for even handling in Java?(a) java.applet(b) java.awt(c) java.event(d) java.awt.eventI have been asked this question in an international level competition.My question is based upon Event Handling Basics in chapter Event Handling of Java |
|
Answer» The correct option is (d) java.awt.EVENT |
|