This set of Java Questions and Answers for Aptitude test on “MouseEvent, TextEvent & WindowEvent Class”.
1. Which of these events is generated when the window is closed? Answer: d 2. Which of these methods can be used to obtain the coordinates of a mouse? Answer: a 3. Which of these methods can be used to change location of an event? Answer: b 4. Which of these are integer constants of TextEvent class? Answer: c 5. Which of these methods is used to obtain the object that generated a WindowEvent? Answer: b 6. MouseEvent is subclass of which of these classes? Answer: d 7. Which of these methods is used to get x coordinate of the mouse? Answer: a 8. Which of these are constants defined in WindowEvent class? Answer: d 9. Which of these is superclass of WindowEvent class? Answer: b
a) TextEvent
b) MouseEvent
c) FocusEvent
d) WindowEvent
Clarification: A WindowEvent is generated when a window is opened, close, activated or deactivated.
a) getPoint()
b) getCoordinates()
c) getMouseXY()
d) getMouseCordinates()
Clarification: getPoint() method can be used to obtain coordinates of a mouse, alternatively we can use getX() and getY() methods for x and y coordinates of mouse respectively.
a) ChangePoint()
b) TranslatePoint()
c) ChangeCordinates()
d) TranslateCordinates()
Clarification: None.
a) TEXT_CHANGED
b) TEXT_FORMAT_CHANGED
c) TEXT_VALUE_CHANGED
d) TEXT_sIZE_CHANGED
Clarification: TextEvent defines a single integer constant TEXT_VALUE_CHANGED.
a) getMethod()
b) getWindow()
c) getWindowEvent()
d) getWindowObject()
Clarification: None.
a) ComponentEvent
b) ContainerEvent
c) ItemEvent
d) InputEvent
Clarification: None.
a) getX()
b) getXCoordinate()
c) getCoordinateX()
d) getPointX()
Clarification: getX() and getY() are used to obtain X AND Y coordinates of the mouse.
a) WINDOW_ACTIVATED
b) WINDOW_CLOSED
c) WINDOW_DEICONIFIED
d) All of the mentioned
Clarification: WindowEvent class defines 7 constants – WINDOW_ACTIVATED, WINDOW_CLOSED, WINDOW_OPENED, WINDOW_DECONIFIED, WINDOW_CLOSING, WINDOW_DEACTIVATED, WINDOW_ICONIFIED.
a) WindowEvent
b) ComponentEvent
c) ItemEvent
d) InputEvent
Clarification: ComponentEvent is superclass of ContainerEvent, FocusEvent, KeyEvent, MouseEvent and WindowEvent.