0% found this document useful (0 votes)
48 views10 pages

CH 1

Uploaded by

yashaher1901
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views10 pages

CH 1

Uploaded by

yashaher1901
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Chapter 01 Introduction to AWT

Question Bank : Advanced Java Programming (22517)


Class : TYCM
Chapter No. 01 Introduction to AWT

Answer the following questions:


(Note: Only one answer is correct).

1. AWT Means?
a) Abstract Windows Toolkit
b) Advanced Web Toolkit
c) Abstract Web Toolkit
d) Advanced Web Technology

2. Which is the immediate super class of Applet?


a) Container
b) Component
c) Frame
d) Panel

3. The setSize( ) method is defined by this class…


a) Applet
b) Component
c) Frame
d) Panel

4. Which class encapsulates a blank window upon which we can draw?


a) Applet
b) Canvas
c) Window
d) Frame

5. What are the variables defined in ‘Dimension’ class?


a) length and width
b) height and length
c) height and width
d) len and wid

6. If we want to hide the window, we can use this method…


a) setVisible( )
b) show( )
c) setHidden( )
d) view( )
Chapter 01 Introduction to AWT

7. Color class can create object of it using which of the following color
values?
a) RGB
b) RYB
c) CMY
d) HSB

8. The setColor( ) is the method of which class?


a) Applet
b) Graphics
c) Color
d) Object

9. Which of the following style is not supported by Font class?


a) Font.UNDERLINE
b) Font.ITALIC
c) Font.PLAIN
d) Font.BOLD

10. All the AWT controls are subclasses of which class?


a) Component
b) Container
c) AWTControl
d) Window

11. How you can remove all the controls from the applet?
a) Using remove( ) method.
b) Using removeAll( ) method.
c) Using removeAllControls( ) method.
d) It is not possible to remove all controls using single method.

12. Which of the following is passive AWT control?


a) Label
b) Button
c) Checkbox
d) TextField

13. Which alignment is not supported by Label?


a) Label.RIGHT
b) Label.LEFT
c) Label.CENTER
d) Label.BASELINE

14. How can we create Radio buttons?


a) Using ButtonGroup class
Chapter 01 Introduction to AWT

b) Using CheckboxGroup class


c) Using RadioButton class
d) Using Button class

15. 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.

16. Multiple selections are allowed in…


a) Menu
b) CheckboxGroup
c) List
d) Choice

17. How can we copy the ‘List’s contents into ‘Choice’s contents
a) This is not possible.
b) Using copyInto( ) method of List
c) Directly assigning List object to Choice object.
d) Using copyFrom( ) method.

18. What is default block-increment of Scrollbar?


a) 10
b) 5
c) 1
d) We can not use block increment in scrollbars.

19. The immediate super class of TextArea is…


a) TextField
b) TextBox
c) TextComponent
d) Component

20. Is it possible to change display character of TextField? How?


a) Not possible.
b) Yes, by using setChar( ) method.
c) Yes, by using setEchoChar( ) method.
d) Yes, by using setDisplayChar( ) method.

21. Is it possible to center the text typed in TextField? How?


a) Not possible.
b) Yes, by using setAlignment( ) method.
c) Yes, by using setPosition( ) method.
d) Yes, by putting values in the constructor itself.
Chapter 01 Introduction to AWT

22. Which method is used to append the text at the end of TextArea?
a) append( )
b) add( )
c) appendAt( )
d) addAt( )

23. FlowLayout does not support this value of alignment…


a) FlowLayout.LEFT
b) FlowLayout.CENTER
c) FlowLayout.RIGHT
d) FlowLayout.BASELINE

24. The setLayout( ) is the method of which class?


a) Applet
b) Layout
c) FlowLayout
d) Graphics

25. BorderLayout does not support this value of alignment…


a) BorderLayout.WEST
b) BorderLayout.EAST
c) BorderLayout.NORTH
d) BorderLayout.MIDDLE

26. The correct constructor of Insets( ) which uses the values is…
a) Insets(int top, int left, int bottom, int right)
b) Insets(int bottom, int right, int top, int left)
c) Insets(int right, int top, int left, int bottom)
d) Insets(Dimesnion d1, Dimension d2)

27. 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

28. 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
Chapter 01 Introduction to AWT

b. BorderLayout
c. GridLayout
d. CardLayout
e. All of these

