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

Advanced Java MCQ

The document provides a set of multiple choice questions related to the Abstract Windowing Toolkit (AWT) in Java. It covers topics like AWT components, containers, layout managers, event handling and more.

Uploaded by

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

Advanced Java MCQ

The document provides a set of multiple choice questions related to the Abstract Windowing Toolkit (AWT) in Java. It covers topics like AWT components, containers, layout managers, event handling and more.

Uploaded by

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

Edition 2019

Strictly as per new revised syllabus of ‘I’ Scheme w.e.f. academiic year 2018-2019

Maharashtrra State Board of Technical Edu


ucation

Advanced
d Java Program
mming
(Code : 22517)
Semester V - Computer Engineering Program Group(CO/CM/CW)
O

Ravi Majithia

Free MCQ Bo
ooklet for Online Exam
mination

Features

MSBTE
 More than 250 MCQ’s.
 Chapterwise Multiple Cho
oice Questions Given.
 Specially for online Examin
n ation as per ‘I’ Schemes

10 0
10 0
Index of MCQ’s

Unit - I

Chapter 1 : Abstract Windowing Toolkit (AWT) ...................................................................................... M1-1 to M1- 5

Unit - II

Chapter 2 : Swings ..................................................................................................................................... M2-1 to M2-2

Unit - III

Chapter 3 : Event Handling........................................................................................................................ M3-1 to M3-3

Unit - IV

Chapter 4 : Networking Basics .................................................................................................................. M4-1 to M4-3

Unit - V

Chapter 5 : Interacting with Database ....................................................................................................... M5-1 to M5-3


Unit - VI

Chapter 6 : Servlets ................................................................................................................................... M6-1 to M6-3




10 0
10 0
1 Abstract Windowing Toolkit (AWT)

Unit I

Multiple Choice Questions for Online Exam

Q. 1 GivetheabbreviationofAWT? Q. 8 HowmanytypesofcontrolsdoesAWTsupports
(a) AppletWindowingToolkit thesecontrolsaresubclassesofcomponent?
(b) AbstractWindowingToolkit (a) 7 (b) 6
(c) AbsoluteWindowingToolkit (c) 5 (d) 8
(d) Noneoftheabove Q. 9 Whicharepassivecontrolsthatdonotsupportany
Q. 2 Whichisthecontainerthatcontaintitlebarand interactionwiththeuser?
canhaveMenuBars.Itcanhaveothercomponents (a) Choice (b) List
likebutton,textfieldetc.? (c) Labels (d) Checkbox
(a) Panel (b) Frame
Q. 10 BywhichmethodYoucansetorchangethetextin
(c) Window (d) Container aLabel?
Q. 3 WhichisacomponentinAWTthatcancontain (a) setText() (b) getText()
anothercomponentslikebuttons,textfields,labels (c) BothA&B (d) Noneoftheabove
etc.? 
Q. 11 Whichclassisusedtocreateapop‐uplistofitems
(a) Window (b) Container fromwhichtheusermaychoose?
(c) Panel (d) Frame (a) List (b) Choice
Q. 4 AWTisusedforGUIprogramminginjava? (c) Labels (d) Checkbox
(a) True Q. 12 Whichobjectcanbeconstructedtoshowany
(b) False numberofchoicesinthevisiblewindow?
Q. 5 Whichclassprovidesmanymethodsforgraphics (a) Labels (b) Choice
programming? (c) List (d) Checkbox
(a) java.awt Q. 13 Whichisusedtostoredataandpartialresults,as
(b) java.Graphics wellastoperformdynamiclinking,returnvalues
(c) java.awt.Graphics formethods,anddispatchexceptions?
(d) Noneoftheabove (a) Window (b) Panel
Q. 6 ThesetwowaysareusedtocreateaFrame (c) Frame (d) Container
BycreatingtheobjectofFrameclass(association) Q. 14 Thefollowingwayisusedtocreateaframeisby
ByextendingFrameclass(inheritance) creatingtheobjectofFrameclass?
(a) True (a) inheritance
(b) False (b) association
Q. 7 Whichisthecontainerthatdoesn'tcontaintitle (c) BothA&B
barandMenuBars.Itcanhaveothercomponents (d) Noneoftheabove
likebutton,textfieldetc? 
Q. 15 AWTmorepowerfulcomponentsliketables,lists,
(a) Window scrollpanes,colorchooser,tabbedpaneetc.?
(b) Frame (a) True (b) False
(c) Panel
(d) Container

10 0
Advanced Java Programming (MSBTE) M1-2 MCQ - Abstract Windowing Toolkit (AWT)

Q.16 Thesefourmethodscommonlyusedin?  Q.22 WhatisAPI?


(i) publicvoidadd(Componentc) (a) ApplicationProgrammingInterchange
(ii) publicvoidsetSize(intwidth,intheight) (b) ApplicationProgrammingInteraction
(iii) publicvoidsetLayout(LayoutManagerm) (c) ApplicationProgrammingInterface
(iv) publicvoidsetVisible(boolean) (d) Noneofthese
(a) Graphicsclass Q.23 WhatisdefaultlayoutforDialog?
(b) Componentclass (a) FlowLayout (b) GridLayout
(c) BothA&B (c) CardLayout (d) BorderLayout
(d) Noneoftheabove Q.24 Whichmethodisusedtocountthenumberof
itemsistheList.
Q.17 InGraphicsclasswhichmethodisusedtodrawsa
rectanglewiththespecifiedwidthandheight? (a) getItem() (b) getSelectedItem()
(a) publicvoiddrawRect(intx,inty,intwidth,int (c) getItemCount() (d) getCount()
height) Q.25 ThecorrecthierarchyforPanelis__________
(b) publicabstractvoidfillRect(intx,inty,int (a) Component–Container–Window–Panel
width,intheight) (b) Component–Container–Applet–Panel
(c) publicabstractvoiddrawLine(intx1,inty1,int (c) Component–Container–Panel
x2,inty2) (d) Container–Component–Panel
(d) publicabstractvoiddrawOval(intx,inty,int
Q.26 WhichisthecorrectconstructorofGridLayout.
width,intheight)
(a) GridLayout(inta)
Q.18 ImplementtheListenerinterfaceandoverridesits (b) GridLayout(intnum_rows,intnum_columns)
methodsisrequiredtoperformineventhandling? (c) GridLayout(introws,intcols,intvert)
(a) True (b) False (d) GridLayout(inthor)
Q.19 PublicclassMenuBarextends____________. Q.27 WhatarethetypesofDialogBox?
(a) MenuComponent (a) ModalDialogBox
(b) MenuContainer (b) ModalandModelessDialogBox
(c) ComponentMenu (c) Modam
(d) MenuBar (d) Noneoftheabove

Q.20 WhichofthefollowingistrueaboutAWTand Q.28 Inthegiveconstructorwhatthirdparameter


