Unit I-Abstract Window Toolkit
Unit I-Abstract Window Toolkit
Unit I
Q. 1 Give the abbreviation of AWT ? Q. 8 How many types of controls does AWT supports
(a) Applet Windowing Toolkit these controls are subclasses of component?
(b) Abstract Windowing Toolkit (a) 7 (b) 6
(c) Absolute Windowing Toolkit (c) 5 (d) 8
(d) None of the above Q. 9 Which are passive controls that do not support any
Q. 2 Which is the container that contain title bar and interaction with the user?
can have MenuBars. It can have other components (a) Choice (b) List
like button, textfield etc.? (c) Labels (d) Checkbox
(a) Panel (b) Frame Q. 10 By which method You can set or change the text in
(c) Window (d) Container a Label ?
Q. 3 Which is a component in AWT that can contain (a) setText() (b) getText()
another components like buttons, textfields, labels (c) Both A & B (d) None of the above
etc.?
Q. 11 Which class is used to create a pop up list of items
(a) Window (b) Container from which the user may choose?
(c) Panel (d) Frame
(a) List (b) Choice
Q. 4 AWT is used for GUI programming in java? (c) Labels (d) Checkbox
(a) True Q. 12 Which object can be constructed to show any
(b) False number of choices in the visible window?
Q. 5 Which class provides many methods for graphics (a) Labels (b) Choice
programming? (c) List (d) Checkbox
(a) java.awt Q. 13 Which is used to store data and partial results, as
(b) java.Graphics well as to perform dynamic linking, return values
(c) java.awt.Graphics for methods, and dispatch exceptions?
(d) None of the above (a) Window (b) Panel
Q. 6 These two ways are used to create a Frame (c) Frame (d) Container
By creating the object of Frame class (association) Q. 14 The following way is used to create a frame is by
By extending Frame class (inheritance) creating the object of Frame class?
(a) True (a) inheritance
(b) False (b) association
Q. 7 Which is the container that doesn't contain title (c) Both A & B
bar and MenuBars. It can have other components (d) None of the above
like button, textfield etc?
Q. 15 AWT more powerful components like tables, lists,
(a) Window scroll panes, color chooser, tabbed pane etc.?
(b) Frame
(a) True (b) False
(c) Panel
(d) Container
Advanced Java Programming (MSBTE) M1-2 MCQ - Abstract Windowing Toolkit (AWT)
Q. 20 Which of the following is true about AWT and Q. 28 In the give constructor what third parameter
Swing components. indicates : ScrollBar s = new
ScrollBar(0,10,20,0,1000);
(a) AWT components creates a process where as
swing components creates a thread (a) size of thumb
(b) minimum value
(b) AWT components creates a thread where as
swing components creates a process (c) Increment value
(c) Both AWT and Swing components creates a (d) Initial Value
process Q. 29 Which class is used to represent a single line
(d) Both AWT and swing components creates a textbox with password character facility?
thread (a) TextField (b) TextArea
(c) Label (d) Checkbox
Q. 21 Panel is defined as ______________.
(a) The Panel class is a concrete subclass of Q. 30 To set the title to the Frame window ________
Container. method is used.
(b) A Panel is a window that does not contain (a) void setTitle(String str)
titlebar, menubar and border. (b) void setText(String str)
(c) Panel is a superclass of Applet. (c) void settitle(String str)
(d) All of the above. (d) None of the above
Advanced Java Programming (MSBTE) M1-3 MCQ - Abstract Windowing Toolkit (AWT)
Q. 31 Suppose a Panel is added to a Frame and a Button Q. 39 Which method is used to set password character
is added to the Panel. If the Frames font is set to for a TextField?
12 point Times New Roman, the panels font is set (a) setPasswordCharacter( )
10 points Times New Roman and the Buttons font (b) setEchoChar( )
is not set. What font will be used to display the
(c) setPassChar( )
Buttons label?
(d) setEchoCharacter( )
(a) 12 point Times New Roman
(b) 11 point Times New Roman Q. 40 The getContentPane( ) method is of which class?
(c) 10 point Times New Roman (a) JApplet
(d) 9 point Times New Roman (b) JFrame
(c) JButton
Q. 32 Which of the following is true about FlowLayout?
(d) None of these
(a) FlowLayout can use multiple rows if the
horizontal space in the container is too small Q. 41 Which class defines setSize( ) method?
to hold the component. (a) Frame
(b) FlowLayout is the default layout manager of (b) Applet
panel and applet. (c) Component
(c) It is the default layout manager for window. (d) Panel
(d) Both A & B.
Q. 42 __________ is a swing class that allows to enter a
Q. 33 Which of the method can be used to output a single line of text.
String in an Applet? (a) TextField
(a) display( ) (b) print( ) (b) JTextField
(c) drawString( ) (d) transient( ) (c) EditTextField
Q. 34 ___________ positions are the components into 5 (d) TextArea
regions east, west, south, north, center.
Q. 43 Which Text Component method is used to set a
(a) CardLayout (b) BorderLayout TextComponent to the read only state?
(c) GridLayout (d) FlowLayout (a) Editable
Q. 35 What is API? (b) NonEditable
(a) Application Programming Interchange (c) setEchoChar
(b) Application Programming Interaction (d) setEditable
(c) Application Programming Interface Q. 44 How would you set the color of graphics context
(d) None of these called g to cyan?
Q. 36 Panel is defined as _______. (a) g.setColor(cyan);
(a) Panel class is a concrete sub class of container (b) g.setCurrentColor(cyan);
(b) A Panel is a window that does not contain a (c) g.setColor(Color.cyan);
title bar, menu bar or border (d) g.setColor(Color.cyan);
(c) Panel is the superclass of Applet Q. 45 What is use of second parameter in given
(d) All of above constructor Lable(String,int)
Q. 37 Which component of AWT provides compact, (a) specifies height of label
multichoice, scrolling component? (b) specifies width of label in terms of pixel
(a) List (b) Choice (c) specifies the alignment of text in label in
(c) Panel (d) TextArea terms of pixel
(d) specifies width of label
Q. 38 When there is a switching condition like ON or
OFF, which control is used of following? Q. 46 The setBackground() method is part of which of
(a) Button (b) RadioButton the following class java.awt package?
(c) ToggleButton (d) TextField (a) Component (b) Applet
(c) Object (d) Graphics
Advanced Java Programming (MSBTE) M1-4 MCQ - Abstract Windowing Toolkit (AWT)
Q. 47 What does the following line of code do? Q. 56 Which of the following package is used for
TextField tf = new TextField(10); Graphical User Interface?
(a) will set 10 to TextField as its initial text. (a) java.applet (b) java.awt
(b) Will set the character capacity to 10 (c) java.awt.image (d) java.io
(c) Both A & B
Q. 57 What are the variables defined in Dimension?
(d) None of These (a) length and width
Q. 48 Frame is a standard window, which is __________ (b) height and length
of Window class from AWT hierarchy? (c) height and width
(a) Derived class / Subclass (d) None of these
(b) Base class / Super class
Q. 58 Which AWT component is not editable?
(c) Root class
(a) Button (b) TextField
(d) Family class
(c) FlowLayout (d) Label
Q. 49 A ____________ is a passive AWT control that do
Q. 59 Current text of Label can be obtained using
not generate any event?
__________.
(a) Button (b) RadioButton
(a) setAlignment( )
(c) Choice (d) Label
(b) getAlignment( )
Q. 50 The default layout manager of Frame is________. (c) getText( )
(a) FlowLayout (b) BorderLayout (d) setText( )
(c) GridLayout (d) CardLayout
Q. 60 The method ___________ places a Menu m into
Q. 51 Which method is used to check the status of the MenuBar mb.
checkbox? (a) mb.addMenuItem(m)
(a) getStatus( ) (b) getState( ) (b) mb.addItem(m)
(c) isChecked( ) (d) getChecked( ) (c) mb.add(m)
Q. 52 Which of the following method is used to set a (d) None of these
TextComponent to read only mode? Q. 61 Which of these Components cannot be added to
(a) Editable( ) (b) nonEditable( ) Frame?
(c) setEchoChar( ) (d) setEditable( ) (a) Label
Q. 53 _________ generates action events when an item (b) Button
is double clicked. (c) CheckboxGroup
(a) List (b) Checkbox (d) All of above
(c) MenuItem (d) TextField Q. 62 What is use of second parameter given in Label
Q. 54 Which of the following does not have its default constructor : Label(String, int)
layout as BorderLayout. (a) Specifies height of label in terms of pixels.
(a) Frame (b) specifies width of label in terms of pixels.
(b) Dialog (c) specifies the alignment of text in label in
(c) JApplet terms of pixels.
(d) All of Above (d) Specifies maximum numbers of characters in
label.
Q. 55 Which of the following statement about GUI
component is wrong? Q. 63 Which of these classes can be added to any
Container class, using the add method defined in
(a) swing exists since the version 1.2 of the JDK
Container class?
(b) AWT stands for Abstract Window Toolkit
(a) Button
(c) You cannot place AWT component on swing
(b) CheckboxMenuItem
container.
(d) The AWT classes are deprecated. (c) Menu
(d) MenuBar
Advanced Java Programming (MSBTE) M1-5 MCQ - Abstract Windowing Toolkit (AWT)
Answers