0% found this document useful (0 votes)
24 views

Exam Sutra Advance Java Chapter 2

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Exam Sutra Advance Java Chapter 2

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

Unit 2 : Swing

Total no. of Questions – 100

121. Pluggable look and feel and lightweight components are the features
supported by ________

a. Swing
b. AWT
c. Core java
d. None of these

122. Swing is based on _____ architecture

a. Client server
b. Model view controller
c. layered
d. None of these

123. Swing is not a part of JFC that is used to create GUI application.

a. True
b. False

124. The java foundation classes ( JFC ) is a set of GUI components which
simplify the development of desktop applications.

a. True
b. False
125. Following letter used a prefix to swing component.

a. A
b. S
c. G
d. J

126. _____ is one of the features of object oriented programming that allows the
creation of hierarchical classifications.

a. Polymorphism
b. Class
c. Inheritance
d. Object

127. In swing JButton class is derived from _________

a. AbstractButton
b. JToggleButton
c. JComponent
d. None of these

128. The JTextComponent derives two components JTextField and ______

a. JComboBox
b. JTextArea
c. JSlider
d. All of the above

129. In swing class hierarchy the class present at the root is ___

a. Component
b. Window
c. Container
d. Object

130. ________ pane can be used to add component to container.

a. Glsass
b. Content
c. Container
d. All of the above

131. To represent icon file in swing label, we use

a. Setimg
b. setIcon
c. serLabelIcon
d. none of this

132. which of the following component allows multiple selection?

a. JList
b. JComboBox
c. JLabel
d. All of the above

133. The subclass of JToggleButton is _____

a. JButton
b. JCheckBox
c. JRadioButton
d. Both b & c

134. The swing component classes that are used in encapusulates a mutually
exclusive set of buttons?

a. Abstractbutton
b. ButtonGroup
c. JButton
d. ImageIcon

135. Which method of the component class is used to set the position and size
of a component?

a. setPosition
b. setBounds
c. setSize
d. none of these

136. select the correct option

1. canvas is a component
2. scrollpane is a container

a. 1 is true and 2 is false


b. 1 is false and 2 is true
c. I & 2 both are false
d. 1 & 2 both are true

137. The difference between scrollbar and scrollpane is __________

a. Scrollbar is component and scrollpane is container


b. Scrollbar is container and scrollpane is component
c. Scrollbar and scrollpane both are components and not containers
d. Scrollbar and scrollpane both are containers and not components

138. Frame class extends window

a. True
b. False

139. Which is the container class?


a. Window
b. Frame
c. Dialog
d. All of the above

140. Following is uneditable control

a. Button
b. Textfield
c. Label
d. List

141. Jpanel and Applet use _____ as their default layout.

a. Flowlayout
b. Gridlayout
c. Border layout
d. Gridbag layout

142. MVC stands for ____

a. Model version control


b. Model view controller
c. Mini view controller
d. Major view controller

143. MVC architecture is used by swing ____

a. True
b. False

144. In swing _____ gives the visual representation of the component.

a. Model
b. View
c. Controller
d. None of these

145. In swing the event handling task is carried out by _______

a. Model
b. View
c. Controller
d. None of these

146. _____ represents enterprise data and the business rules that gives access to
enterprise data.

a. Model
b. View
c. Controller
d. None of these

147. Which of these functions is called to display the output of an applet?

a. Display()
b. Paint()
c. displayApplet()
d. PrintApplet()

148. Components are added to which pane of swing JApplet .

a. Content pane
b. Window
c. Container
d. None of these

149. Which of the following component is not supported by AWT but supported
in Swing ?
a. Table
b. Tabbed pane
c. Both a & b
d. None of these

150. Double-buffering built in, tool tips, dockable tool bars, keyboard
accelerators, custom cursors, etc. are new features of

Ans – Swing

151. for using Swing control one must import ___________ package.

Ans - import javax.swing.*

152. getContentPane() method of which class

Ans – Japplet

153. How To Apply Image To Button ?

a. ImageInsert Class
b. ImageIcon class
c. PutImage class
d. None of these

154. In FlowLayout manager the default space between each component is

Ans – 5 pixels

155. In Swing, tables are implemented by the ______________ class

a. Table
b. JTable
c. YTable
d. All of these

156. Items are added in JComboBox using method......


a. addItem()
b. getItem()
c. both a & b
d. none of these

157. JApplet class is Derived form

Ans – Applet

158. JRadioButton is a subclass of ________.

a. AbstractButton
b. RadioButton
c. CheckBoxItem
d. None of these

159. In which package JTabbedPane class is present ?

a. Java.awt
b. Java.swing
c. Javax.swing
d. None of these

160. In which package JTree class is present ?

a. Java.awt
b. Java.swing
c. Javax.swing
d. None of these

161. Which method is used for getting the language in internationalization?

a. getDisplayLanguage()

b. GetdisplayLanguage()
c. GetDisplayLanguage()
d. None
162. What are the types of Applets ?

a. Trusted
b. Untrusted
c. Both a & b
d. None of these

163. JFrame myFrame = new JFrame (); Any command (such as the one listed
above) which creates a new object of a specific class (in this case a new JFrame
object called myFrame) is generally called a ..

a. Constructor
b. Layout Manager
c. Parameter
d. GUI

