Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

MARATHAWADA MITRAMANDAL’S POLYTECHNIC, THERGAON, PUNE-33

Academic Year 2019-2020

Program: CO5I Course: Advanced Java Programming (22517) Course Co-ordinator: Mrs.Chavan P.P.
Unit II- Swing
Question Bank

Sr.
Question Option A Option B Option C Option D
No.

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


1 TRUE FALSE
create GUI application

Pluggable look and feel and lightweight components are the


2 Swing AWT Core Java None of these
features supported by _______.

3 Swing is based on __ architecture client server model view controller layered none of these

4 Following letter used as a prefix to swing component. A S gif file J

5 In Swing JButton class is derived from __ . AbstractButton JToggleButton Jcomponent None of these

6 In Swing class hierarchy the class present at the rootis ____ Component Window Container Object

7 ________pane can be used to add component to container Glass Content Container All of above

8 To represent Icon file in swing label we use setimg setIcon setLabelIcon None of these

Which method of the component class is used to set the position


9 setPostion setBounds setSize none of these
and size of a component?

Scrollbar is component and Scrollbar is container and Scrollbar and Scrollpane both Scrollbar and Scrollpane both
10 The difference between Scrollbar and Scrollpane is _______ Scrollpane is Scrollpane is are components are container and
container component and not containers not components

11 MVC stands for ______ Model Version Control Model View Controller Mini View Controller Major View Controller

12 In swing _______ gives the visual representation of the component Model View Controller None of these

13 JPanel and Applet use____________ as their default layout FlowLayout GridLayout BorderLayout Gridbagl.ayout
14 Which of the following component multiple selection? Jlist JComboBox JLAbel All of the above
Select the correct source code using swing for generating following
output.
public class AppletDemo public class AppletDemo
public class AppletDemo public class AppletDemo
extends JApplet extends JApplet
{ extends JApplet
{ {
public void {
public void public void
paint(Graphics g) public void paint(Graphics
paint(Graphics g) paint(Graphics g)
{ g)
15 { {
g.drawString("WELCOME {
g.msg("WELCOME TO g.drawString("WELCOME
TO SWING g.display('WELCOME TO
SWING TO SWING
PROGRAM',20,40); SWING PROGRAM",20.40);
PROGRAM",20,40); PROGRAM",20,40);
} }
} }
} }
} }

The components used to display following image are _______

three circle, one arc and one


16 two circle, two arcs four circles three circles and one arc
rectangle

To generate above output we need _____

17 List, choiceButton,ImageIcon ComboBox, Image Icon,Label List and Image leon ComboBox and Image leone
To generate following output the components that are used are _

18 Checkbox, Textbox Radiobutton, Textbox Checkbox,button List, Textbox

19 The subclass of JToggleButton is _______ JButton JCheckBox JRadioButton Both b and c

The Swing Component classes that are used in Encapsulates a


20 AbstractButton ButtonGroup Jbutton ImageIcon
mutually exclusive set of buttons ?

Select the correct output generated by


following code
import java.awt. *;
import java.applet. *;
*<applet code=Test.class height=200 width=200> </applet>*/
public class Test extends Applet
{
public void init()
21
{
List l= new List(2,true);
Laddt'Tava");
l.add(nc+ +"):
l.addt'Python"):
add(l);
}
}
21Select the correct option
22 I. Canvas is a component I is True and II is False I is False and II is True I and II both are False I and II both are true
II.ScrollPane is a container
23 Frame class Extends Window. TRUE FALSE
24 Which is the container class? Window Frame Dialog All of the above
25 Following is uneditable control Button TextField Label List
Debug the following program
import javax.swing. *;
import java.awt. *;
import javax.swing.tree. *;
/*<applet code=''TableDemo'' width=300 height = 100> </applet> */
public class TableDemo extends JApplet {
public void init(){
Container contentPane = getContentPane();
contentPane.setLayout(new BorderLayout()); .
final String[] th = { "Name", "City", "Salary","Designation" };
final Object mytable = { {"Arun", "Pune", "5000","Account"},
{"Archana", "Mumbai", "7000","Executive"},
Error in statement in which Error in statement in which Error in statement in which
26 { "Shivani", "Banglore", "lOOOO","Manager"}, None of these
Table is created JScrollPane is created applet tag is declared
{ "Priyanka", "Chennai", "8000","Programmer"},
{ "Monika", "Hyderabad", "10000","Designer"},
{ "Shilpa", "Hyderabad", "12000","Director"},
{ "Anuja", "Delhi", "7000","Director"},
{"Kumar", "Pune", "10000","Manager"} };
JTable table = new JTable(mytable);
int vscrollbar =
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int hscrollbar =
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane mypane = new JScrollPane(table, vscrollbar,hscrollbar) ;
contentPane.add(mypane, BorderLayout.CENTER); } }

Panel, TabbedPane, Radio


27 Which components are used to generate following output? TabbedPane, List TabbedPane,Panel Label, TabbedPane, Checkbox
button

28 MVC architecture is used by swing TRUE FALSE


29 In swing the event handling task is carried out by_____ Model View Controller None of these
_____ represents enterprise data and the business rules that gives
30 Model View Controller None of these
access to enterprise data.
__ is one of the features of object oriented programming that allows
31 Polymorphism Class Inheritance Object
the creation of hierarchical classifications.
32 The JTextComponent derives two components JTextField and ______ JComboBox JTextArea JSlider All of the above
Where are the following four methods commonly used?
1) public void add(Component c)
33 2) public void setSize(int width,int height) Graphics class Component class Both A & B None of the above
3) public void setLayout(LayoutManager m)
4) public void setVisible(boolean)

The Java Foundation Classes (JFC) is a set of GUI components which


34 TRUE FALSE
simplify the development of desktop applications.

The following
a) It is lightweight.
35 b) It supports pluggable look and feel. Swing AWT Both A & B None of these
c) It follows MVC (Model View Controller) architecture
are the advantages of _____ .

You might also like