-
Which of the following may contain a menu bar?
A) A panelB) A frameC) An appletD) A menu bar
-
-
What is the difference between scrollbar and scrollpane(Select Multiple)
A) Scrollbar is a component while scrollpane is a containerB) Scrollbar handles its own events while scrollpane does notC) Scrollpane handles its own events and performs its own scrolling.D) All of the above.
-
-
Which layout should you use to organize the components of a container in a tabular form?
A) CardLayoutB) BorederLayoutC) FlowLayoutD) GridLayout
-
Which method will cause a Frame to be displayed?
A) show( )B) setVisible( )C) display( )D) displayFrame( )
-
Which TextComponent method is used to set a TextComponent to the read-only state ?
A) setReadOnly()B) setEditOnly()C) setEditable()D) setTextReadOnly()
-
How would you set the color of a graphics context called g to cyan?
A) g.setColor(Color.cyan);B) g.setCurrentColor(cyan);C) g.setColor("Color.cyan");D) g.setColor("cyan’);E) g.setColor(new Color(cyan));
-
Which of the following components allow multiple selections? (Select Multiple)
A) Non-exclusive Checkboxes.B) Radio buttons.C) Choice.D) List.
-
Which of the following classes have a paint( ) method? (Select Multiple)
A) CanvasB) ImageC) FrameD) Graphics
-
Which method is used to set the text of a Label object?
A) setText( )B) setLabel( )C) setTextLabel( )D) setLabelText( )
-
The layout of a container can be altered by using which of the following methods :-
A) setLayout(aLayoutManager)B) layout(aLayoutManager)C) addLayout(aLayoutManager)D) setLayoutManager(aLayoutManager)
-
Which of the following layout managers honours the preferred size of a component:
A) CardLayoutB) FlowLayoutC) BorderLayoutD) GridLayout
-
How do you indicate where a component will be positioned using Flowlayout?
A) North, South, East, WestB) Assign a row/column grid referenceC) Pass a X/Y percentage parameter to the add methodD) Do nothing, the FlowLayout will position the component
-
Which of the following are passed as an argument to the paint( ) method?
A) A Canvas objectB) A Graphics objectC) An Image objectD) A paint object
-
Which of the following are true? (Select Multiple)
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.
-
Which Component method is used to access a component's immediate Container?
A) getVisible()B) getImmediateC) getParent()D) getContainer()
-
When two or more objects are added as listeners for the same event, which listener is first invoked to handle the event?
A) The first object that was added as listener.B) The last object that was added as listener.C) There is no way to determine which listener will be invoked first.D) It is impossible to have more than one listener for a given event.
-
Which of the following are direct or indirect subclasses of Component?
A) ButtonB) LabelC) CheckboxMenuItemD) ToolbarE) Frame
-
Which of the following methods are invoked by the AWT to support paint and repaint operations?
A) paint( )B) repaint( )C) draw( )D) redraw( )
Java Swing Interview Qustions
Ans