Explore topic-wise MCQs in Technical Programming.

This section includes 1671 Mcqs, each offering curated multiple-choice questions to sharpen your Technical Programming knowledge and support exam preparation. Choose a topic below to get started.

701.

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

What is the return type of Math.random() method?

A. Integer
B. Double
C. String
D. Boolean
Answer» C. String
703.

Which method is used to generate boolean random values in java?

A. nextBoolean()
B. randomBoolean()
C. previousBoolean()
D. generateBoolean()
Answer» B. randomBoolean()
704.

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

Which of these is superclass of all Adapter classes?

A. Applet
B. ComponentEvent
C. Event
D. InputEvent
Answer» B. ComponentEvent
706.

Which of these methods is defined in MouseMotionAdapter class?

A. mouseDragged()
B. mousePressed()
C. mouseReleased()
D. mouseClicked()
Answer» B. mousePressed()
707.

Which of these methods will be invoked if a character is entered?

A. keyPressed()
B. keyReleased()
C. keyTyped()
D. keyEntered()
Answer» D. keyEntered()
708.

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

Which of these interfaces define a method itemStateChanged()?

A. ComponentListener
B. ContainerListener
C. ActionListener
D. ItemListener
Answer» E.
710.

Which of these interfaces define four methods?

A. ComponentListener
B. ContainerListener
C. ActionListener
D. InputListener
Answer» B. ContainerListener
711.

Which of these interfaces define a method actionPerformed()?

A. ComponentListener
B. ContainerListener
C. ActionListener
D. InputListener
Answer» D. InputListener
712.

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

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

Which of these is superclass of WindowEvent class?

A. WindowEvent
B. ComponentEvent
C. ItemEvent
D. InputEvent
Answer» C. ItemEvent
715.

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

Which of these methods is used to get x coordinate of the mouse?

A. getX()
B. getXCoordinate()
C. getCoordinateX()
D. getPointX()
Answer» B. getXCoordinate()
717.

MouseEvent is subclass of which of these classes?

A. ComponentEvent
B. ContainerEvent
C. ItemEvent
D. InputEvent
Answer» E.
718.

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()
719.

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

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

A. ChangePoint()
B. TranslatePoint()
C. ChangeCordinates()
D. TranslateCordinates()
Answer» C. ChangeCordinates()
721.

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()
722.

Which of these events is generated when the a window is closed?

A. TextEvent
B. MouseEvent
C. FocusEvent
D. WindowEvent
Answer» E.
723.

Which of these is superclass of ContainerEvent class?

A. WindowEvent
B. ComponentEvent
C. ItemEvent
D. InputEvent
Answer» C. ItemEvent
724.

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()
725.

FocusEvent is subclass of which of these classes?

A. ComponentEvent
B. ContainerEvent
C. ItemEvent
D. InputEvent
Answer» B. ContainerEvent
726.

Which of these events is generated when computer gains or losses input focus?

A. ComponentEvent
B. ContainerEvent
C. FocusEvent
D. InputEvent
Answer» D. InputEvent
727.

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

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()
729.

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

Which of these events is generated when the component is added or removed?

A. ComponentEvent
B. ContainerEvent
C. FocusEvent
D. InputEvent
Answer» C. FocusEvent
731.

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

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

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()
734.

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()
735.

Which of these events is generated by scroll bar?

A. ActionEvent
B. KeyEvent
C. WindowEvent
D. AdjustmentEvent
Answer» E.
736.

Which of these methods can be used to know which key is pressed?

A. getKey()
B. getModifier()
C. getActionKey()
D. getActionEvent()
Answer» C. getActionKey()
737.

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

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()
739.

Which of these events is generated when a button is pressed?

A. ActionEvent
B. KeyEvent
C. WindowEvent
D. AdjustmentEvent
Answer» B. KeyEvent
740.

Which of these events will be generated if we close an applet’s window?

A. ActionEvent
B. ComponentEvent
C. AdjustmentEvent
D. WindowEvent
Answer» E.
741.

Which of these events will be notified if scroll bar is manipulated?

A. ActionEvent
B. ComponentEvent
C. AdjustmentEvent
D. WindowEvent
Answer» D. WindowEvent
742.

Which of these class is super class of all the events?

A. EventObject
B. EventClass
C. ActionEvent
D. ItemEvent
Answer» B. EventClass
743.

Which of these methods can be used to determine the type of event?

A. getID()
B. getSource()
C. getEvent()
D. getEventObject()
Answer» B. getSource()
744.

Event class is defined in which of these libraries?

A. java.io
B. java.lang
C. java.net
D. java.util
Answer» E.
745.

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

Which of these methods are used to register a mouse motion listener?

A. addMouse()
B. addMouseListener()
C. addMouseMotionListner()
D. eventMouseMotionListener()
Answer» D. eventMouseMotionListener()
747.

Which of these methods are used to register a keyboard event listener?

A. KeyListener()
B. addKistener()
C. addKeyListener()
D. eventKeyboardListener()
Answer» D. eventKeyboardListener()
748.

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

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

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