0% found this document useful (0 votes)
49 views6 pages

Unit1 MCQ

Unit 1 MCQ

Uploaded by

rajdugane685
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)
49 views6 pages

Unit1 MCQ

Unit 1 MCQ

Uploaded by

rajdugane685
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/ 6

Subject :- Advance Java Programming

Unit 1 – AWT (Abstract Window Toolkit)

1. Which package provides AWT classes in Java?


a. Java.awt
b. Java.swing
c. Java.io
d. Java.net
2. Which of the following is not a component in AWT?
a. Button
b. Checkbox
c. Table
d. TextArea
3. What is the parent class of all AWT components?
a. Java.awt.Panel
b. Java.awt.Component
c. Java.awt.Container
d. Java.awt.Frame
4. Which method is used to add a component to a container in AWT?
a. Add()
b. SetComponent
c. AddComponent
d. setLayout()
5. Which method is used to remove a component from a container in AWT?
a. Remove()
b. DeleteComponent()
c. removeComponent()
d. destroy()
6. Which layout manager arranges components in a grid of rows and columns?
a. FlowLayout
b. BorderLayout
c. GridLayout
d. CardLayout
7. Which layout manager arranges components in a single row or column?
a. FlowLayout
b. BorderLayout
c. GridLayout
d. CardLayout
8. Which event is generated when a user clicks a button in AWT?
a. MouseEvent
b. ActionListener
c. KeyEvent
d. WindowEvent
9. Which event is generated when a user types a key in AWT?
a. MouseEvent
b. ActionListener
c. KeyEvent
d. WindowEvent
10. Which event is generated when a window is resized in AWT?
a. WindowEvent
b. ComponentEvent
c. ResizeEvent
d. ContainerEvent
11. Which class is used to create a menu bar in AWT?
a. Java.awt.Menu
b. Java.awt.MenuBar
c. Java.awt.MenuItem
d. Java.awt.PopupMenu
12. Which class is used to create a file dialog in AWT?
a. Java.awt.Dialog
b. Java.awt.FileDialog
c. Java.awt.Frame
d. Java.awt.Window
13. Which class is used to create a color dialog in AWT?
a. Java.awt.Dialog
b. Java.awt.ColorDialog
c. Java.awt.Frame
d. Java.awt.Window
14. Which class is used to create a font dialog in AWT?
a. Java.awt.Dialog
b. Java.awt.FontDialog
c. Java.awt.Frame
d. Java.awt.Window
15. Which class is used to create a canvas in AWT?
a. Java.awt.Canvas
b. Java.awt.Panel
c. Java.awt.Container
d. Java.awt.Frame
16. The subclass of a java.awt.Component class is known as a?
a. System
b. Component
c. Container
d. Component Manager
17. What is the super class of all components of java?
a. Java.all.Component
b. All.awt.Component
c. Java.awt.Component
d. Awt.Component
18. How many layout managers defined in java.awt package?
a. 2
b. 3
c. 4
d. 5
19. A ________ dictates the style of arranging the components in a container.
a. BorderLayout
b. GridLayout
c. Panel
d. LayoutManager
20. Which method is used to place some text in the text field?
a. getText(String str)
b. setText(String str)
c. putText(String str)
d. None of the above
21. What is the listener used to handle the events of a text field?
a. Java.awt.ActionListener Interface
b. Java.awt.event.ActionListener
c. Awt.event.ActionListener interface
d. Java.awt.event.ActionListener
22. Which method is used to change the foreground color of components like text field?
a. setBackground(Color clr)
b. setForeground(Color clr)
c. setColor(Color clr)
d. setEditable(Boolean state)
23. Which package provides many event classes and listener interfaces for event hadling?
a. Java.awt
b. Java.awt.Graphics
c. Java.awt.event
d. None of the above
24. Name the class used to represent a GUI application window, which is optionally resizable and can
have a title bar, an icon, and menus.
a. Window
b. Panel
c. Dialog
d. Frame
25. What are the different types of controls in AWT?
a. Lable
b. Pushbuttons
c. Choice Lists
d. All of these
26. The Java Foundation Classes (JFC) is a set of GUI components which simplify the development
of desktop applications?
a. True
b. False
c. All of these
d. None
27. Which class can be used to represent a checkbox with a textual label that can appear in a menu?
a. MenuBar
b. MenuItem
c. CheckBoxMenuItem
d. Menu
28. By which method you can set or change the text in a label?
a. setText()
b. getText()
c. Both A and B
d. None of the above
29. Which class provides many methods for graphics programming?
a. Java.awt
b. Java.Graphics
c. Java.awt.Graphics
d. None of the above
30. Which are passive controls that do not support any interaction with the user?
a. Choice
b. List
c. Labels
d. Checkbox
31. The following way is used to create a frame is by creating the object of Frame class?
a. Inheritance
b. Association
c. Both A and B
d. None of the above
32. To use the ActionListener interface it must be implemented by a class there are several ways to
do that find in the following?
a. Creating a new class
b. Using the class the graphical component
c. An anonymous inner class
d. All mentioned above
33. Which of these operators can be used to get run time information about an object?
a. getInfo
b. Info
c. Instanceof
d. Getinfoof
34. Which of these methods is a part of AWT?
a. Display()
b. Paint()
c. drawString()
d. transient
35. ________ is a subclass of component.
a. Applet
b. Container
36. Each listener of checkbox implement _________ interface.
a. ItemListener
b. ActionListener
37. The default Layout Manager of frame is?
a. FlowLayout
b. Layout
c. BorderLayout
d. None of the above
38. The AWT container is an instance of ______ class which holds various components and other
container?
a. Label
b. Container
c. None of the above
39. List can be created for multiple select by using_______ constructor.
a. BooleanMulti()
b. BooleanMultiSelect()
40. To create a multiline edit control ______ class is used?
a. TextArea()
b. TextField()
c. Choice()
d. List()

You might also like