Swingcomponents. indicates:ScrollBars=new
ScrollBar(0,10,20,0,1000);
(a) AWTcomponentscreatesaprocesswhereas
swingcomponentscreatesathread (a) sizeofthumb
(b) AWTcomponentscreatesathreadwhereas (b) minimumvalue
swingcomponentscreatesaprocess (c) Incrementvalue
(c) BothAWTandSwingcomponentscreatesa (d) InitialValue
process Q.29 Whichclassisusedtorepresentasingleline
(d) BothAWTandswingcomponentscreatesa textboxwithpasswordcharacterfacility?
thread (a) TextField (b) TextArea
(c) Label (d) Checkbox
Q.21 Panelisdefinedas______________.
(a) ThePanelclassisaconcretesubclassof Q.30 TosetthetitletotheFramewindow________
Container. methodisused.
(b) APanelisawindowthatdoesnotcontain (a) voidsetTitle(Stringstr)
titlebar,menubarandborder. (b) voidsetText(Stringstr)
(c) PanelisasuperclassofApplet. (c) voidsettitle(Stringstr)
(d) Alloftheabove. (d) Noneoftheabove

10 0
Advanced Java Programming (MSBTE) M1-3 MCQ - Abstract Windowing Toolkit (AWT)

Q.31 SupposeaPanelisaddedtoaFrameandaButton Q.39 Whichmethodisusedtosetpasswordcharacter


isaddedtothePanel.IftheFrame’sfontissetto foraTextField?
12pointTimesNewRoman,thepanel’sfontisset (a) setPasswordCharacter()
10pointsTimesNewRomanandtheButton’sfont (b) setEchoChar()
isnotset.Whatfontwillbeusedtodisplaythe
(c) setPassChar()
Button’slabel?
(d) setEchoCharacter()
(a) 12pointTimesNewRoman
(b) 11pointTimesNewRoman Q.40 ThegetContentPane()methodisofwhichclass?
(c) 10pointTimesNewRoman (a) JApplet
(d) 9pointTimesNewRoman (b) JFrame
(c) JButton
Q.32 WhichofthefollowingistrueaboutFlowLayout?
(d) Noneofthese
(a) FlowLayoutcanusemultiplerowsifthe
horizontalspaceinthecontaineristoosmall Q.41 WhichclassdefinessetSize()method?
toholdthecomponent. (a) Frame
(b) FlowLayoutisthedefaultlayoutmanagerof (b) Applet
panelandapplet. (c) Component
(c) Itisthedefaultlayoutmanagerforwindow. (d) Panel
(d) BothA&B.
Q.42 __________isaswingclassthatallowstoentera
Q.33 Whichofthemethodcanbeusedtooutputa singlelineoftext.
StringinanApplet? (a) TextField
(a) display() (b) print() (b) JTextField
(c) drawString() (d) transient() (c) EditTextField
Q.34 ___________positionsarethecomponentsinto5 (d) TextArea
regionseast,west,south,north,center.
Q.43 WhichTextComponentmethodisusedtoseta
(a) CardLayout (b) BorderLayout TextComponenttotheread‐onlystate?
(c) GridLayout (d) FlowLayout (a) Editable
Q.35 WhatisAPI? (b) NonEditable
(a) ApplicationProgrammingInterchange (c) setEchoChar
(b) ApplicationProgrammingInteraction (d) setEditable
(c) ApplicationProgrammingInterface
Q.44 Howwouldyousetthecolorofgraphicscontext
(d) Noneofthese calledgtocyan?
Q.36 Panelisdefinedas_______. (a) g.setColor(“cyan”);
(a) Panelclassisaconcretesub‐classofcontainer (b) g.setCurrentColor(cyan);
(b) APanelisawindowthatdoesnotcontaina (c) g.setColor(“Color.cyan”);
titlebar,menubarorborder (d) g.setColor(Color.cyan);
(c) PanelisthesuperclassofApplet Q.45 Whatisuseofsecondparameteringiven
(d) Allofabove constructorLable(String,int)
Q.37 WhichcomponentofAWTprovidescompact, (a) specifiesheightoflabel
multichoice,scrollingcomponent? (b) specifieswidthoflabelintermsofpixel
(a) List (b) Choice (c) specifiesthealignmentoftextinlabelin
(c) Panel (d) TextArea termsofpixel
(d) specifieswidthoflabel
Q.38 WhenthereisaswitchingconditionlikeONor
OFF,whichcontrolisusedoffollowing? Q.46 ThesetBackground()methodispartofwhichof
(a) Button (b) RadioButton thefollowingclassjava.awtpackage?
(c) ToggleButton (d) TextField (a) Component (b) Applet
(c) Object (d) Graphics

10 0
Advanced Java Programming (MSBTE) M1-4 MCQ - Abstract Windowing Toolkit (AWT)

Q.47 Whatdoesthefollowinglineofcodedo?  Q.56 Whichofthefollowingpackageisusedfor


TextFieldtf=newTextField(10); GraphicalUserInterface?
(a) willset10toTextFieldasitsinitialtext. (a) java.applet (b) java.awt
(b) Willsetthecharactercapacityto10 (c) java.awt.image (d) java.io
(c) BothA&B
Q.57 WhatarethevariablesdefinedinDimension?
(d) NoneofThese (a) lengthandwidth
Q.48 Frameisastandardwindow,whichis__________ (b) heightandlength
ofWindowclassfromAWThierarchy? (c) heightandwidth
(a) Derivedclass/Subclass (d) Noneofthese
(b) Baseclass/Superclass
Q.58 WhichAWTcomponentisnoteditable?
(c) Rootclass
(a) Button (b) TextField
(d) Familyclass
(c) FlowLayout (d) Label
Q.49 A____________isapassiveAWTcontrolthatdo
Q.59 CurrenttextofLabelcanbeobtainedusing
notgenerateanyevent?
__________.
(a) Button (b) RadioButton
(a) setAlignment()
(c) Choice (d) Label
(b) getAlignment()
Q.50 ThedefaultlayoutmanagerofFrameis________. (c) getText()
(a) FlowLayout (b) BorderLayout (d) setText()
(c) GridLayout (d) CardLayout
Q.60 Themethod___________placesaMenuminto
Q.51 Whichmethodisusedtocheckthestatusof theMenuBarmb.
checkbox? (a) mb.addMenuItem(m)
(a) getStatus() (b) getState() (b) mb.addItem(m)
(c) isChecked() (d) getChecked() (c) mb.add(m)
Q.52 Whichofthefollowingmethodisusedtoseta (d) Noneofthese
TextComponenttoread‐onlymode? Q.61 WhichoftheseComponentscannotbeaddedto
(a) Editable() (b) nonEditable() Frame?
(c) setEchoChar() (d) setEditable() (a) Label
Q.53 _________generatesactioneventswhenanitem (b) Button
isdouble‐clicked. (c) CheckboxGroup
(a) List (b) Checkbox (d) Allofabove
(c) MenuItem (d) TextField Q.62 WhatisuseofsecondparametergiveninLabel
Q.54 Whichofthefollowingdoesnothaveitsdefault constructor:Label(String,int)
layoutasBorderLayout. (a) Specifiesheightoflabelintermsofpixels.
(a) Frame (b) specifieswidthoflabelintermsofpixels.
(b) Dialog (c) specifiesthealignmentoftextinlabelin
(c) JApplet termsofpixels.
(d) AllofAbove (d) Specifiesmaximumnumbersofcharactersin
label.
Q.55 WhichofthefollowingstatementaboutGUI
componentiswrong? Q.63 Whichoftheseclassescanbeaddedtoany
(a) swingexistssincetheversion1.2oftheJDK Containerclass,usingtheaddmethoddefinedin
Containerclass?
(b) AWTstandsforAbstractWindowToolkit
(a) Button
(c) YoucannotplaceAWTcomponentonswing
container. (b) CheckboxMenuItem
(c) Menu
(d) TheAWTclassesaredeprecated.
(d) MenuBar

