Java Questions & Answers – ActionEvent & AdjustmentEvent Class

This section of our 1000+ Java MCQs focuses on ActionEvent & AdjustmentEvent class in Java Programming Language.

1. Which of these events is generated when a button is pressed?
a) ActionEvent
b) KeyEvent
c) WindowEvent
d) AdjustmentEvent
View Answer

Answer: a
Explanation: Action event is generated when a button is pressed, a list item is double-clicked or a menu item is selected.

2. Which of these methods can be used to obtain the command name for invoking ActionEvent object?
a) getCommand()
b) getActionCommand()
c) getActionEvent()
d) getActionEventCommand()
View Answer

Answer: b
Explanation: None.

3. Which of these are integer constants defined in ActionEvent class?
a) ALT_MASK
b) CTRL_MASK
c) SHIFT_MASK
d) All of the mentioned
View Answer

Answer: d
Explanation: Action event defines 4 integer constants ALT_MASK, CTRL_MASK, SHIFT_MASK and ACTION_PERFORMED
advertisement
advertisement

4. Which of these methods can be used to know which key is pressed?
a) getKey()
b) getModifier()
c) getActionKey()
d) getActionEvent()
View Answer

Answer: b
Explanation: The getModifiers() methods returns a value that indicates which modifiers keys (ALT, CTRL, META, SHIFT) were pressed when the event was generated.

5. Which of these events is generated by scroll bar?
a) ActionEvent
b) KeyEvent
c) WindowEvent
d) AdjustmentEvent
View Answer

Answer: d
Explanation: None.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

6. Which of these methods can be used to determine the type of adjustment event?
a) getType()
b) getEventType()
c) getAdjustmentType()
d) getEventObjectType()
View Answer

Answer: c
Explanation: None.

7. 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()
View Answer

Answer: a
Explanation: The amount of the adjustment can be obtained from the getvalue() method, it returns an integer value corresponding to the amount of adjustment made.
advertisement

8. 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
View Answer

Answer: d
Explanation: UNIT_INCREMENT VALUE will change when the button at the end of scroll bar was clicked to increase its value.

Sanfoundry Global Education & Learning Series – Java Programming Language.

advertisement

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.