AJP Chapter 2 Answer
AJP Chapter 2 Answer
Q.1 Pluggable look and feel and lightweight components are the features supported by ____.
a) Swing b) AWT
c) Core Java d) None of these
--- a) Swing
Q.3 Swing is not a part of JFC (Java Foundation Classes) that is used to create GUI application.
a) True b) False
--- b) False
Q.4 The Java Foundation Classes (JFC) is a set of GUI components which simplify the
development of desktop applications
a) True b) False
--- a) True
--- d) J
Q.6 _______ is one of the features of object oriented programming that allows creation of
hierarchical classifications.
a) Polymorphism b) Class
c) Inheritance d) Object
--- c) Inheritance
--- c) JComponent
--- b) JTextArea
Q.9 In swing class hierarchy the class present at the root is ______.
a) Component b) Window
c) Container d) Object
---a) Component
Q.10 ________ pane can be used to add component to container.
a) Glass b) Content
c) Container d) All of above
---b) Content
Q.11 Select the correct source code using swing for generating following output.
a) b)
public class AppletDemo extends public class AppletDemo extends
JApplet JApplet
{ {
public void paint(Graphics g) public void paint(Graphics g)
{ {
g.string(“WELCOME TO SWING g.drawString(“WELCOME TO
PROGRAM ”,20,40); SWING PROGRAM ”,20,40);
} }
} }
c) d)
public class AppletDemo public class AppletDemo extends
{ JApplet
public void paint(Graphics g) {
{ public void paint(Graphics g)
g.drawString(“WELCOME TO {
SWING PROGRAM ”,20,40); g.display(“WELCOME TO
} SWING PROGRAM ”,20,40);
} }
}
b)
public class AppletDemo extends JApplet
{
public void paint(Graphics g)
{
g.drawString(“WELCOME TO SWING PROGRAM ”,20,40);
}
}
---b) setIcon
---a) JList
Q.15 To generate above output we need _______.
Q.16 To generate following output the components that are used are _______.
a) b)
c) d)
----c)
Q.20 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
---b) setBounds
--- a) True
Q.24 Which is the container class?
a) Window b) Frame
c) Dialog d) All of the above
---c) Label
---a) FlowLayout
---b) False
---b) View
---c) Controller
Q.33 ______ represents enterprise data and the business rules that gives access to enterprise data.
a) Model b) View
c) Controller d) None of these
---a) Model
---b) JTree
---a) contentpane
Q.36 In swing, the content pane can be obtained via method ______.
a) getContentPane b) addContentPane
c) both a&b d) None of these
---a) getContentPane
Q.37 In a swing ____ is a component that display rows and columns of data.
a) table b) card
c) both a&b d) None of these
--- a) table
---b) JTable
Q.39 To use the swing components _____ package is imported.
a) java.awt b) java.swing
c) javax.swing d) None of these
---c) javax.swing
---b) JComponent
---b)JFrame
---b) JComponent
---c) 3
---b) AbstractButton
---c) 4
---b) JTabbedPane
---a) JComponent
Q.48 Which constructor is JComboBox class?
a) JComboBox() b) JcomboBox()
c) Both a&b d) JCombobox()
---a) JComboBox()
---b) addItem()
Q.50 Which component is used for creating a GUI for downloading or transferring of file.
a) JLable b) JButton
c) JProgressBar d) JProgressbar
---c) JProgressBar
---b) False
Q.55 Which class is provide a general purpose component for implementing divider lines?
a) JProgressBar b) JComponent
c) JTable d) JSeparator
---d) JSeparator
---a) False
---a) 5
Q.59 JTree has a 'root node' at the top most which is a parent for all nodes in the tree.
a) True b) False
---a) True
---d) 5