10 0
Advanced Java Programming (MSBTE) M1-5 MCQ - Abstract Windowing Toolkit (AWT)

Q.64 WhatistheuseofsetEchoChar()method? (a) OnlyAstatementistrue.


(a) tosetechoinsymbolform (b) OnlyBstatementistrue.
(b) tosetcharinsymbolform (c) OnlyCstatementistrue.
(c) BothA&B (d) AllA,BandCaretrue.
(d) tocreatepasswordinsymbolform
Q.67 ThedefaultlayoutofAppletis_______.
Q.65 __________methodreturnscurrentlyselected (a) GridLayout
iteminchoice. (b) CardLayout
(a) getSelectedItem() (c) FlowLayout
(b) getSelectedElement() (d) BorderLayout
(c) getSelectedIndex()
Q.68 JavaAppletsareusedtocreate________
(d) getItem() applications.
Q.66 Whichstatementwithrespecttoinnerclassis (a) Graphical
true. (b) userinteractive
A. Itisawayoflogicallygroupingclassesthatare (c) BothA&B
onlyusedinoneplace. (d) Noneofthese
B. Itincreasesencapsulation.
C. Itcanleadtomorereadableandmaintainable
code.


Answers

Q.1 (b) Q.2 (b) Q.3 (b) Q.4 (a) Q.5 (c) Q.6 (a) Q.7 (c) Q.8 (a)

Q.9 (c) Q.10 (a) Q.11 (b) Q.12 (c) Q.13 (c) Q.14 (b) Q.15 (a) Q.16 (b)

Q.17 (b) Q.18 (a) Q.19 (a) Q.20 (c) Q.21 (d) Q.22 (c) Q.23 (a) Q.24 (c)

Q.25 (c) Q.26 (b) Q.27 (b) Q.28 (a) Q.29 (a) Q.30 (a) Q.31 (c) Q.32 (d)

Q.33 (c) Q.34 (b) Q.35 (c) Q.36 (d) Q.37 (a) Q.38 (c) Q.39 (b) Q.40 (d)

Q.41 (c) Q.42 (b) Q.43 (d) Q.44 (d) Q.45 (c) Q.46 (a) Q.47 (b) Q.48 (a)

Q.49 (d) Q.50 (c) Q.51 (b) Q.52 (d) Q.53 (c) Q.54 (d) Q.55 (c) Q.56 (b)

Q.57 (c) Q.58 (b) Q.59 (c) Q.60 (c) Q.61 (c) Q.62 (c) Q.63 (a) Q.64 (c)

Q.65 (a) Q.66 (d) Q.67 (c) Q.68 (c)    


10 0
2 Swings

Unit II

Multiple Choice Questions for Online Exam


Q.8 Whichpackageisusedforimporingswing
Q.1 Thefollowingspecifiestheadvantagesof components?
Itislightweight. (a) java.swing (b) javax.swing
Itsupportspluggablelookandfeel. (c) java.awt. (d) Alloftheabove
ItfollowsMVC(ModelViewController)
architecture. Q.9 Inswing,Buttonsaresubclassesofwhichclass?
(a) Swing (b) AWT (a) AbstractButton (b) JButton
(c) BothA&B (d) Noneoftheabove (c) Button (d) JRadioButton

Q.2 SwingisnotapartofJFC(JavaFoundationClasses) Q.10 JTreeclassbelongstowhichpackage?


thatisusedtocreateGUIapplication?  (a) java.awt (b) java.applet
(a) True (b) False (c) java.swing (d) javax.swing

Q.3 TheSwingComponentclassesthatareusedin Q.11 Whichcomponentisswingrepresentsdatainrow


Encapsulatesamutuallyexclusivesetofbuttons? andcolumns?
(a) AbstractButton (b) ButtonGroup (a) JTextArea (b) JTable
(c) JButton (d) ImageIcon (c) JPanel (d) JtabbedPane

