1.
AWT
1. The CheckboxGroup class is a subclass of the Component class.
A. True
B. False
2. Which is passive control that do not support any interaction with the user?
A. Choice
B. List
C. Labels
D. Checkbox
3. AWT has more powerful components like tables, lists, scroll panes, color
chooser, tabbed pane etc.
A. True
B. False
4. Applet can be embedded in _____________.
A. HTML document
B. word document
C. gif file
D. rtf file
5. Which method of the Applet class displays the result of applet code on
screen ?
A. run() method
B. paint() method
C. drawString() method
D. main() method
6. Which object can be constructed to show any number of choices in the
visible window?
A. Labels
B. Choice
C. List
D. Checkbox
7. Which method can set or change the text in a Label?
A. setText()
B. getText()
C. All the above
D. None of the above
8. Which is the container that doesn't contain titlebar and MenuBars. It can
have other components like button, textfield etc ?*
A. Window
B. Frame
C. Panel
D. Container
9. These two ways are used to create a Frame 1) By creating the object of
Frame class (association) 2) By extending Frame class (inheritance)
A. True
B. False
10. Which of the following are acceptable? ( Choose two) 1) Object o =
new Button(""A""); 2) Boolean flag = true; 3) Panel p = new
Frame(); 4) Frame f = new Panel(); 5) Panel p = new Applet();
A. 1 and 5
B. 1 and 2
C. 1 and 3
D. 1 and 4
11. AWT stands for___
A. Applet Windowing Toolkit
B. Abstract Windowing Toolkit
C. Absolute Windowing Toolkit
D. None of the above
12. Which class provides many methods for graphics programming?
A. java.awt
B. java.Graphics
C. java.awt.Graphics
D. None of these
13. Where are the following four methods commonly used?1) public void
add(Component c) 2) public void setSize(int width,int height) 3) public
void setLayout(LayoutManager m) 4) public void setVisible(boolean)
A. Graphics class
B. Component class
C. Both A & B
D. None of the above
14. Which of the following is true about applet ?
A. Applets do not have main() method
B. Applets must run under appletviewer or web browser
C. The user I/O is not performed using Java's stream I/O class
D. all of these
15. 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
16. Which is used to store data and partial results, as well as to perform
dynamic linking, return values for methods, and dispatch exceptions?
A. Window
B. Panel
C. Frame
D. Container
17. By which method we can set or change the text in a Label in AWT?
A. setText()
B. getText()
C. addText()
D. all of these
18. Which is a component in AWT that can contain another components
like buttons, textfields, labels etc.?
A. Window
B. Container
C. Panel
D. Frame
19. Which of the following statements are true? a) The default layout
manager for an Applet is FlowLayout b) The default layout manager
for an application is FlowLayout c) A layout manager must be
assigned to an Applet before the setSize method is called d) The
FlowLayout manager attempts to honor the preferred size of any
components
A. a
B. b
C. c
D. a and d
20. Which of the following may a menu contain? a) A separator b) A
check box c) A menuitem d) A button
A. a
B. b
C. c
D. a and c
21. The setSize( ) method is defined by this class…
A. Applet
B. Component
C. Frame
D. Panel
22.Which alignment is not supported by Label?
A. Label.RIGHT
B. Label.LEFT
C. Label.CENTER
D. Label.BASELINE
23.How can we create Radio buttons?
a) Using ButtonGroup class
b) Using CheckboxGroup class
c) Using RadioButton class
d) Using Button class
24. How to add the names in choice controls?
a) At the time of creation itself.
b) Using addName( ) method.
c) Using addItem( ) method.
d) Using add( ) method
25. Multiple selections are allowed in…
a) Menu
b) CheckboxGroup
c) List
d) Choice
26. Which method is used to append the text at the end of TextArea?
a) append( )
b) add( )
c) appendAt( )
d) addAt( )
27. FlowLayout does not support this value of alignment…
a) FlowLayout.LEFT
b) FlowLayout.CENTER
c) FlowLayout.RIGHT
d) FlowLayout.BASELINE
28. The setLayout( ) is the method of which class?
a) Applet
b) Layout
c) FlowLayout
d) Graphics
29. BorderLayout does not support this value of alignment…
a) BorderLayout.WEST
b) BorderLayout.EAST
c) BorderLayout.NORTH
d) BorderLayout.MIDDLE
30. The various controls supported by AWT are
a. Labels, push buttonss
b. Checkboxes, choice, list
c. Scroll bars, text area, text field
d. All of these
31. The concept of the menu bar canbe implemented by using three java
classes—
a. MenuBar
b. Menu
c. MenuItem
d. All of these
29. The most commonly used layout managers are
a. FlowLayout
b. BorderLayout
c. GridLayout
d. CardLayout
e. All of these
30.The classes and interfaces defined in AWT are contained within the
______ package.
a. java.awt.
b. java.sql.
c. java.io.
d. java.int
31. The general form to set a specific type of layout manager is
a. void setLayout(LayoutManager lm)
b. Void setLayout(LayoutManager lm)
c. void setLayout(layoutManager lm)
d. Void setLayout(Layoutmanager lm)
32.Java applets are used to create _______________ applications
a. Graphical
b. User interactive
c. Both a & b
d. None of these
33.Positions the components into five regions:east, west, north, south, center
a. BorderLayout
b. CardLayout
c. GridLayout
d. FlowLayout
34.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
35.Arranges the components horizontally
a. BorderLayout
b. CardLayout
c. GridLayout
d. FlowLayout
36.Arranges the componemnts into grid
a. BorderLayout
b. CardLayout
c. GridLayout
d. FlowLayout
37. __________ creates a dropdown list of textual entries
a. Choice
b. Checkbox
c. Textbox
d. TextComponent
38. The CardLayout class defines the following constructors:
a. CardLayout() // First
Cardlayout(int hor, int ver) //second
b. Cardlayout() // First
CardLayout(int hour, int ver) //second
c. CardLayout() // First
Cardlayout(int hor, int var)
d. CardLayout() // First
Cardlayout(int hour, int ver) //second
39. Choose the correct:
a)public class CheckboxDemo implement Applet extend ItemListener
b)public class CheckboxDemo extends Applet implements ItemListener
c)public class CheckboxDemo implements Applet extends ItemListener
d)public class CheckboxDemo extend Applet implement ItemListener
40. To obtain the current value of the scroll bar, call ___, to set the current
value, call __ method.
a) setvalue( ), getvalue( )
b) setValue( ) , getValue( )
c) getvalue( ). setvalue( )
d) getValue( ) , setValue( )