30. The constructor which the Text Event class defines.


a. TextEvent(Object source, int event_type)
b. textevent (Object source, int event_type)
c. textevent (object Source, float event_type)
d. textevent (Object source, string event_type)

31. In Java an event is an which specifies the change of state in the source.
a. Class
b. Object
c. Int
d. String

32. The name of the event classes are


a. ActionEvent, ComponentEvent
b. ContainerEvent, FocusEvent
c. ItemEvent, KeyEvent
d. WindowListener, MouseEvent
e. TextEvent
f. All of these

33. The classes and interfaces defined in AWT are contained within the
package.
a. java.awt.*
b. java.sql.*
c. java.io.*
d. java.int*

34. Java packages such as support the Event handling mechanism.


a. java.util
b. java.awt
c. java.awt.event
d. All of these

35. 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)

36. Some of the event listener interfaces are


a. ActionListener, ComponentListener
b. ContainerListener, FocusListener
c. ItemListener, KeyListener
Chapter 01 Introduction to AWT

d. WindowListener, MouseListener
e. TextListener
f. All of these

37. The AWT container is an instance of the class which holds various
components and other containers
a. Graphics
b. Container
c. Eventobj
d. None of these

38. A checkbox is a control that consists of a


a. Combination of a small box
b. A label
c. Combination of a large box and a label
d. Both a & b

39. Java applets are used to create applications


a. Graphical
b. User interactive
c. Both a & b
d. None of these

40. In Java, events are all the activities that occur between
a. The user
b. The applications
c. Both a & b
d. None of these

41. AWT means


a. Abstract Window Toolkit
b. Abstract Window Toollayout
c. Abstract Withdraw Tools
d. Abstract Window Title

42. Positions the components into five regions:east, west, north, south, center
a. BorderLayout
b. CardLayout
c. GridLayout
d. FlowLayout

43. 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
Chapter 01 Introduction to AWT

44. Arranges the components horizontally


a. BorderLayout
b. CardLayout
c. GridLayout
d. FlowLayout

45. Arranges the componemnts into grid


a. BorderLayout
b. CardLayout
c. GridLayout
d. FlowLayout

46. creates a dropdown list of textual entries


a. Choice
b. Checkbox
c. Textbox
d. TextComponent

47. The Component class and MenuComponent class are the which
represent the GUI components.
a. Subclasses
b. Superclasses
c. Both a & b
d. None of these

48. The Component class is an abstract class and so its are used to create
components.
a. Subclasses
b. Superclasses
c. Both a & b
d. None of these

49. The AWT classes can be roughly categorized into the following groups:
a. GUI Components
b. Layouts
c. Graphics Tools
d. Event Handlers
e. All of these

50. Panel is used for components


a. Grouping
b. Managing
c. Deleting
d. Modifying

51. An Applet is a of Panel:


a. Subclass
Chapter 01 Introduction to AWT

b. Superclass
c. Both a & b
d. None of these

52. Window is used for windows


a. Creating
b. Handling
c. Modifying
d. Both a & b

53. The subclasses of Window are


a. Dialog
b. Frame
c. Both a & b
d. None of these

54. 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

55. A menu bar represents


a. A list of menus which can be added to the top of a top-level window
b. A list of menus which can be deleted to the top of a top-level window
c. A list of menus which can be added to the bottom of a bottom-level window
d. None of these
56. Each menu is associated with a list of menu items:
a. Checkbox
b. Drop-down
c. Choice
d. None of these
57. The two types of menus which are given as follows:
a. Pop-up menus
b. Regular menus
c. Both a & b
d. None of these
58. Regular menus are placed at the of the application window within a
menu bar
a. Top
b. Bottom
c. Top-down
Chapter 01 Introduction to AWT

d. Botttom-up
59. The interface is used to handle the menu events
a. ContainerListener
b. FocusListener
c. ActionListener
d. WindowListener

60. The text field and text area controls create a area respectively
a. Single-line text
b. Multi-line text
c. Both a & b
d. None of these

1. AWT Means? Answer: a) Abstract Windows Toolkit


