Java MCQs on ActionEvent & AdjustmentEvent class in Java Programming Language.
1. Which of these events is generated when a button is pressed? Answer: a 2. Which of these methods can be used to obtain the command name for invoking ActionEvent object? Answer: b 3. Which of these are integer constants defined in ActionEvent class? Answer: d 4. Which of these methods can be used to know which key is pressed? Answer: b 5. Which of these events is generated by scroll bar? Answer: d 6. Which of these methods can be used to determine the type of adjustment event? Answer: c 7. Which of these methods can be used to know the degree of adjustment made by the user? Answer: a 8. Which of these constant value will change when the button at the end of scroll bar was clicked to increase its value? Answer: d
a) ActionEvent
b) KeyEvent
c) WindowEvent
d) AdjustmentEvent
Clarification: Action event is generated when a button is pressed, a list item is double-clicked or a menu item is selected.
a) getCommand()
b) getActionCommand()
c) getActionEvent()
d) getActionEventCommand()
Clarification: None.
a) ALT_MASK
b) CTRL_MASK
c) SHIFT_MASK
d) All of the mentioned
Clarification: Action event defines 4 integer constants ALT_MASK, CTRL_MASK, SHIFT_MASK and ACTION_PERFORMED
a) getKey()
b) getModifier()
c) getActionKey()
d) getActionEvent()
Clarification: The getModifiers() methods returns a value that indicates which modifiers keys (ALT, CTRL, META, SHIFT) were pressed when the event was generated.
a) ActionEvent
b) KeyEvent
c) WindowEvent
d) AdjustmentEvent
Clarification: None.
a) getType()
b) getEventType()
c) getAdjustmentType()
d) getEventObjectType()
Clarification: None.
a) getValue()
b) getAdjustmentType()
c) getAdjustmentValue()
d) getAdjustmentAmount()
Clarification: The amount of the adjustment can be obtained from the getvalue() method, it returns an integer value corresponding to the amount of adjustment made.
a) BLOCK_DECREMENT
b) BLOCK_INCREMENT
c) UNIT_DECREMENT
d) UNIT_INCREMENT
Clarification: UNIT_INCREMENT VALUE will change when the button at the end of scroll bar was clicked to increase its value.