0% found this document useful (0 votes)
137 views6 pages

AJP ComponentEvent MCQ

The document discusses various types of ComponentEvents in Java. It provides 30 multiple choice questions with answers about events generated when a component changes size or position, subclasses of ComponentEvent like FocusEvent and WindowEvent, and methods like getComponent() and getChild() that return the component that generated an event. Key points covered include: ComponentEvent is generated when a component's size or position changes, ContainerEvent when a component is added or removed from a container, and WindowEvent when an applet window is closed.

Uploaded by

Ak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
137 views6 pages

AJP ComponentEvent MCQ

The document discusses various types of ComponentEvents in Java. It provides 30 multiple choice questions with answers about events generated when a component changes size or position, subclasses of ComponentEvent like FocusEvent and WindowEvent, and methods like getComponent() and getChild() that return the component that generated an event. Key points covered include: ComponentEvent is generated when a component's size or position changes, ContainerEvent when a component is added or removed from a container, and WindowEvent when an applet window is closed.

Uploaded by

Ak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

MCQs on ComponentEvent

1.Which of these events is generated when the size of an event is changed?


a) ComponentEvent
b) ContainerEvent
c) FocusEvent
d) InputEvent
Ans. a) ComponentEvent
2.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()

Ans. b) getchild()
3.FocusEvent is subclass of which of these classes?

a) ComponentEvent
b) ContainerEvent
c) ItemEvent
d) InputEvent

Ans. a) ComponentEvent
4.Which of these is superclass of ContainerEvent class?

a) WindowEvent
b) ComponentEvent
c) ItemEvent
d) InputEvent

Ans. b)ComponentEvent
5.Which of these events is generated when the component is added or removed?
a) ComponentEvent
b) ContainerEvent
c) FocusEvent
d) InputEvent
Ans. b) ContainerEvent

6.Which of these are integer constants of ComponentEvent class?

a) COMPONENT_HIDDEN
b) COMPONENT_MOVED
c) COMPONENT_RESIZE
d) All of the mentioned

Ans. d) All of the mentioned


7.Which of the following component generates ActionEvent ?

a) Window
b) RadioButton
c) ScrollBar
d) None of these
Ans. d) None of these
8. Which of these is super class of WindowEvent class?
a) ComponentEvent
b) ContainerEvent
c) MouseEvent
d) KeyEvent
Ans. a)ComponentEvent
9.Which of these not a constants defined in ComponentEvent class?

a) COMPONENT_HIDDEN
b) COMPONENT_MOVED
c) COMPONENT_RESIZE
d) COMPONENT_SIZE
Ans. d) COMPONENT_SIZE
10. Which of the following components generate action events?
a) Buttons
b) Labels
c)Check boxes
d)Windows
Ans: a) Buttons

11. Which of the following are true?


a) A component may handle its own events by adding itself as an event listener.
b) A component may handle its own events by overriding its event-dispatching method.
c)A component may not handle oits own events.
d)A component may handle its own events only if it implements the handleEvent ()
method.
Ans. a) A component may handle its own events by adding itself as an event listener.
b) A component may handle its own events by overriding its event-dispatching method.

12. __________are used to invoke events on the parent component from child components in
the hierarchy of components.

a) Inputs
b) Outputs
c) Blueprints
d) hooks
Ans. b) Outputs

13. Components are basically directives with views but we cannot implement them by
nesting/composing other directives and components.

a) True
b) False
Ans. b) False
14. Components conduct a provider lookup upwards because each component has its own
built-in _________ which is specific to it.

a) service
b) instance
c) hook
d) injector
Ans. d) injector

15. A component is a class decorated with some metadata and ________ are functions that can
modify a class.

a) Selectors
b) Decorators
c) Mentors
d) Bindings
Ans. b) Decorators
16. The superclass of ContainerEvent, FocusEvent and WindowEvent is _________
a) ActionEvent
b) ItemEvent
c) KeyEvent
d) ComponentEvent
Ans. d) ComponentEvent
17. Which methods are defined by ComponentListener
a) void componentHidden(ComponentEvent obj)
b) void componenthidden(componentevent obj)
c) void Componenthidden(ComponentEvent obj)
d) None of these
Ans. a) void componentHidden(ComponentEvent obj)
18. Which of these methods is used to obtain the object that generated a ComponentEvent.
a) GetContainer()
b) getContainer()
c) getcontainer()
d) None of these
Ans. b) getContainer()
19. windowEvent is a subclass of _________________
a) ComponentEvent()
b) Componentevent()
c) componentevent()
d) None of these
Ans. a) ComponentEvent()
20. If we close an applet window _________ events will be generated

a) ActionEvent
b) ComponentEvent
c) AdjustmentEvent
d) WindowEvent
Ans. d) WindowEvent
21. A ComponentEvent is generated when the size, ________, or visibility of a component is
changed.

a) position
b) place
c) Both (a) & (b)
d) None of these
Ans. a) position

22. Which class defines integer constants that can be used to identify them.

a) ItemEvent
b) ComponentEvent
c) KeyEvent
d) None of these
Ans. b) ComponentEvent
23. The COMPONENT_HIDDEN constants meaning is ___________.
a) The component was moved.
b) The component was resized.
c) The component was hidden.
d) None of these
Ans. c) The component was hidden.
24. Which of these ComponentEvent Constructor.
a) ComponentEvent(Component src, int type)
b) componentevent(Component src, int type)
c) Componentevent(Component src, int type)
d) None of these.
Ans. a) ComponentEvent(Component src, int type)
25. Which of these is superclass of FocusEvent class.
a) Component event
b) componentevent
c) WindowEvent
d) ComponentEvent
Ans. d) ComponentEvent
26. Which of these is superclass of MouseEvent class.
a) ComponentEvent
b) componentevent
c) WindowEvent
d) None of these
Ans. d) ComponentEvent.
27. Which method returns the component that generated the event.
a) GetComponent()
b) getComponent()
c) getcomponent()
d) None of these
Ans. b) getComponent().

28. The getComponent() method returns the component that generated the ________.
a) event
b) object
c) All of these
d) None of these
Ans. a) event
29. Which of these methods can be used to get reference to a component that was added from a
container.
a) getComponentChild()
b) getComponent()
c) getchild()
d) None of these
Ans. c) getchild()
30. What is the use of getChild() method.
a) component added to or removed.
b) component created
c) Both (a) & (b)
d) None of these
Ans. a) component added to or removed.

You might also like