164. All collection classes are available in __________-

a. Java.util package
b. Java.lang package
c. Java.io package
d. Java.awt package

165. Suppose you are developing a Java Swing application and want to toggle
between various views of the design area. Which of the views given below are
present for the users to toggle?

a. Requirements View
b. Design View
c. Source View
d. Management View

166. What is the name of the Swing class that is used for frames?
a. SwingFrame
b. Frame
c. Window
d. None of these

167. What is the name of the Swing class that is used for frames?

a. SwingFrame
b. Frame
c. Window
d. JFrame

168. Plugable Look & Feel is the feature of

Ans – Swing

169. setBorder() method is used to set a border for ________

Ans – Jcomponent

170. Swing components are ____

a. Light weight
b. Platform independent
c. Both a & b
d. None of these

171. In _________ each component renders itself using the drawing primitives
of the Graphics object.

a. AWT
b. Swing
c. Both a & b
d. None of these

172. There is a debugging support for rendering of created swing components.


a. True
b. False

173. Choose the correct statement.

a. AWT supports limited number of GUI components


b. The AWT component is converted by the native code of the operating
system.
c. Swings components can have tooltip placed over them.
d. All of these

174. The swing is a light weight component because _____________

Ans – it is the responsibility of JVM to invoke the native methods.

175. JRadioButton is a sub-class of ____________

a. JCheckBox
b. JToggleButton
c. Both a & b
d. None of these

176. In swing how many ways to define a frame .

a. 3
b. 1
c. 2
d. 4

177. The method ______________ sets the foreground color to yellow in


Jframe.

Ans - f.setForeground (Color.YELLOW)

178. The method _______________creates a IconImage for file c:\image\us.gif

Ans - new ImageIcon("c:\image\us.gif");


179. The Swing component classes that are used in encapsulate a mutually
exclusive set of buttons are?

a) ButtonGroup
b) ButtonSets
c) Both a & b
d) None of these

180. When layout manager is disabled , which method is used to determine the
shape and position of Component?

a) SetBounds
b) SetSize
c) SetCoordinates
d) None of these

181. which package we need to import while writng swing JRadioButton class

Ans - import javax.swing.*;

182. Which Among the below is not an AWT class

a) RadionButton
b) Checkbox
c) CheckboxGoup
d) All of these

183. Which swing component is not editable ?

a) JLabel
b) JButton
c) JCheckBox
d) All of these
184. Which component displays information in hierarchical manner with parent-
child relationship?

a) JFrame
b) JTree
c) JComboBox
d) JTable

185. Which component in swing represents data in rows and columns?

a) JFrame
b) JTree
c) JComboBox
d) JTable

186. Which components are needed to get following shown output

a) Label , TextField
b) Label , Checkbox
c) Both a & b
d) None of these

187. Which is Controll in swing a combination of a text field and a dropdown


list

Ans – JcomboBox
188. Which is default layout Manager for Japplet?

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

189. Which method is used to add tabs to a JTabbedPane?

a) addTab
b) insertTab
c) putTab
d) none of these

190. Which method is used to close a swing frame?

a) setDefaultCloseOperation()
b) setCloseOperation()
c) closeFrame()
d) none of these

191. Which of the following are not swing component ?

a) JTree
b) JComboBox
c) iframe
d) JTable

192. Which of the following is not a swing class ?

a) JMenuBar
b) Canvas
c) JCheckBox
d) JTree
193. Which of the following is not true about swing components ?

a) Provides more GUI components


b) Swing provides debugging support
c) Heavy weight component
d) Uses JVM to invoke the native methods

194. The immediate super class of JCheckbox is ______________

a) JToggleButton
b) JCheckBox
c) JAbstractButton
d) JRadioButton

195. _________________ is used to create a tree node with no root node.

a) DefaultMutableTreeNode
b) AddTreeNode
c) InsertTreeNode
d) All of these

196. In Table the ________ denotes the header of each column.

Ans – columnheader

197. Which one of the following is the correct constructor for progressbar ?

a) JProgressBar()
b) JProgressBar(int min , int max)
c) Both a & b
d) None of these

198. How to create a progress bar with minimum and maximum value ?

Ans – Progressbar(int min , int max)


199. In progress bar which method is used to determine whether the string
should be displayed ?

a) Void SetStringPainted(Boolean status)


b) Void setStringColored(Boolean status)
c) Void setValue(int)
d) Void setString(string s)

200. Which type of data is passed as a parameter to SetStringPainted() method ?

Ans – Boolean

201. Which method is used to set the value of the progress bar ?

a) Void SetStringPainted(Boolean status)


b) Void setStringColored(Boolean status)
c) Void setValue(int value)
d) Void setString(string s)

202. In progress bar which method is useful in displaying the data after periodic
interval ?

Ans – Thread.sleep(1000);

203. MVC stands for ________

a) Model view center


b) Medium view controller
c) Model View Controller
d) None of these

204. In MVC which component manages the state and conducts all
transformations on that state ?

a) Model
b) View
c) Controller
d) None of these

205. In MVC which component manages the visual display of the state
represented by the model ?

a) Model
b) View
c) Controller
d) None of these

206. In MVC which component managing the user interaction with the model ?

a) Model
b) View
c) Controller
d) None of these

You might also like