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

GOVERNMENT POLYTECHNIC, YAVATMAL

Dhamangaon Road, Yavatmal


CLASS TEST-I
Program Code CO Course: AJP (22517) Semester: Fifth
Marks. 20 Date: 17/10/2022 Time: 1Hour
Vame of studcnt: Roll no. Marks obtained: Invigilator Sign:

Solve the following questions: ( Tick the correct option.)


Q1 Using a Flowlayout manager, which is the correct way to add elements to acontainer? CO4
a) add(Component., region): b) add(x, y, component); c) add(Component); d) set(component);

Q.2 Which is the container that doesn't contain title bar and MenuBars but it can have other components like
button, textrield etc? (COa)
a) Window b) Panel c) Frame d) Container

Q.3 Which object can be constructed to show any number of choices in the visible window? (CO a]
a) Label b) Choice c) Checkbox d) List

Q.4 Which is the default look & feel for swing Applets? iCO
a) Nimbus b) Metal c) Sea Glass d) Window

Q.5 Which of the following method creates an Imagelcon for file image.gif?i(0 aj
a) new Imagelcon("c: \image.gif") b) new lcon("c:limage.gif")
c) new Imagelcon("c:\image.gif") d) new lcon("c:\image.gif")

Q.6 Which of the following swing container is lightweight? [CO a)


a) JFrame b) JApplet c) JDialog d) JPanel

Q.7 Which method can remove the registered event listener? /CO b)
a) removeTypeListener( ) b) removeListener() c) removeEvent( ) d) Can't be removed

Which of the following are direct or indirect subclasses of Container?


i) Frame i) TextArea ii) MenuBar iv) FileDialog v) Applet
* a)) iand v b) i, iv and v c) i, iii, iv and v d) i, ii, ii, ivand v

Q.9 Which Component method is used to access a component's immediate Container?


a) getVisible() b) getImmediate() c) getParent() d) getContainer()

Q.10 When we invoke repaint() for ajava.awt.Component object, the AWT invokes the method jCO a
a) draw() b) update(0 c) show) d) paint()

Which of the following are true? i) A Dialog can have a MenuBar, i) Menultem extends Menu.
Q.11
i) AMenultem can be added to aMenu. iv) AMenu can be added to aMenu. d) ii and iv
a) i b) ii c) ii

0.12 Which abstract class is the super class of all menu related classes?
a) MenuBar b) Checkbox Menultem c) Menultem d) MenuComponent
)13 Using which dasses user can implement radiobutton in Swing?
)JRadioButton i) JCheckBox in) JRadioButton iv) CheckbeoxGroup v)Checkboxiroup
a) only i b) vi and v c) iand ii ) iiand v

0 14 When weneed to uSe check boxes or item from the list or use a chcckable menuitem, an
IS generated.
a) Actiont vent b) ItemEvent c) Adjustnentivent d) Allof these

o16 which of theseconstant valuc will change when the button at the end of scroll bar was clicked to increasc
its value?
a) BLOCK INCREMENT c) UNIT INCREMENT
b)BLOCK DECREMENT d) UNIT DECREMENT

9 16 Scrollbarl )crcates a scroll bar by default |COal


a) veriical b) horizontal c) depends onOS d) depends on JDK

017 Which is themethod is used to count the number of items in the list?
a) getltems() b) getCount() c) getlndex() d) getltemCount()

).18 Which are true about the Container class? i) The validate() method is uscd to causc a Containcr to be laid
ot znd redisplayed. i) The add( ) method is used to add aComponcnt to aContainer.
ii1) The getBorder( ) method returns information about a Container's insets.
ív) The getComponent()method is used to access a Component that is containcd in a Containcr.
a) iand ií b) i, ii and iíi c) i, iiand iv d) i, ii, iii and iv

).19 Chose the output for the given program : ((0 al


sITmpurt java.awt.*:
impur jzva.apple. *;
*2pplet code= "BorderLayoutDemo width=400 height-200> </applet>*/
public class BorderLayoutDemo extends Applet
public void init()
setLzyoutnew Borderlayout);
add newTiutton ("Thís is across the top"), BorderLayou:.NORTH);
sddfnew Label("The footer mesage míght go here."), BorderLayout. SOUTH);
addlnew Button("Right"), BorderLayout.EAST);
aidlnew Button("eft"), BorderLayout.WEST);
String msg= The reasonable man adapts himself to the world"
adilnew TcssAsalmsg), BorderLayout.CENTER):}
b C) d) Error

)20 Thewntainer has a row of componentsthat should all be displayed at the same size, filling the container's
tayout?

Compongnt 3 Component 4
Compongnt 1 Componer1t 2

b) Gridlayout c) BorderlLayout d) BoxLayout

You might also like