2. Which is the immediate super class of Applet? Answer: a) Container
3. The setSize( ) method is defined by this class… Answer: a) Applet
4. Which class encapsulates a blank window upon which we can draw? Answer: b) Canvas
5. What are the variables defined in ‘Dimension’ class? Answer: c) height and width
6. If we want to hide the window, we can use this method… Answer: a) setVisible( )
7. Color class can create object of it using which of the following color values? Answer: a) RGB
8. The setColor( ) is the method of which class? Answer: b) Graphics
9. Which of the following style is not supported by Font class? Answer: d) Font.BOLD
10. All the AWT controls are subclasses of which class? Answer: a) Component
11. How you can remove all the controls from the applet? Answer: b) Using removeAll( ) method.
12. Which of the following is passive AWT control? Answer: a) Label
13. Which alignment is not supported by Label? Answer: d) Label.BASELINE
14. How can we create Radio buttons? Answer: b) Using CheckboxGroup class
15. How to add the names in choice controls? Answer: a) At the time of creation itself.
16. Multiple selections are allowed in… Answer: c) List
17. How can we copy the ‘List’s contents into ‘Choice’s contents Answer: a) This is not possible.
18. What is default block-increment of Scrollbar? Answer: a) 10
19. The immediate super class of TextArea is… Answer: c) TextComponent
20. Is it possible to change display character of TextField? How? Answer: c) Yes, by using
setEchoChar( ) method.
21. Is it possible to center the text typed in TextField? How? Answer: a) Not possible.
22. Which method is used to append the text at the end of TextArea? Answer: a) append( )
23. FlowLayout does not support this value of alignment… Answer: d) FlowLayout.BASELINE
24. The setLayout( ) is the method of which class? Answer: a) Applet
25. BorderLayout does not support this value of alignment… Answer: d) BorderLayout.MIDDLE
26. The correct constructor of Insets( ) which uses the values is… Answer: a) Insets(int top, int left,
int bottom, int right)
27. The various controls supported by AWT are Answer: d) All of these
28. The concept of the menu bar can be implemented by using three java classes— Answer: d) All
of these
29. The most commonly used layout managers are Answer: e) All of these
30. The constructor which the Text Event class defines. Answer: a) TextEvent(Object source, int
event_type)
31. In Java an event is an which specifies the change of state in the source. Answer: b) Object
Chapter 01 Introduction to AWT
32. The name of the event classes are Answer: f) All of these
33. The classes and interfaces defined in AWT are contained within the package. Answer: a)
java.awt.*
34. Java packages such as Answer: d) All of these
35. The general form to set a specific type of layout manager is Answer: a) void
setLayout(LayoutManager lm)
36. Some of the event listener interfaces are Answer: f) All of these
37. The AWT container is an instance of the class which holds various components and other
containers Answer: b) Container
38. A checkbox is a control that consists of a Answer: d) Both a & b
39. Java applets are used to create applications Answer: c) Both a & b
40. In Java, events are all the activities that occur between Answer: c) Both a & b
41. AWT means Answer: a) Abstract Window Toolkit
42. Positions the components into five regions

, west, north, south, center Answer: a) BorderLayout

43. Arranges the components as a deck of cards such that only one component is visible at a time
Answer: b) CardLayout
44. Arranges the components horizontally Answer: d) FlowLayout
45. Arranges the components into grid Answer: c) GridLayout
46. creates a dropdown list of textual entries Answer: a) Choice
47. The Component class and MenuComponent class are the which represent the GUI components.
Answer: a) Subclasses
48. The Component class is an abstract class and so its are used to create components. Answer: a)
Subclasses
49. The AWT classes can be roughly categorized into the following groups: Answer: e) All of these
50. Panel is used for components Answer: a) Grouping
51. An Applet is a of Panel: Answer: a) Subclass
52. Window is used for windows Answer: d) Both a & b
53. The subclasses of Window are Answer: c) Both a & b
54. The CardLayout class defines the following constructors: Answer: d) CardLayout() // First
CardLayout(int hor, int ver) //second
55. A menu bar represents Answer: a) A list of menus which can be added to the top of a top-level
window
56. Each menu is associated with a list of menu items: Answer: b) Drop-down
57. The two types of menus which are given as follows: Answer: c) Both a & b
58. Regular menus are placed at the of the application window within a menu bar Answer: a) Top
59. The interface is used to handle the menu events Answer: c) ActionListener
60. The text field and text area controls create a area respectively Answer: c) Both a & b

Don't share sensitive info. Chats may be reviewed and used to train our models. Learn more

You might also like