MCQOPTIONS
Saved Bookmarks
This section includes 657 Mcqs, each offering curated multiple-choice questions to sharpen your Testing Subject knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What is the range of numbers returned by Math.random() method? |
| A. | -1.0 to 1.0 |
| B. | -1 to 1 |
| C. | 0 to 100 |
| D. | 0.0 to 1.0 |
| Answer» E. | |
| 2. |
What is the return type of Math.random() method? |
| A. | Integer |
| B. | Double |
| C. | String |
| D. | Boolean |
| Answer» C. String | |
| 3. |
Which method is used to generate boolean random values in java? |
| A. | nextBoolean() |
| B. | randomBoolean() |
| C. | previousBoolean() |
| D. | generateBoolean() |
| Answer» B. randomBoolean() | |
| 4. |
Which class is used to generate random number? |
| A. | java.lang.Object |
| B. | java.util.randomNumber |
| C. | java.util.Random |
| D. | java.util.Object |
| Answer» D. java.util.Object | |
| 5. |
Which of these is superclass of all Adapter classes? |
| A. | Applet |
| B. | ComponentEvent |
| C. | Event |
| D. | InputEvent |
| Answer» B. ComponentEvent | |
| 6. |
Which of these methods is defined in MouseMotionAdapter class? |
| A. | mouseDragged() |
| B. | mousePressed() |
| C. | mouseReleased() |
| D. | mouseClicked() |
| Answer» B. mousePressed() | |
| 7. |
Which of these methods will be invoked if a character is entered? |
| A. | keyPressed() |
| B. | keyReleased() |
| C. | keyTyped() |
| D. | keyEntered() |
| Answer» D. keyEntered() | |
| 8. |
Which of these methods will respond when you click any button by mouse? |
| A. | mouseClicked() |
| B. | mouseEntered() |
| C. | mousePressed() |
| D. | all of the mentioned |
| Answer» E. | |
| 9. |
Which of these interfaces define a method itemStateChanged()? |
| A. | ComponentListener |
| B. | ContainerListener |
| C. | ActionListener |
| D. | ItemListener |
| Answer» E. | |
| 10. |
Which of these interfaces define four methods? |
| A. | ComponentListener |
| B. | ContainerListener |
| C. | ActionListener |
| D. | InputListener |
| Answer» B. ContainerListener | |
| 11. |
Which of these interfaces define a method actionPerformed()? |
| A. | ComponentListener |
| B. | ContainerListener |
| C. | ActionListener |
| D. | InputListener |
| Answer» D. InputListener | |
| 12. |
Which of these interfaces handles the event when a component is added to a container? |
| A. | ComponentListener |
| B. | ContainerListener |
| C. | FocusListener |
| D. | InputListener |
| Answer» C. FocusListener | |
| 13. |
Which of these packages contains all the event handling interfaces? |
| A. | java.lang |
| B. | java.awt |
| C. | java.awt.event |
| D. | java.event |
| Answer» D. java.event | |
| 14. |
Which of these is superclass of WindowEvent class? |
| A. | WindowEvent |
| B. | ComponentEvent |
| C. | ItemEvent |
| D. | InputEvent |
| Answer» C. ItemEvent | |
| 15. |
Which of these are constants defined in WindowEvent class? |
| A. | WINDOW_ACTIVATED |
| B. | WINDOW_CLOSED |
| C. | WINDOW_DEICONIFIED |
| D. | All of the mentioned |
| Answer» E. | |
| 16. |
Which of these methods is used to get x coordinate of the mouse? |
| A. | getX() |
| B. | getXCoordinate() |
| C. | getCoordinateX() |
| D. | getPointX() |
| Answer» B. getXCoordinate() | |
| 17. |
MouseEvent is subclass of which of these classes? |
| A. | ComponentEvent |
| B. | ContainerEvent |
| C. | ItemEvent |
| D. | InputEvent |
| Answer» E. | |
| 18. |
Which of these methods is used to obtain the object that generated a WindowEvent? |
| A. | getMethod() |
| B. | getWindow() |
| C. | getWindowEvent() |
| D. | getWindowObject() |
| Answer» C. getWindowEvent() | |
| 19. |
Which of these are integer constants of TextEvent class? |
| A. | TEXT_CHANGED |
| B. | TEXT_FORMAT_CHANGED |
| C. | TEXT_VALUE_CHANGED |
| D. | TEXT_sIZE_CHANGED |
| Answer» D. TEXT_sIZE_CHANGED | |
| 20. |
Which of these methods can be used to change location of an event? |
| A. | ChangePoint() |
| B. | TranslatePoint() |
| C. | ChangeCordinates() |
| D. | TranslateCordinates() |
| Answer» C. ChangeCordinates() | |
| 21. |
Which of these methods can be used to obtain the coordinates of a mouse? |
| A. | getPoint() |
| B. | getCoordinates() |
| C. | getMouseXY() |
| D. | getMouseCordinates() |
| Answer» B. getCoordinates() | |
| 22. |
Which of these events is generated when the a window is closed? |
| A. | TextEvent |
| B. | MouseEvent |
| C. | FocusEvent |
| D. | WindowEvent |
| Answer» E. | |
| 23. |
Which of these is superclass of ContainerEvent class? |
| A. | WindowEvent |
| B. | ComponentEvent |
| C. | ItemEvent |
| D. | InputEvent |
| Answer» C. ItemEvent | |
| 24. |
Which of these methods can be used to know the type of focus change? |
| A. | typeFocus() |
| B. | typeEventFocus() |
| C. | isTemporary() |
| D. | isPermanent() |
| Answer» D. isPermanent() | |
| 25. |
FocusEvent is subclass of which of these classes? |
| A. | ComponentEvent |
| B. | ContainerEvent |
| C. | ItemEvent |
| D. | InputEvent |
| Answer» B. ContainerEvent | |
| 26. |
Which of these events is generated when computer gains or losses input focus? |
| A. | ComponentEvent |
| B. | ContainerEvent |
| C. | FocusEvent |
| D. | InputEvent |
| Answer» D. InputEvent | |
| 27. |
Which of these are integer constants of ComponentEvent class? |
| A. | COMPONENT_HIDDEN |
| B. | COMPONENT_MOVED |
| C. | COMPONENT_RESIZE |
| D. | All of the mentioned |
| Answer» E. | |
| 28. |
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() |
| Answer» C. getContainerComponent() | |
| 29. |
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() |
| Answer» E. | |
| 30. |
Which of these events is generated when the component is added or removed? |
| A. | ComponentEvent |
| B. | ContainerEvent |
| C. | FocusEvent |
| D. | InputEvent |
| Answer» C. FocusEvent | |
| 31. |
Which of these events is generated when the size of an event is changed? |
| A. | ComponentEvent |
| B. | ContainerEvent |
| C. | FocusEvent |
| D. | InputEvent |
| Answer» B. ContainerEvent | |
| 32. |
Which of these constant value will change when the button at the end of scroll bar was clicked to increase its value? |
| A. | BLOCK_DECREMENT |
| B. | BLOCK_INCREMENT |
| C. | UNIT_DECREMENT |
| D. | UNIT_INCREMENT |
| Answer» E. | |
| 33. |
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() |
| Answer» B. getAdjustmentType() | |
| 34. |
Which of these methods can be used to determine the type of adjustment event? |
| A. | getType() |
| B. | getEventType() |
| C. | getAdjustmentType() |
| D. | getEventObjectType() |
| Answer» D. getEventObjectType() | |
| 35. |
Which of these events is generated by scroll bar? |
| A. | ActionEvent |
| B. | KeyEvent |
| C. | WindowEvent |
| D. | AdjustmentEvent |
| Answer» E. | |
| 36. |
Which of these methods can be used to know which key is pressed? |
| A. | getKey() |
| B. | getModifier() |
| C. | getActionKey() |
| D. | getActionEvent() |
| Answer» C. getActionKey() | |
| 37. |
Which of these are integer constants defined in ActionEvent class? |
| A. | ALT_MASK |
| B. | CTRL_MASK |
| C. | SHIFT_MASK |
| D. | All of the mentioned |
| Answer» E. | |
| 38. |
Which of these methods can be used to obtain the command name for invoking ActionEvent object? |
| A. | getCommand() |
| B. | getActionCommand() |
| C. | getActionEvent() |
| D. | getActionEventCommand() |
| Answer» C. getActionEvent() | |
| 39. |
Which of these events is generated when a button is pressed? |
| A. | ActionEvent |
| B. | KeyEvent |
| C. | WindowEvent |
| D. | AdjustmentEvent |
| Answer» B. KeyEvent | |
| 40. |
Which of these events will be generated if we close an applet’s window? |
| A. | ActionEvent |
| B. | ComponentEvent |
| C. | AdjustmentEvent |
| D. | WindowEvent |
| Answer» E. | |
| 41. |
Which of these events will be notified if scroll bar is manipulated? |
| A. | ActionEvent |
| B. | ComponentEvent |
| C. | AdjustmentEvent |
| D. | WindowEvent |
| Answer» D. WindowEvent | |
| 42. |
Which of these class is super class of all the events? |
| A. | EventObject |
| B. | EventClass |
| C. | ActionEvent |
| D. | ItemEvent |
| Answer» B. EventClass | |
| 43. |
Which of these methods can be used to determine the type of event? |
| A. | getID() |
| B. | getSource() |
| C. | getEvent() |
| D. | getEventObject() |
| Answer» B. getSource() | |
| 44. |
Event class is defined in which of these libraries? |
| A. | java.io |
| B. | java.lang |
| C. | java.net |
| D. | java.util |
| Answer» E. | |
| 45. |
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 mentioned |
| Answer» C. A listener is a method that is notified when an event occurs | |
| 46. |
Which of these methods are used to register a mouse motion listener? |
| A. | addMouse() |
| B. | addMouseListener() |
| C. | addMouseMotionListner() |
| D. | eventMouseMotionListener() |
| Answer» D. eventMouseMotionListener() | |
| 47. |
Which of these methods are used to register a keyboard event listener? |
| A. | KeyListener() |
| B. | addKistener() |
| C. | addKeyListener() |
| D. | eventKeyboardListener() |
| Answer» D. eventKeyboardListener() | |
| 48. |
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 events |
| Answer» B. An event is an object that describes a state change in processing | |
| 49. |
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.event |
| Answer» E. | |
| 50. |
What does public int start() return? |
| A. | returns start index of the input string |
| B. | returns start index of the current match |
| C. | returns start index of the previous match |
| D. | none of the mentioned |
| Answer» D. none of the mentioned | |