Ajp MCQ Chap-2

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 18

MCQ on 2nd chapter

1._______ is a swing class that allows to enter a single line of text.


a) TextField
b) JTextField
c) EditTextField
d) TextArea
Ans : b) JTextField

2. Which is default layout manager for JApplet?


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

3. Which method is used to add items to JComboBox?


a) addElement()
b) add()
c) additem()
d) addItem()
Ans : d) addItem()

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


a) addTab()
b) additem()
c) add()
d) addtab()
Ans : a) addTab()
5. Which component in swing represents data in rows and columns?
a) JTabbedPane
b) JTable
c) JProgressBar
d) JButton
Ans : b) JTable

6. What is full form of JFC?


a) Java Founder Class
b) Java Foundation JClass
c) Java Foundation Classes
d) Java Foundation Category
Ans : c) Java Foundation Classes

7. Which control in swing is a combination of a textfield and a


dropdown list?
a) JChoice
b) Choice
c) ComboBox
d) JComboBox
Ans : d) JComboBox

8. Which component cannot be added to a container?


a) JFrame
b) Frame
c) JButton
d) JLabel
Ans : a) JFrame
9. Which component displays information in hierarchical manner with
parent-child relationship?
a) Tree
b) JTree
c) Jtree
d) JTable
Ans : b) JTree

10. JTabbedPane class is present in which package?


a) javax.awt
b) java.awt
c) javax.swing
d) java.swing
Ans : c) javax.swing

11.Swing is not a part of JFC (Java Foundation Classes) that is used to


create GUI application?
A] True
B] False
Ans : B)False

12.Which package is used for import the swing components?


A] java. Swing
B] java. awt
C] javax. Swing
D]All of the above
Ans: C] javax. Swing

13.In swing, Button are subclasses of which class?


A] AbstractButton
B] JButton
C] Button
D] JRadioButton
Ans: A] AbstractButton

14.JTree class belongs to which package?


A] java. awt
B] java. applet
C] java. swing
D] javax. Swing
Ans : D] javax. swing

16.The Swing component classes that are used in Encapsulates a


mutually exclusive exclusive set of buttons ?
A] AbstractButton
B] ButtonGroup
C] JButton
D] Imagelcon
Ans : B] ButtonGroup
17.What is purpose of JTree ?
A] To show data in form of parent and child nodes
B] To show data in list view
C] To show data in tabular Form
D] To show data in menu_bar
Ans: A] To show data in form of parent and child nodes

18.__________class used to create node in tree


A] TreeNode
B] Default Mutable Node
C] Default Mutable Tree Node
D] Node
Ans: C] Default Mutable Tree Node

19.The string parameter to JButton Constructor ___________


A] tell which region to put the JButton in
B] tell the color of the JButton
C]tells what text will appear on JButton
Ans: C]tells what text will appear on JButton

20. The java foundation class (JF (c) is a set of GUI components
which simplify the development of desktop application?
A] True
B] False
Ans: A] True

21.The following specifies the advantages of  It is lightweight.


 It supports pluggable look and feel, It follows MVC
architecture.
A]. Swing .
B]. AWT.
C]Both A and B.
D].None of the Above.
22.Swing is not a part of JFC(Java Foundation Classes) that is used
to create GUI application?
A].True.
B].False.
23.The Swings Compoents classes that are used in Encapsulates a
mutually exclusive set a buttons?
A]. AbstractButton.
B]. ButtonGroup.
C]. JButton.
D]. ImageIcon.
24.The JFC is a set of GUI components which simplify the
development of desktop applications?
A].True.
B]. False.
25.Which Package is used for importing the swing components?
A]. java.swing.
B].java.awt.
C]. javax.swing.
D].All of the above.
26.The String parameters to JButton Constructor
_______________ .
A]. tell which region to put the JButton in.
B]. tells the colors of the JButton.
C]. tells what text will appear on JButton.
D]. None.

27.Abbrevation of MVC ______________ .


A]. Modelling-Visual-Controller.
B]. Model-View-Controller.
C]. Model-Viewable-Controller.
D]. Many-View-Controller.
28.In swing, Buttons are subclasses of which class?
A]. AbstractButton .
B]. JButton .
C]. Button .
D].JRadioButton .
29.__________________ class is used to create node in tree.
A]. TreeNode.
B]. DefaultMutableNode .
C]. DefaultMutableTreeNode .
D].Node.
30.Which components in swing represent data into rows and
columns?
A]. JTextArea .
B]. JTabel .
C]. Jpanel .
D]. JtabbedPane .
31. What is the purpose of JTree?
A]. To show data in the form of parent and child nodes.
B]. To show data in list view .
C]. To show data in tabular form .
D]. To show data in menu-bar .
32.Which of the following architecture does the swing framework use
?
A]. MVC
B]. MVP
C]. Layered Architecture
D]. Master-slave Architecture

33.Which language is used in the swing framework?


A]. JavaScript
B]. Java
C]. React
D]. Python

34.Which of these methods cannot be called on JLAbel object?


