Deck 6: AWT Components and Layout Management in Java
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/23
Play
Full screen (f)
Deck 6: AWT Components and Layout Management in Java
1
How do you position a component using FlowLayout?
A)North, South, East, West
B)Assign a row/column grid reference
C)Pass a X/Y percentage parameter to the add method
D)Do nothing, the FlowLayout will position the component
A)North, South, East, West
B)Assign a row/column grid reference
C)Pass a X/Y percentage parameter to the add method
D)Do nothing, the FlowLayout will position the component
Do nothing, the FlowLayout will position the component
2
How do you change the current layout manager for a container
A)Use the setLayout() method
B)Once created you cannot change the current layout manager of a component
C)Use the setLayoutManager() method
D)Use the updateLayout() method
A)Use the setLayout() method
B)Once created you cannot change the current layout manager of a component
C)Use the setLayoutManager() method
D)Use the updateLayout() method
Use the setLayout() method
3
The AWT component used to display a single line of read-only text
A)A checkbox
B)A Label
C)A button
D)A TextField
A)A checkbox
B)A Label
C)A button
D)A TextField
A Label
4
The method to get the text of a Label
A)getLabel()
B)getText()
C)getString()
D)getData()
A)getLabel()
B)getText()
C)getString()
D)getData()
Unlock Deck
Unlock for access to all 23 flashcards in this deck.
Unlock Deck
k this deck
5
The AWT component used for taking input from user.
A)A TextBox
B)A Label
C)A button
D)A TextField
A)A TextBox
B)A Label
C)A button
D)A TextField
Unlock Deck
Unlock for access to all 23 flashcards in this deck.
Unlock Deck
k this deck
6
The method to set the text of Textfield.
A)setLabel()
B)setString()
C)setText()
D)setData()
A)setLabel()
B)setString()
C)setText()
D)setData()
Unlock Deck
Unlock for access to all 23 flashcards in this deck.
Unlock Deck
k this deck
7
The class used to create a Radio button in awt is
A)Checkbox
B)RadioButton
C)OptionButton
D)CheckboxGroup
A)Checkbox
B)RadioButton
C)OptionButton
D)CheckboxGroup
Unlock Deck
Unlock for access to all 23 flashcards in this deck.
Unlock Deck
k this deck
8
A ------------ is an object that the user can see on the screen and-in most cases-interact with.
A)an Event
B)a window
C)a Component
D)a Listener
A)an Event
B)a window
C)a Component
D)a Listener
Unlock Deck
Unlock for access to all 23 flashcards in this deck.
Unlock Deck
k this deck
9
A ------------- is a component that can hold other components.
A)A window
B)a container
C)A control
D)a form
A)A window
B)a container
C)A control
D)a form
Unlock Deck
Unlock for access to all 23 flashcards in this deck.
Unlock Deck
k this deck
10
The method that returns the selected item from a List component is
A)getSelected()
B)getSelectedString()
C)getSelectedItem()
D)getSelectedData()
A)getSelected()
B)getSelectedString()
C)getSelectedItem()
D)getSelectedData()
Unlock Deck
Unlock for access to all 23 flashcards in this deck.
Unlock Deck
k this deck
11
The class used to make a standalone application in java.
A)Applet
B)Panel
C)Frame
D)Form
A)Applet
B)Panel
C)Frame
D)Form
Unlock Deck
Unlock for access to all 23 flashcards in this deck.
Unlock Deck
k this deck
12
------------------- is an example of container class
A)Label
B)Panel
C)TextField
D)Button
A)Label
B)Panel
C)TextField
D)Button
Unlock Deck
Unlock for access to all 23 flashcards in this deck.
Unlock Deck
k this deck
13
The class used to encapsulate fonts is
A)Graphics
B)Font
C)Applet
D)Component
A)Graphics
B)Font
C)Applet
D)Component
Unlock Deck
Unlock for access to all 23 flashcards in this deck.
Unlock Deck
k this deck
14
The method used to set Fonts is
A)setFontName()
B)setFont()
C)setFontText()
D)none of these
A)setFontName()
B)setFont()
C)setFontText()
D)none of these
Unlock Deck
Unlock for access to all 23 flashcards in this deck.
Unlock Deck
k this deck
15
The method setFont() is defined in---------- class
A)Applet
B)Font
C)Container
D)Component
A)Applet
B)Font
C)Container
D)Component
Unlock Deck
Unlock for access to all 23 flashcards in this deck.
Unlock Deck
k this deck
16
The layout manager that lets you align components at north, south, east, west directions is
A)BorderLayout
B)GridLayout
C)FlowLayout
D)GridBagLayout
A)BorderLayout
B)GridLayout
C)FlowLayout
D)GridBagLayout
Unlock Deck
Unlock for access to all 23 flashcards in this deck.
Unlock Deck
k this deck
17
The layout manager that lays out a container's components in a rectangular grid.
A)BorderLayout
B)GridLayout
C)FlowLayout
D)GridBagLayout
A)BorderLayout
B)GridLayout
C)FlowLayout
D)GridBagLayout
Unlock Deck
Unlock for access to all 23 flashcards in this deck.
Unlock Deck
k this deck
18
The class used for drawing graphics in an application is
A)Canvas
B)Graphics
C)Layer
D)Container
A)Canvas
B)Graphics
C)Layer
D)Container
Unlock Deck
Unlock for access to all 23 flashcards in this deck.
Unlock Deck
k this deck
19
The method in Graphics class to draw a circle/oval with specified width and height.
A)drawCircle()
B)drawShape()
C)drawOval()
D)none of these
A)drawCircle()
B)drawShape()
C)drawOval()
D)none of these
Unlock Deck
Unlock for access to all 23 flashcards in this deck.
Unlock Deck
k this deck
20
The method in Graphics class to set the drawing color
A)setForeground()
B)setDrawingColor()
C)setBrushColor()
D)setColor()
A)setForeground()
B)setDrawingColor()
C)setBrushColor()
D)setColor()
Unlock Deck
Unlock for access to all 23 flashcards in this deck.
Unlock Deck
k this deck
21
The method used to draw an ellipse is
A)drawEllipse()
B)drawCircle()
C)drawOval()
D)none of these
A)drawEllipse()
B)drawCircle()
C)drawOval()
D)none of these
Unlock Deck
Unlock for access to all 23 flashcards in this deck.
Unlock Deck
k this deck
22
Which of the following statements is legal in Java?
(i) mysRef = (Mystery) mySecret;
(ii) mysRef = (Mystery) secRef;
A)Only (i)
B)Only (ii)
C)Both (i) and (ii)
D)None of these
(i) mysRef = (Mystery) mySecret;
(ii) mysRef = (Mystery) secRef;
A)Only (i)
B)Only (ii)
C)Both (i) and (ii)
D)None of these
Unlock Deck
Unlock for access to all 23 flashcards in this deck.
Unlock Deck
k this deck
23
What is the value of y if x = 2?
A)2
B)3
C)7
D)9
A)2
B)3
C)7
D)9
Unlock Deck
Unlock for access to all 23 flashcards in this deck.
Unlock Deck
k this deck