Saturday, May 25, 2019

Chapter 1 (MCQ:101-200)


Window Fundamentals:

The AWT defines windows according to a class hierarchy that adds
functionality and specificity with each level. The two most common windows are
those derived from Panel, which is used by applets, and those derived fromFrame, which creates a standard window. Much of the functionality of these
windows is derived from their parent classes. Thus, a description of the class
hierarchies relating to these two classes is fundamental to their understanding.
Figure below shows the class hierarchy for Panel and Frame.
For 1-100 MCQ of Chapter 1

101 Select the proper constructor of FileDialog = FileDialog(Frame parent, String boxName)

102 Select the proper syntax to addcomponent in an applet = Component add(Component comoObj)

103 setBorder() method is used to set a border for ________? = Jcomponent

104 setMenuBar() method of which class =Frame

105State true of false i) AWT is an extended version of swing ii) Paint( ) of
Applet class cannot be overridden =i-false, ii-false

106 Swing components are = lightweight and platform independent

107swing is the set of ____________ that provides more powerful &
flexible components as compare to AWT.= Classes

108 Text field usually called as= edit control

109 TextField class is used for__________= Single-Line text-entry area

110 The Applet class is in ………..package = java.applet
111The AWT container is an instance of the ___________ class which
holds various components and other containers
= Container

112 The Card Layout class defines the following constructors: = CardLayout() // First Cardlayout(int hor, int ver) //second

113The Card Layout class manages the components in such a manner that=Only one
____________component is visible at a time

114The concept of the menu bar can be implemented by using three java
classes— All of these

115 The coordinate of the upper-left corner of a frame is ________. = (0, 0)

116 The correct hierarchy for panel is =Component-Container-Panel

117The default layout manager for the content pane of a swing based
applet is
= Border-Layout

118The following specifies the advantages of It is lightweight. It supports
pluggable look and feel. It follows MVC (Model View Controller)
architecture= Swing

119The method drawRect() is used to display an
___________________________= outlined rectangle

120 The method setLabel can be used with what type of Object ? = TextField.

121 The method ____gets the text of the button jtb is = jtb.getText( )

122 the method _________ places a menu mu into a menu bar mb. = mb.add(mu)

123The method ______________ sets the foreground color to yellow in
JFrame= f.setForeground (Color.YELLOW)

124The method _______________creates a IconImage for file
c:\image\us.gif= new ImageIcon("c:\image\us.gif");

125The method ____________________gets the text (or caption) of the
label jlb= jlbl.getText()

126The setBackground() method is part of the following class in java.awt
package:= Component

127 The string parameter to the JButton constructor=ells what text will appear on the button

128The Swing component classes that are used in encapsulate a mutually exclusive set of buttons are?= ButtonGroup

129 The syntax for drawRect() method is = drawRect(int top, int left, int width, int height)

130 The TextArea controls create a ________ respectively.= Multi-line text

131 the various Control Supported by AWT are= All of these

132 The various controls supported by swing are: = all of the above

133The __________ arranges components in rows and columns and
makes all components the same size.
= GridLayout manager
134 The ___________ interface is used to handle button events: = ActionListener

135 The _____________ class is used to create radio button in AWT = CheckboxGroup

136 The ___________________ Can be used to enter or display a string = textfield

137These four methods commonly used in? 1)public void add(Component
c) 2)public void setSize(int width,int height) 3)public void
setLayout(LayoutManager m) 4)public void setVisible(boolean)= Component class
138 To create window with title bar which of the following class is used?=Frame

139 To create file dialog box ______________ class is used = FileDialog

140 To display text on the applet ______ method is used. =drawString()


141 To draw a line in applet, we use following method =drawLine()

142 To fetch caption of button___________ method is used. = getLabel( )
143To retrieve the current state of a check box,call
___________________
= getState()

144 To set title to the frame window___________ method is used. = void setTitle(String str)

145 We can add menus to _________________________= Frames

146 What are controls or components? =Controls or components allow users to interact with application
147 What are the TextCompoent ? = TextField , TextArea

