Unit 1 Question Bank
Unit 1 Question Bank
1. AWT Means?
a) Abstract Windows Toolkit b) Advanced Web Toolkit
c) Abstract Web Toolkit d) Advanced Web Technology
7. Color class can create object of it using which of the following color values?
a) RGB b) RYB
c) CMY d) HSB
27. 12. Which is a component in AWT that can contain another components like buttons,
textfields, labels etc.?
A) Window B) Container
C) Panel D) Frame
28.Which class is used to create a pop-up list of items from which the user may choose?
a) List
b) Choice
c) C) Labels
d) D) Checkbox
29. Which is the container that doesn't contain title bar and MenuBars but it can have other
components like button, textfield etc.?
a) Window
b) Frame
c) Panel
d) Container
30.2. Which is a component in AWT that can contain another component like buttons,
textfields, labels etc.?
a) Window
b) Container
c) Panel
d) Frame
31.How many types of controls does AWT supports these controls are subclasses of
component?
a) 7
b) 6
c) 5
d) 8
32. AWT has more powerful components like tables, lists, scroll panes, color chooser, tabbed
pane etc.
a) True
b) False
33.Which method is used to size a graphics object to fit the current size of the window?
a) getSize( )
b) setForeground( )
c) setBackground( )
d) setBounds()
46.______ generates action event when an item is double clicked, generate action events
when an item is selected or deselected.
a) List
b) Checkbox
c) MenuItem
d) TextBox
47.Which are passive controls that do not support any interaction with the user?
a. Choice
b. List
c. Labels
d. Checkbox
48.Which of these classes can be added to any container class, using the add() method
defined in container class.
a) Button
b) Checkbox MenuItem
c) Menu
d) All of the above
49.Which checkbox will be selected in the following code ( Assume with main and added to
a Frame)
Frame myFrame = new Frame("Test");
CheckboxGroup cbg = new CheckboxGroup();
Checkbox cb1 = new Checkbox("First",true,cbg);
Checkbox cb2 = new Checkbox("Second",true,cbg);
Checkbox cb3 = new Checkbox("Third",false,cbg);
cbg.setSelectedCheckbox(cb3);
myFrame.add(cb1);
myFrame.add(cb2);
myFrame.add(cb3);
a) cb1
b) cb2,cb1
c) cb1,cb2,cb3
d) cb3
52.Which is the component in AWT that can contain other components like buttons,
textfields, labels etc.?
a) Window
b) Container
c) Panel
d) Frame
56.Arranges the components as a deck of cards such that only one component is visible at a
time
a) BorderLayout
b) CardLayout
c) GridLayout
d) FlowLayout
a) Graphics class
b) Component class
c) Both A & B
d) None of the above
63.Which layout should you use to organize the components of a container in a tabular
form?
a)Card Layout.
b)BorederLayout.
c) Flow Layout.
d) Grid Layout.
65.What best describes the apprearance of an applet with the following code?
import java.awt.*;
public class FlowAp extends Frame{
public static void main(String argv[]){
FlowAp fa=new FlowAp();
fa.setSize(400,300);
fa.setVisible(true);
}
FlowAp(){
add(new Button("One"));
add(new Button("Two"));
add(new Button("Three"));
add(new Button("Four"));
}
}
a) A Frame with buttons marked One to Four placed on each edge.
b) A Frame with buutons Makred One to four running from the top to bottom
c) A Frame with one large button marked Four in the Centre
d) An Error at run time indicating you have not set a LayoutManager
66.What most closely matches the appearance when this code runs?
import java.awt.*;
public class CompLay extends Frame{
public static void main(String argv[]){
CompLay cl = new CompLay();
}
CompLay(){
Panel p = new Panel();
p.setBackground(Color.pink);
p.add(new Button("One"));
p.add(new Button("Two"));
p.add(new Button("Three"));
add("South",p);
setLayout(new FlowLayout());
setSize(300,300);
setVisible(true);
}
}
a) The buttons will run from left to right along the bottom of the Frame
b) The buttons will run from left to right along the top of the frame
c) The buttons will not be displayed
d) Only button three will show occupying all of the frame
67.How will the following program lay out its buttons. Select the one correct answer.
import java.awt.*;
public class MyClass {
public static void main(String args[]) {
String[] labels = {"A"};
Window win = new(Frame());
win.set.layout(new BorderLayout());
for(i=0;i<labels.length;i++)
win.add(new Button(labels[i]), "North");
win.pack();
win.setVisible(true);
}
}
a)The button A will appear on the top left corner of the window.
b)The button A will appear on the center of first row.
c)The button A will appear on the top right corner of the window.
d)The button A will appear on the middle row and column, in the center of the
window.
e)The button A will occupy the whole window.
f)The button A will occupy the complete first row of the window.
68.Which is the container that doesn't contain title bar and MenuBars but it can have other
components like button, textfield etc?
a) Window
b) Frame
c) Panel
d) Container