0% found this document useful (0 votes)
45 views2 pages

Practice Test 2022-23

1. AWT stands for Abstract Window Toolkit and is used for creating GUIs in Java. 2. A Label control does not support interaction with the user while Button, List, and Scrollbar controls do support interaction. 3. A Container component is one that can contain other components like buttons, textfields, and labels. 4. The setTitle() method is used to display a title on the title bar of a Frame.

Uploaded by

Vijay Bande
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)
45 views2 pages

Practice Test 2022-23

1. AWT stands for Abstract Window Toolkit and is used for creating GUIs in Java. 2. A Label control does not support interaction with the user while Button, List, and Scrollbar controls do support interaction. 3. A Container component is one that can contain other components like buttons, textfields, and labels. 4. The setTitle() method is used to display a title on the title bar of a Frame.

Uploaded by

Vijay Bande
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/ 2

Write Correct Answer Option in Square box.

C) One Button will be displayed and event will


not be handled
1. AWT is used for creating a GUI in Java. D) One Button will be displayed with caption
AWT stands for start and event will be handled
A) All Writing Tools
B)Abstract WindowToolkit 6. In below program how can a user hide the
C)Abstract Writing Toolkit frame window?
D)All Window Tools

2. Which of the following controls does not


Support interaction with user?
A)Label B)Button
C)List D)Scrollbar

3. Which is a component in AWT that can


contains another components like buttons,
textfields, labels, etc. A) using void setHide();
A)Window B)Container B) using Void make-Hidden(1);
C)Panel D)Frame
C) using setVisible(false);
D) using hide(false);
4. Which method is used to display title on
titlebar of Frame?
7. Which components are required to display
A) displayTitle(String title)
Following output? Figure:
B) setTitle(String title)
C) showTitle(String title)
D) addTitle(String title)

5. What will be output of following program?

A) Applet, Label, CheckboxGroup, Button


B) Applet, Label, Checkbox, Button
C) Frame, Label, Checkbox, Button
D) Frame, Label, CheckboxGroup, Button

8. What does the following line of code do?


TextField text = new TextField(10);

A) Creates text object that can hold 10 columns of text.


B) Creates text object that can hold 10 rows of text.
C) The code is illegal.
D) Creates the object text and initializes it with the
value 10.

9. Which of these interfaces define a method


actionPerformed()?
A) ComponentListener
A) One Button will be displayed with caption stop B) ContainerListener
B) One Button will be displayed and event will be C) ActionListener
handled D) ItemListener.
10. Which of these events will be notified if 19. What is default block-increment of Scrollbar?
scroll bar is manipulated? A) 10 B) 5 C) 1
A) AdjustmentEvent B)ComponentEvent D) We cannot use block increment in scrollbars.
C)ActionEvent D)WindowEvent
20. Which of the following creates a List with 3
11. Which method executes only once? visible items and multiple mode selection
A) start() B) init() disabled?
C) stop() D)destroy() A) new List(3,false) B) new List(3,true)
C) new list(3,true) D) new list(3, false)
12. What are controls or components?
A) Controls or components do not allow users to 21. What should be written in blank space?
interact with users import java.awt.*; import java.awt.event.*;
B) Controls or components allow users to interact import java.applet.*;
with application /* <applet code="CBGroupNew" width=250
C) Controls or components allow users to interact height=200> </applet> */
with users. public class CBGroupNew extends Applet
D) Controls or components allow application to
{ String msg = ""; Checkbox Win98, winNT;
interact with user.
CheckboxGroup cbg;
public void init()
13. Which Type of Event performed by List
Component? { cbg = new CheckboxGroup();
A) ActionEvent B) ItemEvent Win98 = new Checkbox("Windows 98/XP",______,
C)A & B both D) None of the mentioned true); winNT = new Checkbox("Windows
NT/2000",______, false);
14. Which is the immediate super class of add(Win98); add(winNT);
Applet? Win98.addItemListener(this);
A) Container B) Component winNT.addItemListener(this);
C) Frame D) Panel }}
A) cbg B) null
15. How to add the names in choice controls? C) Win98 D) winNT
A) At the time of creation itself.
B) Using addName( ) method. 22. Write the sequence of component to be
added on applet?
C) Using addItem( ) method.
import java.awt.*; import java.applet.*;
D) Using add( ) method. /*<html><body> <applet code=”Demo”
height=500 width=500></applet> </body>
16. A checkbox is a control that consists of a </html>*/
A) Combination of a small box public class Demo extends Applet
B) A label { Label l1,l2; Button b1; TextField t1,t2;
C) Combination of a large box and a label public void init()
D) Both A & B { l1=new Label("ID"); add(l1); l2=new
Label("Pass"); b1=new Button("Save"); t1=new
TextField(10); add(t1); t2=new TextField(10);
17. ItemListener event defines this method…
add(t2); add(l2); add(b1); } }
A) itemEventChanged( )
A) Label, Label, Button, TextField, TextField
B) itemEventOcurred( )
B) Label, TextField, TextField, Label, Button
C) itemValueChanged( )
C) TextField, Label, TextField, Label, Button
D) itemStateChanged( ) D) Label, TextField, Label,TextField, Button
18. Which is the container that doesn't contain
23. To fetch caption of button___________ method
title bar and MenuBars but it can have other
is used.
components like button, text field etc?
A) Window B) Frame A) getText() B) getLabel()
C) Panel D) Container C) setLabel() D) setText()

You might also like