A) setIcon()
B) getText()
C) setLabel()
D) setBorderLayout()

35. Which of the following is not a constructor of tree?


A) JTree(object obj[])
B) JTree(TreeNode + n)
C) JTree(Vector V)
D) JTree(int x)

36. Swing components are ______________ .


A) Platform dependent
B) Platform independent
C) Both A & B
D) Platform oriented

37. In swing MVC architecture , C stands for ___________ .


A) Controller
B) Container
C) Class
D) None of These
38. What is the return type of getText() method of JButton class?
A) Void
B) String
C) Character Array
D) There is no such method

39. Default Orientation of progress bar is _________________ .


A) Horizontal
B) Vertical
C) Both A and B D) None of these

40. JTabbedPane class is present in which packages?


A) Java.awt.*;
B) Javax.swing.*;
C) Java.io.*;
D) Java.util.*;

41. Swing is based on ______________ architecture.


A) Client Server
B) Model View Controller
C) Layered
D) None of these

42. MVC architecture is used by Applet?


A) True
B) False
C) Both A and B
D) None of these

44. Which class encapsulates an icon .


A) Image
B) Icon
C) IconImage
D) ImageIcon

45. Which class represent the swing version of Applet.


A) SwingApplet
B) SApplet
C) JApplet
D) JSApplet

46. The Swing version of Radio button .


A) JRadioButton
B) JRadiobutton
C) JradioButton
D) None

47. JApplet is ____________ with functionality when compared with


Applet.
A) Rich
B) Poor
C) Same
D) Different

48. The Components in JApplet are added to


A) Current JApplet Class
B) ContentPane
C) Both A and B
D) None

49. Constructor for using Icon and Label in Swing.


A) ImageIcon(String filename)
B) ImageIcon(URL url)
C) Both A and B
D) None

Ans : c) Both A and B

50. How many Options can be selected in JRadioButton at a time?


A) Only One
B) Multiple
C) It is defined in the program
D) Only a maximum of six

Ans : Only One

51. A tree represent a __________ view of data.


A) Structural
B) Hierchical
C) Multiple
D) Single

Ans : b)Hierchical

52. Which of the following alignment is not possible for JLabel ?


A) TOP
B) LEFT
C) CENTER
D) LEADING

Ans: a)TOP
53.Which of the following function is used to generate the
application's top-level window?
a) JPanel
b) JFrame
c) JCombo
d) JBox

Answer: B) JFrame

54.Which of the following component gives a drop-down list of


options from which to choose?
a)JPanel
b)JButton
c)JComboBox
e) JBox

Ans: C) JComboBox

55.Among AWT and Swing which is platform independent?


a)AWT
b)Swing
Ans: B) Swing

56.Is Swing thread-safe?


a)Yes
b)No
Ans: B) No

57.The __ function is used to specify the layout of a container.


a)UseLayeout()
b)setLayout()
c)layout()
d)DesignLayout()
Ans: B) setLayout()

58.Which of the following is not a swing component?


f) JTextArea
g) JLabel
h) JScrollPane
i) JPanel

Ans: c) JScrollPane

59.Which of the following components can display images?


j) JTextArea
k) JTable
l) JList
m) JLabel

Answer: d) JLabel

60._________ class used to create node in tree


n) TreeNode
o) DefaultMutableNode
p) DefaultMutableTreeNode
q) Node

Ans: c)DefaultMutableTreeNode
61._____ represents enterprise data and the business rules that gives
access to enterprise data.
a) Model.
b) View.
c) Controller.
d) None of these.
Ans:- a) Model.
62.In swing the event handling task is carried out by ___.
a) Model.
b) View.
c) Controller.
d) None of these.
Ans:- c) Controller.

63.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.
d) Scrollbar and Scrollpane both are containers.
Ans:- a) Scrollbar is component and Scrollpane is container.
64.Frame class Entends Windows.
a) True.
b) False.
Ans:- a) True.
65.Which is the container class?
a) Window
b) Frame.
c) Dialog.
d) All of the above.
Ans:- d) All of the above.
66.Following is uneditable control
a) Button.
b) Textfield.
c) Label.
d) List.
Ans:- c) Label.
67.JPanel and Applet use ____ as their default layout
a) FlowLayout.
b) GridLayout.
c) BorderLayout.
d) GridBagLayout.
Ans:- a) FloeLayout.
.
68.MVC architecture is used by swing.
a) True.
b) False.
Ans:- a) True.
69..The Swing component classes that are used in Encapsulates a
mutually exclusive set of buttons?
a) AbstractButton.
b) ButtonGroup.
c) JButton.
d) ImageIcon.
Ans:- b) ButtonGroup.

70. Class used to create node in tree.


a. Treenode
b. DefaultMutableNode
c.DefaultMutableTreeNode
d. Node
Ans : c

71. An __ is a change in the state of an item


a. Spinner
b. Event
c. Occurrence
d. Activity
Answer: B) Event

72. How many types of events are there?

a. 5
b. 3
c. 2
d. 4
Answer: C) 2

You might also like