Advance Java Solutions Pepper.
Advance Java Solutions Pepper.
The _______ arranges components in rows and columns and makes all components the
same size.
Options:
a) FlowLayout
✓ b) GridLayout
c) GridBagLayout
d) CardLayout
Options:
a) ButtonListener
b) ClickListener
c) PressListener
✓ d) ActionListener
Options:
a) RadioButton
b) OptionButton
✓c) CheckboxGroup
d) Button
✓b) TextField
c) List
d) Menu
5. To create window with title bar which of the following class is used?
Options:
✓a) Frame
b) Panel
c) Applet
Options:
a) Dialog
b) FileDialogBox
✓c) FileDialog
d) SystemDialog
Options:
Options:
a) Platform dependent
Options:
✓a) Controller
b) Container
c) Class
d) None of These
Options:
a) JTable
✓b) JTree
c) JTabbedPane
d) JComboBox
Options:
✓a) setToolTipText()
b) addToolTipText()
c) showToolTipText()
d) displayToolTipText()
12. Which of the following is true about AWT and Swing Component?
Options:
✓a) AWT Components create a process where as Swing Component create a thread
b) AWT Components create a thread where as Swing Component create a process
Options:
a) EventClass
✓b) EventObject
c) AWTEvent
d) AWTClass
14. A _______ is an object that is notified when an event occurs in delegation event model.
Options:
a) Event
b) Source
c) User
✓d) Listener
Options:
✓a) ScrollBar
b) List
c) Choice
d) TextField
16. In Java, an event is an _______ which specifies the change of state in the source.
Options:
a) loop
b) statement
✓c) object
d) keyword
✓a) itemStateChanged()
b) itemStateModified()
c) itemStateManipulated()
d) itemConditionChanged()
Options:
a) KeyboardEvent
b) InsertEvent
c) EnterEvent
✓d) InputEvent
Options:
a) 1
b) 2
✓c) 3
d) 4
Options:
a) WindowListener
✓b) MouseMotionListener
c) MouseListener
d) MouseDraggedListener
Options:
a) ActionListener
b) ItemListener
c) CompnenetListener
✓d) InputEvent
22. Name the event that gets generated when a button is clicked.
Options:
✓a) ActionEvent
b) ClickEvent
c) PressEvent
d) MouseClickedEvent
23. Name the method defined in EventObject class that returns the Object generated from the
event. Select the one correct answer.
Options:
a) readSource()
b) findSource()
c) returnSource()
✓d) getSource()
Options:
a) Frame
b) MenuItem
✓c) Label
d) Choice
Options:
a) MouseListener
✓b) MouseMotionListener
c) ComponentListener
d) ContainerListener
Options:
a) MouseEvent
b) ActionEvent
c) ChangeEvent
✓d) AdjustmentEvent
27. Which statements should we add inorder to following code to handle events for
MenuItems
Import java.awt.*; import java.awt.event.*;
Label l;
MenuDemo() {
Lab.setText(“New Clicked”); }}
Options:
a) ItemListener, addItemListener(this), itemStateChanged(ItemEvent ie)
Options:
a)1,2
b)2,3
✓c)3,4
d)4,1
1. All events will be processed in the order, the listener were added.
2. Using the adapter approach to event handling means creating blank method bodies for all
event methods.
Options:
a) 1,2
b) 2,3
✓c) 3,4
d) 4,1
✓a) setIcon(ImageIcon i)
b) displayIcon(ImageIcon i)
c) addIcon(ImageIcon i)
d) insertIcon(ImageIcon i)
TextField tf;
AEvent(){
Tf=new TextField(); tf.setBounds(60,50,170,20);
Add(b);add(tf);
setSize(3600,300); setLayout(null);
setVisible(true);
Tf.setText(“Welcome”); }
New AEvent(); }
Options:
a) b.addItemListener()
b) b.addMouseListener()
c) b.addKeyListener()
✓d) b.addActionListener()
32. Which Event is generated when a component is added to or removed from a container?
A) AdjustmentEvent
✓b) ContainerEvent
c) ActionEvent
d) ComponentEvent
Import javax.swing.*;
JFrame f;
Radio(){
F=new JFrame(); JRadioButton r1=new JRadioButton(“A) Male”);
R1.setBounds(50,100,70,30); r2.setBounds(50,150,70,30);
f.setVisible(true); }
new Radio(); } }
Options:
c) f.insert(r1); f.insert(r2);
d) insert(r1); insert(r2);
34. Which of the following is not a constructor of Jtree?
Options:
a) JTree(Vector v)
b) JTree(Object obj[])
✓c) JTree(int x)
d) JTree(TreeNode tn)
35. Identify missing statement if you wannt to display a frame with a button added:
Import javax.swing.*;
b.setBounds(130,100,100, 40)
f.add(b);
f.setSize(400,500);
f.setLayout(null);
Options:
a) No statement missing
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c=f.getContentPane();
c.add(new JToggleButton(“North”),BorderLayout.NORTH);
c.add(new JToggleButton(“North”),BorderLayout.EAST);
c.add(new JToggleButton(“North”),BorderLayout.WEST);
c.add(new JToggleButton(“North”),BorderLayout.SOUTH);
c.add(new JToggleButton(“North”),BorderLayout.CENTER);
f.setSize(300,300); f.setVisible(true); } }
Options:
a) in c.add(new JToggleButton(“North”),BorderLayout.EAST);
b) in c.add(new JToggleButton(“North”),BorderLayout.WEST);
c) in c.add(new JToggleButton(“North”),BorderLayout.SOUTH);
d) in c.add(new JToggleButton(“North”),BorderLayout.CENTER);
Options:
a) JTabbedPane object displays rows of data.
Figure:
c) new TextArea();
40. Which control is a combination of text field and dropdown list? 1 N U 2 combo boxes
a) List
b) Choice