0% found this document useful (1 vote)
125 views

Unit I-Abstract Window Toolkit

The document contains 40 multiple choice questions about the Abstract Windowing Toolkit (AWT) in Java. AWT is used for GUI programming in Java and provides graphics and user interface components like frames, panels, buttons, text fields, labels, checkboxes etc. It supports common GUI controls like buttons, lists, labels etc through subclasses of the Component class.

Uploaded by

Hrudaya Gadkari
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
125 views

Unit I-Abstract Window Toolkit

The document contains 40 multiple choice questions about the Abstract Windowing Toolkit (AWT) in Java. AWT is used for GUI programming in Java and provides graphics and user interface components like frames, panels, buttons, text fields, labels, checkboxes etc. It supports common GUI controls like buttons, lists, labels etc through subclasses of the Component class.

Uploaded by

Hrudaya Gadkari
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

1 Abstract Windowing Toolkit (AWT)

Unit I

Multiple Choice Questions for Online Exam

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. 16 These four methods commonly used in? Q. 22 What is API?


(i) public void add(Component c) (a) Application Programming Interchange
(ii) public void setSize(int width,int height) (b) Application Programming Interaction
(iii) public void setLayout(LayoutManager m) (c) Application Programming Interface
(iv) public void setVisible(boolean) (d) None of these
(a) Graphics class Q. 23 What is default layout for Dialog?
(b) Component class (a) FlowLayout (b) GridLayout
(c) Both A & B (c) CardLayout (d) BorderLayout
(d) None of the above Q. 24 Which method is used to count the number of
Q. 17 In Graphics class which method is used to draws a items is the List.
rectangle with the specified width and height? (a) getItem( ) (b) getSelectedItem( )
(a) public void drawRect(int x, int y, int width, int (c) getItemCount( ) (d) getCount( )
height) Q. 25 The correct hierarchy for Panel is __________
(b) public abstract void fillRect(int x, int y, int (a) Component – Container – Window – Panel
width, int height) (b) Component – Container – Applet – Panel
(c) public abstract void drawLine(int x1, int y1, int (c) Component – Container – Panel
x2, int y2) (d) Container – Component – Panel
(d) public abstract void drawOval(int x, int y, int
Q. 26 Which is the correct constructor of GridLayout.
width, int height)
(a) GridLayout(int a)
Q. 18 Implement the Listener interface and overrides its (b) GridLayout(int num_rows, int num_columns)
methods is required to perform in event handling? (c) GridLayout(int rows, int cols, int vert)
(a) True (b) False (d) GridLayout(int hor)
Q. 19 Public class MenuBar extends ____________. Q. 27 What are the types of DialogBox?
(a) MenuComponent (a) Modal DialogBox
(b) MenuContainer (b) Modal and Modeless DialogBox
(c) ComponentMenu (c) Modam
(d) MenuBar (d) None of the above

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 Frame’s font is set to for a TextField?
12 point Times New Roman, the panel’s font is set (a) setPasswordCharacter( )
10 points Times New Roman and the Button’s font (b) setEchoChar( )
is not set. What font will be used to display the
(c) setPassChar( )
Button’s 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)

Q. 64 What is the use of setEchoChar( ) method? (a) Only A statement is true.


(a) to set echo in symbol form (b) Only B statement is true.
(b) to set char in symbol form (c) Only C statement is true.
(c) Both A & B (d) All A,B and C are true.
(d) to create password in symbol form Q. 67 The default layout of Applet is _______.
Q. 65 __________ method returns currently selected (a) GridLayout
item in choice. (b) CardLayout
(a) getSelectedItem( ) (c) FlowLayout
(b) getSelectedElement( ) (d) BorderLayout
(c) getSelectedIndex( )
Q. 68 Java Applets are used to create ________
(d) getItem( ) applications.
Q. 66 Which statement with respect to inner class is (a) Graphical
true. (b) user interactive
A. It is a way of logically grouping classes that are (c) Both A & B
only used in one place. (d) None of these
B. It increases encapsulation.
C. It can lead to more readable and maintainable
code.

Answers

(b) (b) (b) (a) (c) (a) (c) (a)

(c) (a) (b) (c) (c) (b) (a) (b)

(b) (a) (a) (c) (d) (c) (a) (c)

(c) (b) (b) (a) (a) (a) (c) (d)

(c) (b) (c) (d) (a) (c) (b) (d)

(c) (b) (d) (d) (c) (a) (b) (a)

(d) (c) (b) (d) (c) (d) (c) (b)

(c) (b) (c) (c) (c) (c) (a) (c)

(a) (d) (c) (c)

You might also like