148 What Are The Types of Dialogbox ? =modal and Modeless Dialogbox

149 What are the variables defined in Dimension = height and width

150 What Checkbox method allows you to tell if a Checkbox is checked? = getState()

151What does the following line of code do? TextField text = new
TextField(10)= Creates text object that can hold 10 columns of text.

152 What is API =Application Programming Interface

153 What is default alignment of components using FlowLayout = FlowLayout.CENTER

154 what is default layout manager for panels and applets= FlowLayout

155 What is the default layout for a dialog? =BorderLayout

156 What is the difference between a TextArea and a TextField? = TextArea can handle multiple lines of text

157 What is the minimum and maximum of JProgressBar = minimum -0 Maximum -100

158What is the use of following method in JDialog? Container
getContentPane()= This method returns,a Content Pane for the JDialog.

159What is use of 3rd parameter in given constructor
Scrollbar(int,int,int,int,int) = Thumbsize

160 What is use of second parameter in given constructor Label(String,int) = sepcifies the alignment of text in label in terms of pixel

161what layout manager should you use so that every component
occupies the same size in the container?= GridLayout

162What letter precedes Swing component names that have a
corresponding AWT component?= J

163What method is used to prevent a user from changing the size of a
Frame() object?= setResizable( false )

164What methods are used to get and set the text label displayed by a
Button object?= getLabel( ) and setLabel( )

165 When DialogBox is closed which method gets called = dispose()

166When layout manager is disabled , which method is used to determine
the shape and position of Component?= setBounds

167When we invoke repaint() for a java.awt.Component object, the AWT
invokes the method:= update()

168 which method is used to set the visibility of the frame? =.setVisible(true)

169which package we need to import while writng swing JRadioButton
clas= import javax.swing.*;

170 Which abstract class is the super class of all menu related classes.= MenuComponent

171 Which Among the below is not an AWT class= RadioButton

172 Which are the Alignment Constant of Label ? = All The Above

173 Which are the subclasses of the container class? =Windows,Panel,ScrollPane.

174 Which AWT component is not editable?= Label

175 Which AWT control is used for multi-line text entry? = TextArea

176Which class can be used to represent a checkbox with a textual label
that can appear in a menu.= CheckboxMenuItem

177 Which class creates a node in Jtree? = DefaultMutableTreeNode

178 Which class defines the setSize( ) method ?=Frame

179 Which class encapsulates a blank window upon which we can draw?= Canvas

180 Which class is on the top of the AWT event hierarchy? =java.awt.AWTEvent

181Which class is used to create a pop-up list of items from which the user
may choose?= Choice

182 Which Class is used to get dimension of an Applet? = Dimension

183Which class is used to represent a single line textbox with password
character facility?= TextField

184 Which class provides many methods for graphics programming?= java.awt.Graphics

185 Which componant canot be added to a container? = JFrame

186Which component displays information in hierarchical manner with
parent-child relationship?=JTree

187 Which component in swing represents data in rows and columns? = JTable

188Which Component of AWT provides a compact, multichoice , scrolling
selection?= List

190 which Container use a Border Layout as their default layout?= All of the above

191 Which containers may have a MenuBar? = Frame

192 Which control is not contain in AWT Package ? = Scrollpane

193 Which h costructor creates a TextArea with 10 rows and 20 columns ? = new TextArea(10 , 20 )

194Which is Controll in swing a combination of a text field and a dropdown
list
= JComboBox

195Which is correct method for adding button component into North region
of border layout? Assume b1 as button object .
= add(b1, BorderLayout.NORTH)

196 which is default layout Manager for Japplet? = BorderLayout

197 Which is immediate super class for TextField? = TextComponent

198 Which is the a constructor of JTabbed Pane = Both option A and B

199 Which is the correct constructor for JProgressBar = All of the above

200 Which is the correct constructor of GridLayout = GridLayout(int numrows, int numcols)

No comments:

Post a Comment

java program (Tree)