Q.4 TheJavaFoundationClasses(JF(c)isasetofGUI Q.12 WhichofthefollowingisnotconstructorofJTree?


componentswhichsimplifythedevelopmentof (a) JTree(TreeNodetn)
desktopapplications? (b) JTree(Vectorv)
(a) True (b) False (c) JTree(intx)
Q.5 Whichpackageisusedforimporttheswing (d) noneoftheabove
components?
Q.13 ____________classusedtocreatenodeintree.
(a) java.swing (b) java.awt (a) TreeNode
(c) javax.swing (d) Alloftheabove (b) DefaultMutableNode
Q.6 TheStringparametertoJButtonconstructor (c) DefaultMutableTreeNode
______________. (d) Node
(a) tellwhichregiontoputtheJButtonin.
Q.14 JTabbedPaneclassispresentinwhichpackage?
(b) tellsthecoloroftheJButton.
(a) java.awt (b) java.swing
(c) tellswhattextwillappearonJButton.
(c) java.awt.swing (d) javax.swing
(d) tellswhatshouldhappenwhenJButtonis
pressed. Q.15 WhatispurposeofJTree?
(a) Toshowdatainformofparentandchild
Q.7 MVCarchitectureis_________
nodes.
(a) Modelling–Visual–Controller
(b) Toshowdatainlistview.
(b) Model–View–Controller
(c) Toshowdataintabularform.
(c) Model–Viewable–Controller
(d) Toshowdatainmenu‐bar.
(d) Many–View–Controller

10 0
Advanced Java Programming (MSBTE) M2-2 MCQ - Swings

Q.16 Whatistheuseof:ContainergetContentPane() Q.19 FromfollowinglistwhichisnotSwingclass?


(a) ReturnsContainerforaJDialog. (a) JLabel 
(b) ReturnsaContentPaneforMenu (b) JButton
(c) ReturnsaContentPaneforApplet (c) JImageIcon 
(d) Noneoftheabove (d) JCheckBox
Q.17 Whichofthefollowingmethodisnotapplicable Q.20 Whichcomponentprovidessupportfortwo‐state
forButtoninswing. buttons?
(a) setDiableIcon() (b) setPressedIcon() (a) Button,Checkbox
(c) setSelectedIcon() (d) setRollOverIcon() (b) JCheckBox,JRadioButton
(c) Button,MenuItem
Q.18 Whichofthefollowingmethodisusedtoretrieve
iconofJButton? (d) JCheckBox,TextField
(a) IcongetIcon() 
(b) ImageIcongetImageIcon() 
(c) ImageIcongetIcon() 
(d) ImageIconGetImageIcon()



Answers

Q.1 (a) Q.2 (b) Q.3 (b) Q.4 (a) Q.5 (c) Q.6 (c) Q.7 (b) Q.8 (b)

Q.9 (a) Q.10 (d) Q.11 (b) Q.12 (c) Q.13 (c) Q.14 (d) Q.15 (a) Q.16 (c)

Q.17 (c) Q.18 (c) Q.19 (c) Q.20 (b)    

10 0
3 Event Handling

Unit III

Multiple Choice Questions for Online Exam

Q.1 TheFollowingstepsarerequiredtoperform Q.8 InGraphicsclassWhichmethodisusedtosetthe


ImplementtheListenerinterfaceandoverridesits graphicscurrentcolortothespecifiedcolor?
methods (a) publicabstractvoidsetFont(Fontfont)
RegisterthecomponentwiththeListener (b) publicabstractvoidsetColor(Colorc)
(a) ExceptionHandling(b) StringHandling (c) publicabstractvoiddrawString(Stringstr,int
(c) EventHandling (d) Noneoftheabove x,inty)
Q.2 Inwhichplacescanputtheeventhandlingcode  (d) Noneoftheabove
(a) Sameclass (b) Otherclass Q.9 Whichofthefollowingmethodisusedto
(c) Annonymousclass (d) Allmentionedabove determinethetypeofadjustmentevent?
(a) getType()
Q.3 Whichpackageprovidesmanyeventclassesand
Listenerinterfacesforeventhandling?  (b) getEventType()
(a) java.awt (b) java.awt.Graphics (c) getAdjustmentType()
(c) java.awt.event (d) Noneoftheabove (d) getEventObjectType()

Q.4 TousetheActionListenerinterfaceitmustbe Q.10 TextFieldgenerates____________event.


implementedbyaclassthereareseveralwaysto (a) ActionEvent,ItemEvent
dothatfindinthefollowing?  (b) ActionEvent,TextEvent
(a) Creatinganewclass (c) ScrollEvent,TextEvent
(b) usingtheclassthegraphicalcomponent (d) ActionEvent,ScrollEvent
(c) ananonymousinnerclass
Q.11 voidkeyTyped(KeyEventke)calledwhenakeyon
(d) Allmentionedabove thekeyboardis____________.
Q.5 TheActionListenerinterfaceisnotusedfor (a) pressedandthenreleased.
handlingactionevents?  (b) pressed
(a) True  (c) released
(b) False (d) noneoftheabove
Q.6 TheActionListenerinterfaceisusedforhandling Q.12 Whicheventisgeneratedwhenthepositionof
actionevents,Forexample,it'susedbya scrollbarischanged?
(a) JButton  (a) KeyEvent (b) MouseEvent
(b) JCheckbox (c) ItemEvent (d) AdjustmentEvent
(c) Allofthese 
Q.13 Thesignaturefortheregistrationmethodfora
(d) JMenuItem ActionEventshouldbe_______.
Q.7 WhichclassisusedforthisProcessingMethod (a) publicvoidaddActionListener(ActionEventL)
processActionEvent()?  (b) publicvoidsetAction(ActionListenerL)
(a) Button,List,MenuItem (c) publicvoidsetActionListener(ActionListenerL)
(b) Button,Checkbox,Choice (d) publicvoidaddActionListener(ActionListener
(c) Scrollbar,Component,Button L)
(d) Noneoftheabove

10 0
Advanced Java Programming (MSBTE) M3-2 MCQ - Event Handling

Q.14 Whichofthefollowingcomponentgenerates Q.24 ComponentEventisthesuperclassof________


ActionEvent? (a) ActionEvent (b) ItemEvent
(a) Window (b) RadioButton (c) TextEvent (d) Allofabove
(c) ScrollBar (d) None
Q.25 WhenweneedtouseCheckboxorItemfromthe
Q.15 ___________methodisusedtoregistera listoruseacheckableMenuan__________is
keyboardeventlistener. generated.
(a) KeyListener() (a) ActionEvent (b) ItemEvent
(b) addKeyListener() (c) MenuEvent (d) ClickEvent
(c) addKeyListenerEvent()
Q.26 Whichofthefollowingconstantisnotdefinedin
(d) eventKeyboardListener() WindowEventclass?
Q.16 NamethemethoddefinedinEventObjectclass (a) WINDOW_ACTIVATED
thatreturnstheobjectgeneratedfromtheevent. (b) WINDOW_CLOSED
(a) getEvent() (b) getObject() (c) WINDOW_DEICONIFIED
(c) getId() (d) getSource() (d) Noneofthese
Q.17 TheMouseListenerinterfaceisusedtomake Q.27 Whichofthefollowingisnotthemethodof
mousehandling. handlingwindowevent?
(a) True  (a) voidwindowClosed(WindowEventwe)
(b) False (b) voidwindowClosing(WindowEventwe)
(c) voidwindowAfterClosing(WindowEventwe)
Q.18 ActionEventisappliedon________
(a) Frame (d) Allofthese
(b) Checkbox,Choice,List Q.28 Whichmethodisusedtoprocessmouseclick?
(c) Scrollbar (a) publicvoidmouseClicked(MouseListenerm)
(d) Button,TextField,List,Menu (b) publicvoidmouseIsClicked(MouseEventm)
(c) publicvoidmouseClicked(MouseEventm)
Q.19 ComponentEventisthesuperclassof__________.
(a) FocusEvent (b) MouseEvent (d) publicvoidmouseClick(MouseEventm)
(c) WindowEvent (d) Alloftheabove Q.29 Whichclassisusedforthisprocessingmethod
processActionEvent()method?
Q.20 Ifwecloseanappletwindow_________events
willbegenerated. (a) Button,List,MenuItem
(a) ActionEvent (b) ComponentEvent (b) Button,Checkbox,Choice
(c) AdjustmentEvent (d) WindowEvent (c) ScrollBar,Component,Button
(d) Noneoftheabove.
Q.21 Whichofthefollowingcomponentgenerate
ActionEvent? Q.30 Whichofthispackagecontainsalltheclassesand
(a) ScrollBar (b) Window methodsrequiredforeventhandlinginJava.
(c) RadioButton (d) Noneofthese (a) java.applet (b) java.awt
(c) java.event (d) java.awt.event
Q.22 WhichListenerhandlesallListrelatedEvents?
Q.31 NamethemethoddefinedinEvenObjectclassthat
(a) ItemListener (b) InputEvent
returnstheobjectgeneratedfromtheevent.
(c) SelectEvent (d) ListEvent
(a) getEvent() (b) getObject()
Q.23 Howtoobtainthecommandnameforinvoking (c) getId() (d) getSource()
ActionEvent?
Q.32 Whichoftheseinterfacesdefineamethod
(a) getCommandName()
actionPerformed()
(b) getActionEventCommand()
(a) ComponentListener
(c) getActionCmd()
(b) ContainerListener
(d) getActionCommand()
(c) ActionListener

(d) InputListener

10 0
Advanced Java Programming (MSBTE) M3-3 MCQ - Event Handling

Q.33 ButtonControlimplementsfollowinglistener Q.37 MouseEventissubclassofwhichofthefollowing


interface. class?
(a) ItemListener (b) ActionListener (a) ComponentEvent
(c) FlowListener (d) Adapter (b) ContainerEvent
(c) ItemEvent
Q.34 Clickingtheclosingbuttonontheupperright
cornerofaframegeneratesa(n)‐event. (d) InputEvent
(a) ItemEvent (b) WindowEvent Q.38 The_________isanobjectthatisnotifiedwhen
(c) MouseMotionEvent( d) ComponentEvent aneventoccurs.
(a) Listener
Q.35 Whichofthefollowingmethodmustbe
overriddenintheordertohandleKeyEvent. (b) Sources
(a) keyPressed(KeyEventobj) (c) Event
(b) KeyReleased(KeyEventobj) (d) Noneoftheabove
(c) KeyTyped(KeyEventobj) Q.39 WhatistheuseofStringgetActionCommand()
(d) Allofthese methodofActionEventclass?
(a) toobtainthelabel(caption)ofButton
Q.36 Whichofthesemethodscanbeusedtoknowthe
degreeofadjustmentmadebytheuser? (b) toobtainthereferenceofButton
(a) getValue() (c) toobtainobjectofButton
(b) getAdjustmentType() (d) toobtainthelabel(caption)andobjectof
(c) getAdjustmentValue() Button

(d) getAdjustmentAmount()

Answers

Q.1 (c) Q.2 (d) Q.3 (c) Q.4 (d) Q.5 (b) Q.6 (c) Q.7 (a) Q.8 (b)

Q.9 (c) Q.10 (b) Q.11 (a) Q.12 (d) Q.13 (d) Q.14 (d) Q.15 (b) Q.16 (d)

Q.17 (a) Q.18 (d) Q.19 (d) Q.20 (d) Q.21 (d) Q.22 (a) Q.23 (d) Q.24 (d)

Q.25 (b) Q.26 (d) Q.27 (c) Q.28 (c) Q.29 (a) Q.30 (d) Q.31 (d) Q.32 (c)

Q.33 (b) Q.34 (b) Q.35 (d) Q.36 (c) Q.37 (d) Q.38 (a) Q.39 (a) 


10 0
4 Networking Basics

Unit IV

Multiple Choice Questions for Online Exam

Q.1 UDPstandsfor___________ Q.7 IPv6uses________.


(a) UserDataPort (a) 4groupsof8bitseach
(b) UserDatagramProtocol (b) 4groupof8hexa‐decimaldigits
(c) UsedDataProvider (c) 8groupsof4digitseach
(d) UserDataProtocol (d) 8groupsof4hexa‐decimaldigitseach
Q.2 Nametheclasswhichisusedtocreateaport Q.8 SelectfullformofDNS.
wheretheserverwilllisten. (a) DataNetworkSystem
(a) Server (b) Socket (b) DomainNameSystem
(c) ServerSocket (d) SocketServer (c) DomainNameServer
Q.3 CommunicationusingTCPprotocolis______and (d) DomainNamingService
________. Q.9 WhatistheuseofWriteUTF()method?
(a) Connectionless,Iterative (a) Thismethodwritesastringintounderlying
(b) Collectionless,concurrent outputstream.
(c) Connectionoriented,Iterative (b) Thismethodreadsastingfromunderlying
(d) Connectionoriented,concurrent inputstream.
(c) Thismethodwritesabytearrayinto
Q.4 Whichoftheseisanotafactorymethodof
InetAddressclass? underlyingoutputstream.
(a) staticInetAddressgetLocalHost() (d) Thismethodwritesacharacterarrayinto
underlyingoutputstream.
(b) staticInetAddressgetByName(String
hostname) Q.10 Whichoftheseisabundleofinformationpassed
(c) staticInetAddressgetAllName(String betweenmachines?
hostname) (a) MIME (b) Cache
(d) staticInetAddress[]getAllByName(String (c) Datagram (d) Socket
hostname)
Q.11 PortnumberforFTPis_______
Q.5 Whichfromthebelowuse“Middletier”. (a) 21 (b) 23
(a) 3tier (c) 25 (d) 80
(b) 4tier
Q.12 Theclasswhichencapsulatesboththenumerical
(c) n–tier IPaddressandthedomainnameforthataddress
(d) alloftheabove is_____.
Q.6 java.netpackageconsistsofinterface__________ (a) DatagramPacket
(a) ContentHandlerFactory (b) DatagramSocket
(b) SocketImplFactory (c) InetAddress
(c) FileNameMapandURLStreamHandlerFactory (d) ServerSocket
(d) Alloftheabove 

10 0
Advanced Java Programming (MSBTE) M4-2 MCQ - Networking Basics

Q.13 intgetServerPort()method____________ Q.21 WhichmethodofServerSocketwillwaitfora


(a) returnstheportnumberonwhichthisrequest clienttoinitiatecommunicationandthen
wasreceived. communicationwiththeclient?
(b) returnstheportnameonwhichtherequest (a) wait() (b) connect()
wasreceived. (c) waitForClient() (d) WaitForConnect()
(c) returnstheservernumberonwhichthis
Q.22 _________methodisusedtoretrievefilename
requestwasreceived. specifiedinURL.
(d) returnstheportnumberonwhichthis (a) getFile() (b) getUrl()
response/requestwasreceived.
(c) getFileUrl() (d) getLocalFile()
Q.14 InthisconstructorServerSocket(intport,int
max_queue)whatisthedefaultvaluefor Q.23 ________isnecessarytoimplementDatagram.
max_queue? (a) DatagramPacket (b) DatagramSocket
(a) 100 (b) 50 (c) BothA&B (d) NoneofA&B
(c) 75 (d) 80 Q.24 WhichisthecorrectsyntaxforgetLocalHost()
method?
Q.15 TheconstructorofURLcanthrowanexception
called______ (a) publicstaticInetAddressgetLocalHost()
(a) MalformedUrlException throwsUnknownHostException
(b) UrlNotFoundException (b) publicstaticIpAddressgetLocalHost()throws
UnknownHostException
(c) UrlException
(c) publicstaticStringgetLocalHost()throws
(d) UrlSourceNotFoundException UnknownHostException
Q.16 WhichIPaddressismulticastIPaddress? (d) publicstaticvoidgetLocalHost()throws
(a) 192.168.2.32  UnknownHostException
(b) 235.55.45.2 Q.25 WhichofthesemethodofDatagramPacketclassis
(c) 12.22.1.2  usedtofindthedestinationaddress?
(d) Noneofthese (a) findAddress() (b) getAddress()
Q.17 Which5parametersuniquelyidentifya (c) address() (d) whoIs()
connection? Q.26 Connectionorientedcommunicationispossible
(a) LocalIP,RemoteIP,LocalMAC,RemoteMAC using____________classesofJava.
andProtocol (a) SocketandServerSocket
(b) LocalIP,LocalPORT,RemoteMAC,Remote (b) DatagramSocketandDatagramPacket
PORTandProtocol (c) Bothofthese
(c) LocalMAC,LocalPORT,RemoteMAC,Remote (d) Noneofthese
PORTandProtocol
(d) LocalIP,LocalPORT,RemoteIP,RemotePORT Q.27 Aserversocketcanconnectto________clients.
andProtocol (a) 1 (b) 2
(c) 10 (d) multiple
Q.18 SelectthemethodusedtocreateURLconnection.
(a) URLConnection (b) openConnection Q.28 ResolverinDNSsystemmaps__________.
(c) URL (d) URLDecoder (a) DomainnametoIPaddress
(b) IPaddresstodomainname
Q.19 WhatvalueisreturnedbythereadLine()method
whenitreachatEndofFile? (c) DomainnametoMACaddress
(a) EOF (b) null (d) MACaddresstoIPaddress
(c) 0 (d) END Q.29 Ifaprogramconsistsofthreeclasses,thenafter
compilationhowmanyclassfileswillbecreatedby
Q.20 The_________classisusedtocreateTCPserver.
thecompiler?
(a) Server (b) SocketServer
(a) one (b) three
(c) ServerSocket (d) Socket
(c) uncountable (d) zero

10 0
Advanced Java Programming (MSBTE) M4-3 MCQ - Networking Basics

Q.30 WhichofthefollowingisnotamethodofSecurity Q.36 Whichmethodsarecommonlyusedin


class? ServerSocketclass?
(a) socketPermission()(b) filePermission() (a) publicOutputStreamgetOutputStream()
(c) dataPermission() (d) Noneofabove (b) publicSocketaccept()
(c) publicsynchronizedvoidclose()
Q.31 TCPdoesnotsupportsMulticastingand
Broadcastingbecause______________. (d) Noneoftheabove
(a) Itsupportsfullduplexcommunication. Q.37 Whichisthepropermethodtoretrievethehost
(b) Itprovideserrorcontrol. nameoflocalmachine?
(c) Itprovidesflowcontrol (a) staticInetAddressgetLocalHost()throws
(d) Itisconnectionorientedprotocol UnknownHostException
Q.32 WhichofthefollowingistrueaboutTCPprotocol? (b) staticInetAddressgetByName(String
host_name)throwsUnknownHostException
(a) isreliableandconnectionoriented
(b) isunreliablebutconnectionoriented (c) staticInetAddressgetAllByName(String
host_name)throwsUnknownHostException
(c) isreliableandconnectionless
(d) Noneofthese (d) StringgetHostAddress()

Q.33 Whichclassdefinesfollowingmethods?  Q.38 WhichconstructorofDatagramPacketclassare


intgetContentLength()  usedforreceivingpurpose?
longgetDate()  (a) DatagramPacket(bytedata[],intsize)
longgetExpiration() DatagramPacket(bytedata[],intsize,int
(a) URLConnection (b) Datagram offset,intport)
(c) Client (d) Noneofthese (b) DatagramPacket(bytedata[],intsize,
InetAddressip,intport)
Q.34 Nametheclasswhichisusedtocreateaport
DatagramPacket(bytedata[],intoffset,int
wheretheserverwilllisten?
size,InetAddressip,intport)
(a) Server (b) Socket
(c) DatagramPacket(bytedata[],intsize)
(c) ServerSocket (d) SocketServer
DatagramPacket(bytedata[],intsize,
Q.35 classPermissioninjava.securitypackageis InetAddressip,intport)
__________. (d) Allofthese
(a) static (b) abstract 
(c) final (d) Noneofthese 

Answers

Q.1 (b) Q.2 (b) Q.3 (d) Q.4 (c) Q.5 (d) Q.6 (d) Q.7 (d) Q.8 (d)

Q.9 (c) Q.10 (c) Q.11 (a) Q.12 (c) Q.13 (d) Q.14 (b) Q.15 (a) Q.16 (d)

Q.17 (b) Q.18 (a) Q.19 (b) Q.20 (c) Q.21 (b) Q.22 (a) Q.23 (d) Q.24 (a)

Q.25 (b) Q.26 (c) Q.27 (d) Q.28 (b) Q.29 (b) Q.30 (d) Q.31 (d) Q.32 (a)

Q.33 (a) Q.34 (b) Q.35 (b) Q.36 (b) Q.37 (a) Q.38 (d)  



10 0
5 Interacting with Database

Unit V

Multiple Choice Questions for Online Exam


Q.7 Native–protocolpureJavaDriverconverts
Q.1 The__________packagecontainsclassesthat _______intothe_________directly.
helpinconnectingtoadatabase,sendingSQL (a) JDBCcalls,networkprotocol
statementstothedatabaseandprocessthequery (b) ODBCclass,networkprotocol
request. (c) ODBCclass,usercalls
(a) connection.sql (b) db.sql (d) JDBCcalls,usercalls
(c) pkg.sql (d) java.sql
Q.8 ChoosethecorrectsyntaxforgetConnection()
Q.2 WhichofthefollowingisnotatypeofJDBC method.
driver? (a) publicstaticConnectiongetConnection(String
(a) 100%pureJavaDriver url,Stringpassword)throwsSQLException
(b) JDBC–netpureJavaDriver (b) publicstaticConnectiongetConnection(String
(c) JDBC–NativeAPIdriver name,Stringpassword)throwsSQLException
(d) JDBC–NativepureJavaDriver (c) publicstaticConnectiongetConnection(String
url,Stringname,Stringpassword)throws
Q.3 InJDBC______________importsallJavaclasses SQLException
thatareconcernwithDatabaseconnectivity.
(d) publicstaticConnectiongetConnection(String
(a) javax.sql (b) java.mysql url,Stringname)throwsSQLException
(c) java.sql (d) com.sql
Q.9 SQLstandsfor__________.
Q.4 DatabaseprogrammingusingJavathrowswhichof (a) StructuredQueryLanguage
thefollowingexception?
(b) SequentialQueryLanguage
(a) SQLException
(c) StructuredQuestionLanguage
(b) ClassNotFoundException
(d) SequentialQuestionLanguage
(c) Noneofthese
(d) Bothofthese Q.10 _____________isatableofdatawhichrepresents
adatafromtable.
Q.5 Inthebelowstatement,whichtypeofquerycan (a) MetaData (b) ResultSetMetaData
beusedwithexecuteUpdate()method.
statement.executeUpdate(queryhere) (c) ResultSet (d) Statement
(a) Insert,Update,Delete Q.11 PublicclassDriverManagerextends____________
(b) Insert,Select,Delete (a) Object (b) String
(c) OnlySelect (c) Connection (d) Statement
(d) AnyQuery
Q.12 Whichofthefollowingmethodissupportedby
Q.6 Whatispurposeofnext()method? Statementinterface?
(a) toretainthenextelementinaseries. (a) publicbooleanexecute(Stringquery)
(b) toretainnexttable. (b) publicResultSetexecuteQuery(Stringquery)
(c) toretainnextrecordinaseries. (c) publicintexecuteUpdate(Stringquery)
(d) Noneoftheabove (d) Allofabove

10 0
Advanced Java Programming (MSBTE) M5-2 MCQ - Interacting with Database

Q.13 Infollowingstatementrsisanobjectof Q.21 IdentifycorrectsyntaxofexecuteQuery()of


__________interfaceofJDBCAPI. Statementinterface.
System.out.println(rs.getString(3)); (a) publicstaticResultSetexecuteQuery()
(a) RowSet (b) Statement (b) publicResultSetexecuteQuery(Stringq)
(c) Connection (d) ResultSet (c) publicvoidexecuteQuery(Stringq)
Q.14 WhichismaincomponentofJDBCAPI? (d) publicintexecuteQuery(Stringq)
(a) DriverManager (b) Driver Q.22 NativeAPIconverts______intothe______used
(c) Connection (d) Allofthese byDBMS.
(a) JDBCAPI,NetworkProtocol
Q.15 Howmanystepsareusedtoconnectanyjava
applicationwiththedatabaseusingJDBC? (b) JDBCAPI,NativeAPIcalls
(a) 5 (b) 4 (c) JDBCAPI,usecalls
(c) 3 (d) 6 (d) JDBCAPI,ODBCAPIcalls

Q.16 ODBCminimumSQLgrammercontains______ Q.23 Whichofthefollowingfunctionisusedtofindthe


(a) Storedprocedure columncountoftheparticularResultSet.
(b) Data,TimeandTimeStamponly (a) getMetadata() (b) metadata()
(c) createordropView (c) getColumnCount() (d) getCount()
(d) Insert,update,deleteonly Q.24 TheJDBC‐ODBCbridgesupportshowmany
concurrentopenstatementsperconnection?
Q.17 Whichclass/interfaceisusedforanSQLstatement
thatisexecutedfrequently? (a) 1
(a) Statement (b) 0
(b) CallableStatement (c) Doesnotsupportconnection
(c) PreparedStatement (d) Noneofthese
(d) Noneoftheabove Q.25 Selectthecorrectmethodtocreate
CallableStatement.
Q.18 Whatdoesthefollowingcodedo:
smt=con.createStatement() (a) CallableStatementprepareCall(Stringsql)
(a) APreparedStatementobjectiscreatedto (b) CallableStatementprepareCall(Stringsql,int
sendSQLcommandstodatabase. resultsettype,intresultset_concurrency)
(b) AStatementobjectiscreatedtosendSQL (c) CallableStatementprepareCall(Stringsql,int
commandstodatabase. resultset_type,intresultset_concurrency,int
resultset_holdability)
(c) ACallableStatementiscreatedtosendSQL
commandstodatabase. (d) Alloftheabove
(d) AStatementobjectiscreatedtoexecute Q.26 MicrosoftAccessdatain_______fileformat.
parameterizedSQLcommands. (a) .DAT (b) .MDB
Q.19 WhichkindofdriverconvertsJDBCcallsintocalls (c) .MSSQL (d) .OBJ
ontheClientAPIforOracle,Sybase,Informix,IBM Q.27 Whichofthefollowingmethodisusedforsend
DB2,orotherDBMS SQLstatements?
(a) JDBCODBCbridge+ODBCDriver (a) Statement (b) CallableStatement
(b) NativeAPIpartly–JavaDriver (c) PreparedStatement(d) BothB&C
(c) JDBC–NetpureJavaDriver
Q.28 DELETEstatementofanSQLisexecutedby
(d) NativeProtocolPureJavaDriver
________.
Q.20 WhichmethodexecutesanSQLstatementthat (a) execute() (b) executeQuery()
mayreturnmultipleresults? (c) executeUpdate() (d) executeDelete()
(a) executeUpdate()
(b) executeQuery() Q.29 Theinterfacetothedatabaseishandleby_____.
(a) ODBC (b) JDBC
(c) execute()
(c) JDBC&ODBC (d) APIs
(d) noExecute()

10 0
Advanced Java Programming (MSBTE) M5-3 MCQ - Interacting with Database

Q.30 DatabaseMetadataareretrievedthrough Q.32 Whichofthefollowingisusedgenerallyfor


___________ readingthecontentofthedatabase?
(a) getDatabaseMetadata() (a) DabaseData
(b) getMetaData() (b) DabaseData
(c) getDBMetaData() (c) ResultSet
(d) getDatabaseMeta() (d) DatabaseResult
Q.31 WhichmethodisusedtoretrievetheResultSet Q.33 Thesyntaxtocreateatablenamed“Course”,
created? shouldbeginwith__________.
(a) executeQuery() (a) createnewtablecourse
(b) getResultSet() (b) createtablecourse
(c) getResultSetResult() (c) tablecoursecreate
(d) getResult() (d) newtablecourse



Answers

Q.1 (d) Q.2 (d) Q.3 (c) Q.4 (d) Q.5 (a) Q.6 (c) Q.7 (d) Q.8 (c)

Q.9 (a) Q.10(c) Q.11(a) Q.12(d) Q.13(d) Q.14(d) Q.15(a) Q.16(d)

Q.17(c) Q.18(b) Q.19(b) Q.20(b) Q.21(b) Q.22(b) Q.23(c) Q.24(a)

Q.25(d) Q.26(b) Q.27(d) Q.28(c) Q.29(b) Q.30(a) Q.31(a) Q.32(c)

Q.33(b)       

10 0
6 Servlets

Unit VI

Multiple Choice Questions for Online Exam

(a) request.addCookie(newCookie(“username”,
Q.1 JSPembeds__________in___________.
“joe));
(a) Servlet,HTML (b) HTML,Java
(b) response.addCookie(newCookie(“username”,
(c) HTML,Servlet (d) Java,HTML
“joe”))
Q.2 WhichofthefollowingisthedefaultHttpRequest (c) request.addCookie(“username”,“joe);
method? (d) request.addCookie(“username”,“joe);
(a) doGet() (b) doPost()
Q.7 WhichJSPtagisusedtotransferforprocessing
(c) doTrace() (d) doPut()
anotherJSPpage?
Q.3 Whicharetrueabouttaglibrariesinweb (a) <jsp:include> (b) <jsp:forward>
application? (c) <jsp:useBean> (d) <jsp:use:include>
(a) packagedinthe/WEB‐INFdirectoryorsub‐
directoryoftheWARfile Q.8 Anapplicationwantstoinvalidatethesessionboth
programmaticallyanddeclaratively.Selectthe
(b) Ifatagisimplementedasatagfileand
bestmatchtodothis.
packagedin/WEB‐INF/tags/orasub‐
directory,aTLDwillbegenerated (a) httpRequest.getSession().end()
automaticallybythewebcontainer,though,  <session‐config><session‐timeout‐interval>
youcanprovideoneifyouwish time_in_minutes</session‐timeout‐interval>
(c) packagedinthe/META‐INF/directoryorsub‐  </session‐config>
directoryofataglibrarypackagedinajar. (b) httpRequest.getSession().invalidate()
(d) Alloftheabove.  <session‐config><session‐timeout>
time_in_minutes</session‐timeout>
Q.4 Namethehttpmethodusedtosendresourcesto </session‐config>
theserver.
(c) httpRequest.getSession().close()
(a) FTPmethod (b) PUTmethod
<session‐config><session‐timeout>
(c) WRITEmethod (d) COPYmethod time_in_minutes</session‐timeout>
Q.5 IdentifythepropersyntaxofdoGet(). </session‐config>
(a) voiddoGet(HttpResponseres,HttpRequest (d) httpRequest.getSession().invalidate()
req)throwsIOException,ServletException  <session‐config><session‐duration>
(b) voiddoGet(HttpRequestreq,HttpResponse time_in_minutes</session‐duration>
res)throwsIOException,ServletException </session‐config>
(c) voiddoGet(HttpResponseres)throws Q.9 Theinclude()methodinRequestDispatcher____.
IOException,ServletException (a) sendsarequesttoanotherresourcelike
(d) voiddoGet(HttpRequestreq)throws servlet,JSPorhtml.
IOException,ServletException
(b) includesresourcesoffilelikeservlet,JSPor
Q.6 GivenanHttpServletRequestrequestand html.
HttpServletResponseresponseinstances.Which (c) appendstherequestandresponseobjectsto
setsacookie“username”withthevalue“joe”ina thecurrentservlet.
servlet? (d) Noneofthese

10 0
Advanced Java Programming (MSBTE) M6-2 MCQ - Servlets

Q.10 Statetrueorfalseforfollowingstatements. Q.19 _________isthefirstPhaseofServletLifecycle.


(i)JavaBeansslow‐downsoftwaredevelopment (a) service() (b) init()
process. (c) destroy() (d) BothB&C
(ii)JavaServletsdonothavebuilt‐inmultithreaded
feature. Q.20 HowmanycopiesofaJSPpagecanbeinmemory
atatime?
(a) false,false (b) false,true
(a) 1 (b) 2
(c) true,false (d) true,true
(c) 3 (d) Unlimited
Q.11 ________isasmallpieceofinformationthatis
Q.21 Whichmethodisusedtospecifybeforeanylines
passedback&forthinHTTPrequest&response.
thatusedthePrintWriter?
(a) Servlet (b) Applet
(a) setPageType()
(c) Cookie (d) Session
(b) setContextType()
Q.12 Whichlifecyclemethodisusedtoprocessa (c) setContentType()
client’srequest? (d) setResponseType()
(a) start() (b) init()
(c) service() (d) destroy() Q.22 _________isusedtoreaddatafromaclient
request.
Q.13 AusertypestheURL (a) ServletResponse (b) ServletRequest
http://www.msbte.com/result.php.Whichrequest (c) Servlet (d) ServletConfig
getsgenerated?
(a) GETmethod (b) POSTmethod Q.23 Thefollowingmethodsbelongstothelifecycle
(c) HEADmethod (d) PUTmethod methodsoftheservlet.
(a) init() (b) service()
Q.14 ApacheTomcatis________. (c) destroy() (d) Alloftheabove
(a) Servlet
Q.24 Javaservlet 
(b) JavaProgram
(c) API (i)isakeycomponentoftheserversidejava
(d) WebservercapableofrunningJavaprograms development.

Q.15 WhatthegetSession()methodwith“true” (ii)isasmallpluggableextensiontoaserverthat


parameterwilldo? enhancesfunctionality
(a) Thesessioniscompleted (iii)runsonlyinwindowsOS 
(b) Thesessionobjectispassedtoanother
method (iv)allowsdeveloperstocustomizeanyjava
enabledserver
(c) Createsnewsessionif,thesessiondoesnot
exist (a) i,iiandiiiaretrue
(d) Thesessionisexist (b) i,iiiandivaretrue
(c) ii,iiiandivaretrue
Q.16 AJSPpageconsistsofwhichtags? (d) i,iiandivaretrue
(a) HTMLtags (b) JSPtags
(c) BothA&B (d) Noneoftheabove Q.25 Servletlifecyclehas_________states.
(a) Two (b) Three
Q.17 Lifecycleofaservletismanagedby______ (c) Four (d) Five
(a) ServletContext (b)ServletContainer
(c) Supportingprotocol(d) Alloftheabove Q.26 JSPlifecycleincludes________numberofphases.
(a) Two (b) Three
Q.18 Tosendbinaryoutputintheresponse,the (c) Four (d) Five
followingmethodofHttpServletresponsemany
beusedtogettheappropriateWriter/Stream Q.27 Howtosenddataingetmethod?
object. (a) usingGETmethodinrequest
(a) getStream() (b) getOutputStream() (b) usingRequestingURL
(c) getBianaryStream()(d) getWriter() (c) usingResponseURL
(d) usingURL

10 0
Advanced Java Programming (MSBTE) M6-3 MCQ - Servlets

Q.28 JSPlifecycleincludesfollowing Q.31 Whichclassprovidesstreamtoreadbinarydata


(a) TranslationPhase suchasimageet(c)fromtherequestobject?
(b) CompilationPhase (a) ServletInputStream(b) ServletOutputStream
(c) Requesthandlingphase (c) Botha&b (d) Noneoftheabove
(d) Allofthese Q.32 WhatisthelimitofdatatobepassedfromHTML
Q.29 JSPstandsfor_______. todoGet()?
(a) JavaServiceProvider (a) 8kb (b) 1kb
(b) JavaServerPath (c) 4kb (d) 2kb
(c) JavaServerPages Q.33 ThemajordifferencebetweenServletandCGIis
(d) JavaServerProgram _______.
(a) ServletsarethreadbasedandCGIisprocess
Q.30 Theauthenticationmechanismintheservlet
based.
specificationusesatechniquecalled?
(b) ServletexecutesslowerthanCGI.
(a) RoleBasedAuthentication
(c) ServlethasnoplatformspecificAPIwhereas
(b) FormBasedAuthentication
CGIhas.
(c) Botha&b
(d) Allofthese
(d) Noneoftheabove



Answers

Q.1 (d) Q.2 (a) Q.3 (d) Q.4 (b) Q.5 (b) Q.6 (b) Q.7 (b) Q.8 (b)

Q.9 (c) Q.10(a) Q.11(c) Q.12(c) Q.13(b) Q.14(d) Q.15(c) Q.16(c)

Q.17(b) Q.18(b) Q.19(b) Q.20(a) Q.21(c) Q.22(b) Q.23(d) Q.24(d)

Q.25(b) Q.26(d) Q.27(a) Q.28(d) Q.29(c) Q.30(c) Q.31(a) Q.32(d)

Q.33(d)       

10 0
Note

10 0

You might also like