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 GivetheabbreviationofAWT? Q. 8 HowmanytypesofcontrolsdoesAWTsupports
(a) AppletWindowingToolkit thesecontrolsaresubclassesofcomponent?
(b) AbstractWindowingToolkit (a) 7 (b) 6
(c) AbsoluteWindowingToolkit (c) 5 (d) 8
(d) Noneoftheabove Q. 9 Whicharepassivecontrolsthatdonotsupportany
Q. 2 Whichisthecontainerthatcontaintitlebarand interactionwiththeuser?
canhaveMenuBars.Itcanhaveothercomponents (a) Choice (b) List
likebutton,textfieldetc.? (c) Labels (d) Checkbox
(a) Panel (b) Frame
Q. 10 BywhichmethodYoucansetorchangethetextin
(c) Window (d) Container aLabel?
Q. 3 WhichisacomponentinAWTthatcancontain (a) setText() (b) getText()
anothercomponentslikebuttons,textfields,labels (c) BothA&B (d) Noneoftheabove
etc.?
Q. 11 Whichclassisusedtocreateapop‐uplistofitems
(a) Window (b) Container fromwhichtheusermaychoose?
(c) Panel (d) Frame (a) List (b) Choice
Q. 4 AWTisusedforGUIprogramminginjava? (c) Labels (d) Checkbox
(a) True Q. 12 Whichobjectcanbeconstructedtoshowany
(b) False numberofchoicesinthevisiblewindow?
Q. 5 Whichclassprovidesmanymethodsforgraphics (a) Labels (b) Choice
programming? (c) List (d) Checkbox
(a) java.awt Q. 13 Whichisusedtostoredataandpartialresults,as
(b) java.Graphics wellastoperformdynamiclinking,returnvalues
(c) java.awt.Graphics formethods,anddispatchexceptions?
(d) Noneoftheabove (a) Window (b) Panel
Q. 6 ThesetwowaysareusedtocreateaFrame (c) Frame (d) Container
BycreatingtheobjectofFrameclass(association) Q. 14 Thefollowingwayisusedtocreateaframeisby
ByextendingFrameclass(inheritance) creatingtheobjectofFrameclass?
(a) True (a) inheritance
(b) False (b) association
Q. 7 Whichisthecontainerthatdoesn'tcontaintitle (c) BothA&B
barandMenuBars.Itcanhaveothercomponents (d) Noneoftheabove
likebutton,textfieldetc?
Q. 15 AWTmorepowerfulcomponentsliketables,lists,
(a) Window scrollpanes,colorchooser,tabbedpaneetc.?
(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 Thesefourmethodscommonlyusedin? Q.22 WhatisAPI?
(i) publicvoidadd(Componentc) (a) ApplicationProgrammingInterchange
(ii) publicvoidsetSize(intwidth,intheight) (b) ApplicationProgrammingInteraction
(iii) publicvoidsetLayout(LayoutManagerm) (c) ApplicationProgrammingInterface
(iv) publicvoidsetVisible(boolean) (d) Noneofthese
(a) Graphicsclass Q.23 WhatisdefaultlayoutforDialog?
(b) Componentclass (a) FlowLayout (b) GridLayout
(c) BothA&B (c) CardLayout (d) BorderLayout
(d) Noneoftheabove Q.24 Whichmethodisusedtocountthenumberof
itemsistheList.
Q.17 InGraphicsclasswhichmethodisusedtodrawsa
rectanglewiththespecifiedwidthandheight? (a) getItem() (b) getSelectedItem()
(a) publicvoiddrawRect(intx,inty,intwidth,int (c) getItemCount() (d) getCount()
height) Q.25 ThecorrecthierarchyforPanelis__________
(b) publicabstractvoidfillRect(intx,inty,int (a) Component–Container–Window–Panel
width,intheight) (b) Component–Container–Applet–Panel
(c) publicabstractvoiddrawLine(intx1,inty1,int (c) Component–Container–Panel
x2,inty2) (d) Container–Component–Panel
(d) publicabstractvoiddrawOval(intx,inty,int
Q.26 WhichisthecorrectconstructorofGridLayout.
width,intheight)
(a) GridLayout(inta)
Q.18 ImplementtheListenerinterfaceandoverridesits (b) GridLayout(intnum_rows,intnum_columns)
methodsisrequiredtoperformineventhandling? (c) GridLayout(introws,intcols,intvert)
(a) True (b) False (d) GridLayout(inthor)
Q.19 PublicclassMenuBarextends____________. Q.27 WhatarethetypesofDialogBox?
(a) MenuComponent (a) ModalDialogBox
(b) MenuContainer (b) ModalandModelessDialogBox
(c) ComponentMenu (c) Modam
(d) MenuBar (d) Noneoftheabove
Q.20 WhichofthefollowingistrueaboutAWTand Q.28 Inthegiveconstructorwhatthirdparameter
Swingcomponents. indicates:ScrollBars=new
ScrollBar(0,10,20,0,1000);
(a) AWTcomponentscreatesaprocesswhereas
swingcomponentscreatesathread (a) sizeofthumb
(b) AWTcomponentscreatesathreadwhereas (b) minimumvalue
swingcomponentscreatesaprocess (c) Incrementvalue
(c) BothAWTandSwingcomponentscreatesa (d) InitialValue
process Q.29 Whichclassisusedtorepresentasingleline
(d) BothAWTandswingcomponentscreatesa textboxwithpasswordcharacterfacility?
thread (a) TextField (b) TextArea
(c) Label (d) Checkbox
Q.21 Panelisdefinedas______________.
(a) ThePanelclassisaconcretesubclassof Q.30 TosetthetitletotheFramewindow________
Container. methodisused.
(b) APanelisawindowthatdoesnotcontain (a) voidsetTitle(Stringstr)
titlebar,menubarandborder. (b) voidsetText(Stringstr)
(c) PanelisasuperclassofApplet. (c) voidsettitle(Stringstr)
(d) Alloftheabove. (d) Noneoftheabove
10 0
Advanced Java Programming (MSBTE) M1-3 MCQ - Abstract Windowing Toolkit (AWT)
Q.31 SupposeaPanelisaddedtoaFrameandaButton Q.39 Whichmethodisusedtosetpasswordcharacter
isaddedtothePanel.IftheFrame’sfontissetto foraTextField?
12pointTimesNewRoman,thepanel’sfontisset (a) setPasswordCharacter()
10pointsTimesNewRomanandtheButton’sfont (b) setEchoChar()
isnotset.Whatfontwillbeusedtodisplaythe
(c) setPassChar()
Button’slabel?
(d) setEchoCharacter()
(a) 12pointTimesNewRoman
(b) 11pointTimesNewRoman Q.40 ThegetContentPane()methodisofwhichclass?
(c) 10pointTimesNewRoman (a) JApplet
(d) 9pointTimesNewRoman (b) JFrame
(c) JButton
Q.32 WhichofthefollowingistrueaboutFlowLayout?
(d) Noneofthese
(a) FlowLayoutcanusemultiplerowsifthe
horizontalspaceinthecontaineristoosmall Q.41 WhichclassdefinessetSize()method?
toholdthecomponent. (a) Frame
(b) FlowLayoutisthedefaultlayoutmanagerof (b) Applet
panelandapplet. (c) Component
(c) Itisthedefaultlayoutmanagerforwindow. (d) Panel
(d) BothA&B.
Q.42 __________isaswingclassthatallowstoentera
Q.33 Whichofthemethodcanbeusedtooutputa singlelineoftext.
StringinanApplet? (a) TextField
(a) display() (b) print() (b) JTextField
(c) drawString() (d) transient() (c) EditTextField
Q.34 ___________positionsarethecomponentsinto5 (d) TextArea
regionseast,west,south,north,center.
Q.43 WhichTextComponentmethodisusedtoseta
(a) CardLayout (b) BorderLayout TextComponenttotheread‐onlystate?
(c) GridLayout (d) FlowLayout (a) Editable
Q.35 WhatisAPI? (b) NonEditable
(a) ApplicationProgrammingInterchange (c) setEchoChar
(b) ApplicationProgrammingInteraction (d) setEditable
(c) ApplicationProgrammingInterface
Q.44 Howwouldyousetthecolorofgraphicscontext
(d) Noneofthese calledgtocyan?
Q.36 Panelisdefinedas_______. (a) g.setColor(“cyan”);
(a) Panelclassisaconcretesub‐classofcontainer (b) g.setCurrentColor(cyan);
(b) APanelisawindowthatdoesnotcontaina (c) g.setColor(“Color.cyan”);
titlebar,menubarorborder (d) g.setColor(Color.cyan);
(c) PanelisthesuperclassofApplet Q.45 Whatisuseofsecondparameteringiven
(d) Allofabove constructorLable(String,int)
Q.37 WhichcomponentofAWTprovidescompact, (a) specifiesheightoflabel
multichoice,scrollingcomponent? (b) specifieswidthoflabelintermsofpixel
(a) List (b) Choice (c) specifiesthealignmentoftextinlabelin
(c) Panel (d) TextArea termsofpixel
(d) specifieswidthoflabel
Q.38 WhenthereisaswitchingconditionlikeONor
OFF,whichcontrolisusedoffollowing? Q.46 ThesetBackground()methodispartofwhichof
(a) Button (b) RadioButton thefollowingclassjava.awtpackage?
(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 Whatdoesthefollowinglineofcodedo? Q.56 Whichofthefollowingpackageisusedfor
TextFieldtf=newTextField(10); GraphicalUserInterface?
(a) willset10toTextFieldasitsinitialtext. (a) java.applet (b) java.awt
(b) Willsetthecharactercapacityto10 (c) java.awt.image (d) java.io
(c) BothA&B
Q.57 WhatarethevariablesdefinedinDimension?
(d) NoneofThese (a) lengthandwidth
Q.48 Frameisastandardwindow,whichis__________ (b) heightandlength
ofWindowclassfromAWThierarchy? (c) heightandwidth
(a) Derivedclass/Subclass (d) Noneofthese
(b) Baseclass/Superclass
Q.58 WhichAWTcomponentisnoteditable?
(c) Rootclass
(a) Button (b) TextField
(d) Familyclass
(c) FlowLayout (d) Label
Q.49 A____________isapassiveAWTcontrolthatdo
Q.59 CurrenttextofLabelcanbeobtainedusing
notgenerateanyevent?
__________.
(a) Button (b) RadioButton
(a) setAlignment()
(c) Choice (d) Label
(b) getAlignment()
Q.50 ThedefaultlayoutmanagerofFrameis________. (c) getText()
(a) FlowLayout (b) BorderLayout (d) setText()
(c) GridLayout (d) CardLayout
Q.60 Themethod___________placesaMenuminto
Q.51 Whichmethodisusedtocheckthestatusof theMenuBarmb.
checkbox? (a) mb.addMenuItem(m)
(a) getStatus() (b) getState() (b) mb.addItem(m)
(c) isChecked() (d) getChecked() (c) mb.add(m)
Q.52 Whichofthefollowingmethodisusedtoseta (d) Noneofthese
TextComponenttoread‐onlymode? Q.61 WhichoftheseComponentscannotbeaddedto
(a) Editable() (b) nonEditable() Frame?
(c) setEchoChar() (d) setEditable() (a) Label
Q.53 _________generatesactioneventswhenanitem (b) Button
isdouble‐clicked. (c) CheckboxGroup
(a) List (b) Checkbox (d) Allofabove
(c) MenuItem (d) TextField Q.62 WhatisuseofsecondparametergiveninLabel
Q.54 Whichofthefollowingdoesnothaveitsdefault constructor:Label(String,int)
layoutasBorderLayout. (a) Specifiesheightoflabelintermsofpixels.
(a) Frame (b) specifieswidthoflabelintermsofpixels.
(b) Dialog (c) specifiesthealignmentoftextinlabelin
(c) JApplet termsofpixels.
(d) AllofAbove (d) Specifiesmaximumnumbersofcharactersin
label.
Q.55 WhichofthefollowingstatementaboutGUI
componentiswrong? Q.63 Whichoftheseclassescanbeaddedtoany
(a) swingexistssincetheversion1.2oftheJDK Containerclass,usingtheaddmethoddefinedin
Containerclass?
(b) AWTstandsforAbstractWindowToolkit
(a) Button
(c) YoucannotplaceAWTcomponentonswing
container. (b) CheckboxMenuItem
(c) Menu
(d) TheAWTclassesaredeprecated.
(d) MenuBar
10 0
Advanced Java Programming (MSBTE) M1-5 MCQ - Abstract Windowing Toolkit (AWT)
Q.64 WhatistheuseofsetEchoChar()method? (a) OnlyAstatementistrue.
(a) tosetechoinsymbolform (b) OnlyBstatementistrue.
(b) tosetcharinsymbolform (c) OnlyCstatementistrue.
(c) BothA&B (d) AllA,BandCaretrue.
(d) tocreatepasswordinsymbolform
Q.67 ThedefaultlayoutofAppletis_______.
Q.65 __________methodreturnscurrentlyselected (a) GridLayout
iteminchoice. (b) CardLayout
(a) getSelectedItem() (c) FlowLayout
(b) getSelectedElement() (d) BorderLayout
(c) getSelectedIndex()
Q.68 JavaAppletsareusedtocreate________
(d) getItem() applications.
Q.66 Whichstatementwithrespecttoinnerclassis (a) Graphical
true. (b) userinteractive
A. Itisawayoflogicallygroupingclassesthatare (c) BothA&B
onlyusedinoneplace. (d) Noneofthese
B. Itincreasesencapsulation.
C. Itcanleadtomorereadableandmaintainable
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 Whichpackageisusedforimporingswing
Q.1 Thefollowingspecifiestheadvantagesof components?
Itislightweight. (a) java.swing (b) javax.swing
Itsupportspluggablelookandfeel. (c) java.awt. (d) Alloftheabove
ItfollowsMVC(ModelViewController)
architecture. Q.9 Inswing,Buttonsaresubclassesofwhichclass?
(a) Swing (b) AWT (a) AbstractButton (b) JButton
(c) BothA&B (d) Noneoftheabove (c) Button (d) JRadioButton
Q.2 SwingisnotapartofJFC(JavaFoundationClasses) Q.10 JTreeclassbelongstowhichpackage?
thatisusedtocreateGUIapplication? (a) java.awt (b) java.applet
(a) True (b) False (c) java.swing (d) javax.swing
Q.3 TheSwingComponentclassesthatareusedin Q.11 Whichcomponentisswingrepresentsdatainrow
Encapsulatesamutuallyexclusivesetofbuttons? andcolumns?
(a) AbstractButton (b) ButtonGroup (a) JTextArea (b) JTable
(c) JButton (d) ImageIcon (c) JPanel (d) JtabbedPane
Q.4 TheJavaFoundationClasses(JF(c)isasetofGUI Q.12 WhichofthefollowingisnotconstructorofJTree?
componentswhichsimplifythedevelopmentof (a) JTree(TreeNodetn)
desktopapplications? (b) JTree(Vectorv)
(a) True (b) False (c) JTree(intx)
Q.5 Whichpackageisusedforimporttheswing (d) noneoftheabove
components?
Q.13 ____________classusedtocreatenodeintree.
(a) java.swing (b) java.awt (a) TreeNode
(c) javax.swing (d) Alloftheabove (b) DefaultMutableNode
Q.6 TheStringparametertoJButtonconstructor (c) DefaultMutableTreeNode
______________. (d) Node
(a) tellwhichregiontoputtheJButtonin.
Q.14 JTabbedPaneclassispresentinwhichpackage?
(b) tellsthecoloroftheJButton.
(a) java.awt (b) java.swing
(c) tellswhattextwillappearonJButton.
(c) java.awt.swing (d) javax.swing
(d) tellswhatshouldhappenwhenJButtonis
pressed. Q.15 WhatispurposeofJTree?
(a) Toshowdatainformofparentandchild
Q.7 MVCarchitectureis_________
nodes.
(a) Modelling–Visual–Controller
(b) Toshowdatainlistview.
(b) Model–View–Controller
(c) Toshowdataintabularform.
(c) Model–Viewable–Controller
(d) Toshowdatainmenu‐bar.
(d) Many–View–Controller
10 0
Advanced Java Programming (MSBTE) M2-2 MCQ - Swings
Q.16 Whatistheuseof:ContainergetContentPane() Q.19 FromfollowinglistwhichisnotSwingclass?
(a) ReturnsContainerforaJDialog. (a) JLabel
(b) ReturnsaContentPaneforMenu (b) JButton
(c) ReturnsaContentPaneforApplet (c) JImageIcon
(d) Noneoftheabove (d) JCheckBox
Q.17 Whichofthefollowingmethodisnotapplicable Q.20 Whichcomponentprovidessupportfortwo‐state
forButtoninswing. buttons?
(a) setDiableIcon() (b) setPressedIcon() (a) Button,Checkbox
(c) setSelectedIcon() (d) setRollOverIcon() (b) JCheckBox,JRadioButton
(c) Button,MenuItem
Q.18 Whichofthefollowingmethodisusedtoretrieve
iconofJButton? (d) JCheckBox,TextField
(a) IcongetIcon()
(b) ImageIcongetImageIcon()
(c) ImageIcongetIcon()
(d) ImageIconGetImageIcon()
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 TheFollowingstepsarerequiredtoperform Q.8 InGraphicsclassWhichmethodisusedtosetthe
ImplementtheListenerinterfaceandoverridesits graphicscurrentcolortothespecifiedcolor?
methods (a) publicabstractvoidsetFont(Fontfont)
RegisterthecomponentwiththeListener (b) publicabstractvoidsetColor(Colorc)
(a) ExceptionHandling(b) StringHandling (c) publicabstractvoiddrawString(Stringstr,int
(c) EventHandling (d) Noneoftheabove x,inty)
Q.2 Inwhichplacescanputtheeventhandlingcode (d) Noneoftheabove
(a) Sameclass (b) Otherclass Q.9 Whichofthefollowingmethodisusedto
(c) Annonymousclass (d) Allmentionedabove determinethetypeofadjustmentevent?
(a) getType()
Q.3 Whichpackageprovidesmanyeventclassesand
Listenerinterfacesforeventhandling? (b) getEventType()
(a) java.awt (b) java.awt.Graphics (c) getAdjustmentType()
(c) java.awt.event (d) Noneoftheabove (d) getEventObjectType()
Q.4 TousetheActionListenerinterfaceitmustbe Q.10 TextFieldgenerates____________event.
implementedbyaclassthereareseveralwaysto (a) ActionEvent,ItemEvent
dothatfindinthefollowing? (b) ActionEvent,TextEvent
(a) Creatinganewclass (c) ScrollEvent,TextEvent
(b) usingtheclassthegraphicalcomponent (d) ActionEvent,ScrollEvent
(c) ananonymousinnerclass
Q.11 voidkeyTyped(KeyEventke)calledwhenakeyon
(d) Allmentionedabove thekeyboardis____________.
Q.5 TheActionListenerinterfaceisnotusedfor (a) pressedandthenreleased.
handlingactionevents? (b) pressed
(a) True (c) released
(b) False (d) noneoftheabove
Q.6 TheActionListenerinterfaceisusedforhandling Q.12 Whicheventisgeneratedwhenthepositionof
actionevents,Forexample,it'susedbya scrollbarischanged?
(a) JButton (a) KeyEvent (b) MouseEvent
(b) JCheckbox (c) ItemEvent (d) AdjustmentEvent
(c) Allofthese
Q.13 Thesignaturefortheregistrationmethodfora
(d) JMenuItem ActionEventshouldbe_______.
Q.7 WhichclassisusedforthisProcessingMethod (a) publicvoidaddActionListener(ActionEventL)
processActionEvent()? (b) publicvoidsetAction(ActionListenerL)
(a) Button,List,MenuItem (c) publicvoidsetActionListener(ActionListenerL)
(b) Button,Checkbox,Choice (d) publicvoidaddActionListener(ActionListener
(c) Scrollbar,Component,Button L)
(d) Noneoftheabove
10 0
Advanced Java Programming (MSBTE) M3-2 MCQ - Event Handling
Q.14 Whichofthefollowingcomponentgenerates Q.24 ComponentEventisthesuperclassof________
ActionEvent? (a) ActionEvent (b) ItemEvent
(a) Window (b) RadioButton (c) TextEvent (d) Allofabove
(c) ScrollBar (d) None
Q.25 WhenweneedtouseCheckboxorItemfromthe
Q.15 ___________methodisusedtoregistera listoruseacheckableMenuan__________is
keyboardeventlistener. generated.
(a) KeyListener() (a) ActionEvent (b) ItemEvent
(b) addKeyListener() (c) MenuEvent (d) ClickEvent
(c) addKeyListenerEvent()
Q.26 Whichofthefollowingconstantisnotdefinedin
(d) eventKeyboardListener() WindowEventclass?
Q.16 NamethemethoddefinedinEventObjectclass (a) WINDOW_ACTIVATED
thatreturnstheobjectgeneratedfromtheevent. (b) WINDOW_CLOSED
(a) getEvent() (b) getObject() (c) WINDOW_DEICONIFIED
(c) getId() (d) getSource() (d) Noneofthese
Q.17 TheMouseListenerinterfaceisusedtomake Q.27 Whichofthefollowingisnotthemethodof
mousehandling. handlingwindowevent?
(a) True (a) voidwindowClosed(WindowEventwe)
(b) False (b) voidwindowClosing(WindowEventwe)
(c) voidwindowAfterClosing(WindowEventwe)
Q.18 ActionEventisappliedon________
(a) Frame (d) Allofthese
(b) Checkbox,Choice,List Q.28 Whichmethodisusedtoprocessmouseclick?
(c) Scrollbar (a) publicvoidmouseClicked(MouseListenerm)
(d) Button,TextField,List,Menu (b) publicvoidmouseIsClicked(MouseEventm)
(c) publicvoidmouseClicked(MouseEventm)
Q.19 ComponentEventisthesuperclassof__________.
(a) FocusEvent (b) MouseEvent (d) publicvoidmouseClick(MouseEventm)
(c) WindowEvent (d) Alloftheabove Q.29 Whichclassisusedforthisprocessingmethod
processActionEvent()method?
Q.20 Ifwecloseanappletwindow_________events
willbegenerated. (a) Button,List,MenuItem
(a) ActionEvent (b) ComponentEvent (b) Button,Checkbox,Choice
(c) AdjustmentEvent (d) WindowEvent (c) ScrollBar,Component,Button
(d) Noneoftheabove.
Q.21 Whichofthefollowingcomponentgenerate
ActionEvent? Q.30 Whichofthispackagecontainsalltheclassesand
(a) ScrollBar (b) Window methodsrequiredforeventhandlinginJava.
(c) RadioButton (d) Noneofthese (a) java.applet (b) java.awt
(c) java.event (d) java.awt.event
Q.22 WhichListenerhandlesallListrelatedEvents?
Q.31 NamethemethoddefinedinEvenObjectclassthat
(a) ItemListener (b) InputEvent
returnstheobjectgeneratedfromtheevent.
(c) SelectEvent (d) ListEvent
(a) getEvent() (b) getObject()
Q.23 Howtoobtainthecommandnameforinvoking (c) getId() (d) getSource()
ActionEvent?
Q.32 Whichoftheseinterfacesdefineamethod
(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 ButtonControlimplementsfollowinglistener Q.37 MouseEventissubclassofwhichofthefollowing
interface. class?
(a) ItemListener (b) ActionListener (a) ComponentEvent
(c) FlowListener (d) Adapter (b) ContainerEvent
(c) ItemEvent
Q.34 Clickingtheclosingbuttonontheupperright
cornerofaframegeneratesa(n)‐event. (d) InputEvent
(a) ItemEvent (b) WindowEvent Q.38 The_________isanobjectthatisnotifiedwhen
(c) MouseMotionEvent( d) ComponentEvent aneventoccurs.
(a) Listener
Q.35 Whichofthefollowingmethodmustbe
overriddenintheordertohandleKeyEvent. (b) Sources
(a) keyPressed(KeyEventobj) (c) Event
(b) KeyReleased(KeyEventobj) (d) Noneoftheabove
(c) KeyTyped(KeyEventobj) Q.39 WhatistheuseofStringgetActionCommand()
(d) Allofthese methodofActionEventclass?
(a) toobtainthelabel(caption)ofButton
Q.36 Whichofthesemethodscanbeusedtoknowthe
degreeofadjustmentmadebytheuser? (b) toobtainthereferenceofButton
(a) getValue() (c) toobtainobjectofButton
(b) getAdjustmentType() (d) toobtainthelabel(caption)andobjectof
(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 UDPstandsfor___________ Q.7 IPv6uses________.
(a) UserDataPort (a) 4groupsof8bitseach
(b) UserDatagramProtocol (b) 4groupof8hexa‐decimaldigits
(c) UsedDataProvider (c) 8groupsof4digitseach
(d) UserDataProtocol (d) 8groupsof4hexa‐decimaldigitseach
Q.2 Nametheclasswhichisusedtocreateaport Q.8 SelectfullformofDNS.
wheretheserverwilllisten. (a) DataNetworkSystem
(a) Server (b) Socket (b) DomainNameSystem
(c) ServerSocket (d) SocketServer (c) DomainNameServer
Q.3 CommunicationusingTCPprotocolis______and (d) DomainNamingService
________. Q.9 WhatistheuseofWriteUTF()method?
(a) Connectionless,Iterative (a) Thismethodwritesastringintounderlying
(b) Collectionless,concurrent outputstream.
(c) Connectionoriented,Iterative (b) Thismethodreadsastingfromunderlying
(d) Connectionoriented,concurrent inputstream.
(c) Thismethodwritesabytearrayinto
Q.4 Whichoftheseisanotafactorymethodof
InetAddressclass? underlyingoutputstream.
(a) staticInetAddressgetLocalHost() (d) Thismethodwritesacharacterarrayinto
underlyingoutputstream.
(b) staticInetAddressgetByName(String
hostname) Q.10 Whichoftheseisabundleofinformationpassed
(c) staticInetAddressgetAllName(String betweenmachines?
hostname) (a) MIME (b) Cache
(d) staticInetAddress[]getAllByName(String (c) Datagram (d) Socket
hostname)
Q.11 PortnumberforFTPis_______
Q.5 Whichfromthebelowuse“Middletier”. (a) 21 (b) 23
(a) 3tier (c) 25 (d) 80
(b) 4tier
Q.12 Theclasswhichencapsulatesboththenumerical
(c) n–tier IPaddressandthedomainnameforthataddress
(d) alloftheabove is_____.
Q.6 java.netpackageconsistsofinterface__________ (a) DatagramPacket
(a) ContentHandlerFactory (b) DatagramSocket
(b) SocketImplFactory (c) InetAddress
(c) FileNameMapandURLStreamHandlerFactory (d) ServerSocket
(d) Alloftheabove
10 0
Advanced Java Programming (MSBTE) M4-2 MCQ - Networking Basics
Q.13 intgetServerPort()method____________ Q.21 WhichmethodofServerSocketwillwaitfora
(a) returnstheportnumberonwhichthisrequest clienttoinitiatecommunicationandthen
wasreceived. communicationwiththeclient?
(b) returnstheportnameonwhichtherequest (a) wait() (b) connect()
wasreceived. (c) waitForClient() (d) WaitForConnect()
(c) returnstheservernumberonwhichthis
Q.22 _________methodisusedtoretrievefilename
requestwasreceived. specifiedinURL.
(d) returnstheportnumberonwhichthis (a) getFile() (b) getUrl()
response/requestwasreceived.
(c) getFileUrl() (d) getLocalFile()
Q.14 InthisconstructorServerSocket(intport,int
max_queue)whatisthedefaultvaluefor Q.23 ________isnecessarytoimplementDatagram.
max_queue? (a) DatagramPacket (b) DatagramSocket
(a) 100 (b) 50 (c) BothA&B (d) NoneofA&B
(c) 75 (d) 80 Q.24 WhichisthecorrectsyntaxforgetLocalHost()
method?
Q.15 TheconstructorofURLcanthrowanexception
called______ (a) publicstaticInetAddressgetLocalHost()
(a) MalformedUrlException throwsUnknownHostException
(b) UrlNotFoundException (b) publicstaticIpAddressgetLocalHost()throws
UnknownHostException
(c) UrlException
(c) publicstaticStringgetLocalHost()throws
(d) UrlSourceNotFoundException UnknownHostException
Q.16 WhichIPaddressismulticastIPaddress? (d) publicstaticvoidgetLocalHost()throws
(a) 192.168.2.32 UnknownHostException
(b) 235.55.45.2 Q.25 WhichofthesemethodofDatagramPacketclassis
(c) 12.22.1.2 usedtofindthedestinationaddress?
(d) Noneofthese (a) findAddress() (b) getAddress()
Q.17 Which5parametersuniquelyidentifya (c) address() (d) whoIs()
connection? Q.26 Connectionorientedcommunicationispossible
(a) LocalIP,RemoteIP,LocalMAC,RemoteMAC using____________classesofJava.
andProtocol (a) SocketandServerSocket
(b) LocalIP,LocalPORT,RemoteMAC,Remote (b) DatagramSocketandDatagramPacket
PORTandProtocol (c) Bothofthese
(c) LocalMAC,LocalPORT,RemoteMAC,Remote (d) Noneofthese
PORTandProtocol
(d) LocalIP,LocalPORT,RemoteIP,RemotePORT Q.27 Aserversocketcanconnectto________clients.
andProtocol (a) 1 (b) 2
(c) 10 (d) multiple
Q.18 SelectthemethodusedtocreateURLconnection.
(a) URLConnection (b) openConnection Q.28 ResolverinDNSsystemmaps__________.
(c) URL (d) URLDecoder (a) DomainnametoIPaddress
(b) IPaddresstodomainname
Q.19 WhatvalueisreturnedbythereadLine()method
whenitreachatEndofFile? (c) DomainnametoMACaddress
(a) EOF (b) null (d) MACaddresstoIPaddress
(c) 0 (d) END Q.29 Ifaprogramconsistsofthreeclasses,thenafter
compilationhowmanyclassfileswillbecreatedby
Q.20 The_________classisusedtocreateTCPserver.
thecompiler?
(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 WhichofthefollowingisnotamethodofSecurity Q.36 Whichmethodsarecommonlyusedin
class? ServerSocketclass?
(a) socketPermission()(b) filePermission() (a) publicOutputStreamgetOutputStream()
(c) dataPermission() (d) Noneofabove (b) publicSocketaccept()
(c) publicsynchronizedvoidclose()
Q.31 TCPdoesnotsupportsMulticastingand
Broadcastingbecause______________. (d) Noneoftheabove
(a) Itsupportsfullduplexcommunication. Q.37 Whichisthepropermethodtoretrievethehost
(b) Itprovideserrorcontrol. nameoflocalmachine?
(c) Itprovidesflowcontrol (a) staticInetAddressgetLocalHost()throws
(d) Itisconnectionorientedprotocol UnknownHostException
Q.32 WhichofthefollowingistrueaboutTCPprotocol? (b) staticInetAddressgetByName(String
host_name)throwsUnknownHostException
(a) isreliableandconnectionoriented
(b) isunreliablebutconnectionoriented (c) staticInetAddressgetAllByName(String
host_name)throwsUnknownHostException
(c) isreliableandconnectionless
(d) Noneofthese (d) StringgetHostAddress()
Q.33 Whichclassdefinesfollowingmethods? Q.38 WhichconstructorofDatagramPacketclassare
intgetContentLength() usedforreceivingpurpose?
longgetDate() (a) DatagramPacket(bytedata[],intsize)
longgetExpiration() DatagramPacket(bytedata[],intsize,int
(a) URLConnection (b) Datagram offset,intport)
(c) Client (d) Noneofthese (b) DatagramPacket(bytedata[],intsize,
InetAddressip,intport)
Q.34 Nametheclasswhichisusedtocreateaport
DatagramPacket(bytedata[],intoffset,int
wheretheserverwilllisten?
size,InetAddressip,intport)
(a) Server (b) Socket
(c) DatagramPacket(bytedata[],intsize)
(c) ServerSocket (d) SocketServer
DatagramPacket(bytedata[],intsize,
Q.35 classPermissioninjava.securitypackageis InetAddressip,intport)
__________. (d) Allofthese
(a) static (b) abstract
(c) final (d) Noneofthese
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–protocolpureJavaDriverconverts
Q.1 The__________packagecontainsclassesthat _______intothe_________directly.
helpinconnectingtoadatabase,sendingSQL (a) JDBCcalls,networkprotocol
statementstothedatabaseandprocessthequery (b) ODBCclass,networkprotocol
request. (c) ODBCclass,usercalls
(a) connection.sql (b) db.sql (d) JDBCcalls,usercalls
(c) pkg.sql (d) java.sql
Q.8 ChoosethecorrectsyntaxforgetConnection()
Q.2 WhichofthefollowingisnotatypeofJDBC method.
driver? (a) publicstaticConnectiongetConnection(String
(a) 100%pureJavaDriver url,Stringpassword)throwsSQLException
(b) JDBC–netpureJavaDriver (b) publicstaticConnectiongetConnection(String
(c) JDBC–NativeAPIdriver name,Stringpassword)throwsSQLException
(d) JDBC–NativepureJavaDriver (c) publicstaticConnectiongetConnection(String
url,Stringname,Stringpassword)throws
Q.3 InJDBC______________importsallJavaclasses SQLException
thatareconcernwithDatabaseconnectivity.
(d) publicstaticConnectiongetConnection(String
(a) javax.sql (b) java.mysql url,Stringname)throwsSQLException
(c) java.sql (d) com.sql
Q.9 SQLstandsfor__________.
Q.4 DatabaseprogrammingusingJavathrowswhichof (a) StructuredQueryLanguage
thefollowingexception?
(b) SequentialQueryLanguage
(a) SQLException
(c) StructuredQuestionLanguage
(b) ClassNotFoundException
(d) SequentialQuestionLanguage
(c) Noneofthese
(d) Bothofthese Q.10 _____________isatableofdatawhichrepresents
adatafromtable.
Q.5 Inthebelowstatement,whichtypeofquerycan (a) MetaData (b) ResultSetMetaData
beusedwithexecuteUpdate()method.
statement.executeUpdate(queryhere) (c) ResultSet (d) Statement
(a) Insert,Update,Delete Q.11 PublicclassDriverManagerextends____________
(b) Insert,Select,Delete (a) Object (b) String
(c) OnlySelect (c) Connection (d) Statement
(d) AnyQuery
Q.12 Whichofthefollowingmethodissupportedby
Q.6 Whatispurposeofnext()method? Statementinterface?
(a) toretainthenextelementinaseries. (a) publicbooleanexecute(Stringquery)
(b) toretainnexttable. (b) publicResultSetexecuteQuery(Stringquery)
(c) toretainnextrecordinaseries. (c) publicintexecuteUpdate(Stringquery)
(d) Noneoftheabove (d) Allofabove
10 0
Advanced Java Programming (MSBTE) M5-2 MCQ - Interacting with Database
Q.13 Infollowingstatementrsisanobjectof Q.21 IdentifycorrectsyntaxofexecuteQuery()of
__________interfaceofJDBCAPI. Statementinterface.
System.out.println(rs.getString(3)); (a) publicstaticResultSetexecuteQuery()
(a) RowSet (b) Statement (b) publicResultSetexecuteQuery(Stringq)
(c) Connection (d) ResultSet (c) publicvoidexecuteQuery(Stringq)
Q.14 WhichismaincomponentofJDBCAPI? (d) publicintexecuteQuery(Stringq)
(a) DriverManager (b) Driver Q.22 NativeAPIconverts______intothe______used
(c) Connection (d) Allofthese byDBMS.
(a) JDBCAPI,NetworkProtocol
Q.15 Howmanystepsareusedtoconnectanyjava
applicationwiththedatabaseusingJDBC? (b) JDBCAPI,NativeAPIcalls
(a) 5 (b) 4 (c) JDBCAPI,usecalls
(c) 3 (d) 6 (d) JDBCAPI,ODBCAPIcalls
Q.16 ODBCminimumSQLgrammercontains______ Q.23 Whichofthefollowingfunctionisusedtofindthe
(a) Storedprocedure columncountoftheparticularResultSet.
(b) Data,TimeandTimeStamponly (a) getMetadata() (b) metadata()
(c) createordropView (c) getColumnCount() (d) getCount()
(d) Insert,update,deleteonly Q.24 TheJDBC‐ODBCbridgesupportshowmany
concurrentopenstatementsperconnection?
Q.17 Whichclass/interfaceisusedforanSQLstatement
thatisexecutedfrequently? (a) 1
(a) Statement (b) 0
(b) CallableStatement (c) Doesnotsupportconnection
(c) PreparedStatement (d) Noneofthese
(d) Noneoftheabove Q.25 Selectthecorrectmethodtocreate
CallableStatement.
Q.18 Whatdoesthefollowingcodedo:
smt=con.createStatement() (a) CallableStatementprepareCall(Stringsql)
(a) APreparedStatementobjectiscreatedto (b) CallableStatementprepareCall(Stringsql,int
sendSQLcommandstodatabase. resultsettype,intresultset_concurrency)
(b) AStatementobjectiscreatedtosendSQL (c) CallableStatementprepareCall(Stringsql,int
commandstodatabase. resultset_type,intresultset_concurrency,int
resultset_holdability)
(c) ACallableStatementiscreatedtosendSQL
commandstodatabase. (d) Alloftheabove
(d) AStatementobjectiscreatedtoexecute Q.26 MicrosoftAccessdatain_______fileformat.
parameterizedSQLcommands. (a) .DAT (b) .MDB
Q.19 WhichkindofdriverconvertsJDBCcallsintocalls (c) .MSSQL (d) .OBJ
ontheClientAPIforOracle,Sybase,Informix,IBM Q.27 Whichofthefollowingmethodisusedforsend
DB2,orotherDBMS SQLstatements?
(a) JDBCODBCbridge+ODBCDriver (a) Statement (b) CallableStatement
(b) NativeAPIpartly–JavaDriver (c) PreparedStatement(d) BothB&C
(c) JDBC–NetpureJavaDriver
Q.28 DELETEstatementofanSQLisexecutedby
(d) NativeProtocolPureJavaDriver
________.
Q.20 WhichmethodexecutesanSQLstatementthat (a) execute() (b) executeQuery()
mayreturnmultipleresults? (c) executeUpdate() (d) executeDelete()
(a) executeUpdate()
(b) executeQuery() Q.29 Theinterfacetothedatabaseishandleby_____.
(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 DatabaseMetadataareretrievedthrough Q.32 Whichofthefollowingisusedgenerallyfor
___________ readingthecontentofthedatabase?
(a) getDatabaseMetadata() (a) DabaseData
(b) getMetaData() (b) DabaseData
(c) getDBMetaData() (c) ResultSet
(d) getDatabaseMeta() (d) DatabaseResult
Q.31 WhichmethodisusedtoretrievetheResultSet Q.33 Thesyntaxtocreateatablenamed“Course”,
created? shouldbeginwith__________.
(a) executeQuery() (a) createnewtablecourse
(b) getResultSet() (b) createtablecourse
(c) getResultSetResult() (c) tablecoursecreate
(d) getResult() (d) newtablecourse
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(newCookie(“username”,
Q.1 JSPembeds__________in___________.
“joe));
(a) Servlet,HTML (b) HTML,Java
(b) response.addCookie(newCookie(“username”,
(c) HTML,Servlet (d) Java,HTML
“joe”))
Q.2 WhichofthefollowingisthedefaultHttpRequest (c) request.addCookie(“username”,“joe);
method? (d) request.addCookie(“username”,“joe);
(a) doGet() (b) doPost()
Q.7 WhichJSPtagisusedtotransferforprocessing
(c) doTrace() (d) doPut()
anotherJSPpage?
Q.3 Whicharetrueabouttaglibrariesinweb (a) <jsp:include> (b) <jsp:forward>
application? (c) <jsp:useBean> (d) <jsp:use:include>
(a) packagedinthe/WEB‐INFdirectoryorsub‐
directoryoftheWARfile Q.8 Anapplicationwantstoinvalidatethesessionboth
programmaticallyanddeclaratively.Selectthe
(b) Ifatagisimplementedasatagfileand
bestmatchtodothis.
packagedin/WEB‐INF/tags/orasub‐
directory,aTLDwillbegenerated (a) httpRequest.getSession().end()
automaticallybythewebcontainer,though, <session‐config><session‐timeout‐interval>
youcanprovideoneifyouwish time_in_minutes</session‐timeout‐interval>
(c) packagedinthe/META‐INF/directoryorsub‐ </session‐config>
directoryofataglibrarypackagedinajar. (b) httpRequest.getSession().invalidate()
(d) Alloftheabove. <session‐config><session‐timeout>
time_in_minutes</session‐timeout>
Q.4 Namethehttpmethodusedtosendresourcesto </session‐config>
theserver.
(c) httpRequest.getSession().close()
(a) FTPmethod (b) PUTmethod
<session‐config><session‐timeout>
(c) WRITEmethod (d) COPYmethod time_in_minutes</session‐timeout>
Q.5 IdentifythepropersyntaxofdoGet(). </session‐config>
(a) voiddoGet(HttpResponseres,HttpRequest (d) httpRequest.getSession().invalidate()
req)throwsIOException,ServletException <session‐config><session‐duration>
(b) voiddoGet(HttpRequestreq,HttpResponse time_in_minutes</session‐duration>
res)throwsIOException,ServletException </session‐config>
(c) voiddoGet(HttpResponseres)throws Q.9 Theinclude()methodinRequestDispatcher____.
IOException,ServletException (a) sendsarequesttoanotherresourcelike
(d) voiddoGet(HttpRequestreq)throws servlet,JSPorhtml.
IOException,ServletException
(b) includesresourcesoffilelikeservlet,JSPor
Q.6 GivenanHttpServletRequestrequestand html.
HttpServletResponseresponseinstances.Which (c) appendstherequestandresponseobjectsto
setsacookie“username”withthevalue“joe”ina thecurrentservlet.
servlet? (d) Noneofthese
10 0
Advanced Java Programming (MSBTE) M6-2 MCQ - Servlets
Q.10 Statetrueorfalseforfollowingstatements. Q.19 _________isthefirstPhaseofServletLifecycle.
(i)JavaBeansslow‐downsoftwaredevelopment (a) service() (b) init()
process. (c) destroy() (d) BothB&C
(ii)JavaServletsdonothavebuilt‐inmultithreaded
feature. Q.20 HowmanycopiesofaJSPpagecanbeinmemory
atatime?
(a) false,false (b) false,true
(a) 1 (b) 2
(c) true,false (d) true,true
(c) 3 (d) Unlimited
Q.11 ________isasmallpieceofinformationthatis
Q.21 Whichmethodisusedtospecifybeforeanylines
passedback&forthinHTTPrequest&response.
thatusedthePrintWriter?
(a) Servlet (b) Applet
(a) setPageType()
(c) Cookie (d) Session
(b) setContextType()
Q.12 Whichlifecyclemethodisusedtoprocessa (c) setContentType()
client’srequest? (d) setResponseType()
(a) start() (b) init()
(c) service() (d) destroy() Q.22 _________isusedtoreaddatafromaclient
request.
Q.13 AusertypestheURL (a) ServletResponse (b) ServletRequest
http://www.msbte.com/result.php.Whichrequest (c) Servlet (d) ServletConfig
getsgenerated?
(a) GETmethod (b) POSTmethod Q.23 Thefollowingmethodsbelongstothelifecycle
(c) HEADmethod (d) PUTmethod methodsoftheservlet.
(a) init() (b) service()
Q.14 ApacheTomcatis________. (c) destroy() (d) Alloftheabove
(a) Servlet
Q.24 Javaservlet
(b) JavaProgram
(c) API (i)isakeycomponentoftheserversidejava
(d) WebservercapableofrunningJavaprograms development.
Q.15 WhatthegetSession()methodwith“true” (ii)isasmallpluggableextensiontoaserverthat
parameterwilldo? enhancesfunctionality
(a) Thesessioniscompleted (iii)runsonlyinwindowsOS
(b) Thesessionobjectispassedtoanother
method (iv)allowsdeveloperstocustomizeanyjava
enabledserver
(c) Createsnewsessionif,thesessiondoesnot
exist (a) i,iiandiiiaretrue
(d) Thesessionisexist (b) i,iiiandivaretrue
(c) ii,iiiandivaretrue
Q.16 AJSPpageconsistsofwhichtags? (d) i,iiandivaretrue
(a) HTMLtags (b) JSPtags
(c) BothA&B (d) Noneoftheabove Q.25 Servletlifecyclehas_________states.
(a) Two (b) Three
Q.17 Lifecycleofaservletismanagedby______ (c) Four (d) Five
(a) ServletContext (b)ServletContainer
(c) Supportingprotocol(d) Alloftheabove Q.26 JSPlifecycleincludes________numberofphases.
(a) Two (b) Three
Q.18 Tosendbinaryoutputintheresponse,the (c) Four (d) Five
followingmethodofHttpServletresponsemany
beusedtogettheappropriateWriter/Stream Q.27 Howtosenddataingetmethod?
object. (a) usingGETmethodinrequest
(a) getStream() (b) getOutputStream() (b) usingRequestingURL
(c) getBianaryStream()(d) getWriter() (c) usingResponseURL
(d) usingURL
10 0
Advanced Java Programming (MSBTE) M6-3 MCQ - Servlets
Q.28 JSPlifecycleincludesfollowing Q.31 Whichclassprovidesstreamtoreadbinarydata
(a) TranslationPhase suchasimageet(c)fromtherequestobject?
(b) CompilationPhase (a) ServletInputStream(b) ServletOutputStream
(c) Requesthandlingphase (c) Botha&b (d) Noneoftheabove
(d) Allofthese Q.32 WhatisthelimitofdatatobepassedfromHTML
Q.29 JSPstandsfor_______. todoGet()?
(a) JavaServiceProvider (a) 8kb (b) 1kb
(b) JavaServerPath (c) 4kb (d) 2kb
(c) JavaServerPages Q.33 ThemajordifferencebetweenServletandCGIis
(d) JavaServerProgram _______.
(a) ServletsarethreadbasedandCGIisprocess
Q.30 Theauthenticationmechanismintheservlet
based.
specificationusesatechniquecalled?
(b) ServletexecutesslowerthanCGI.
(a) RoleBasedAuthentication
(c) ServlethasnoplatformspecificAPIwhereas
(b) FormBasedAuthentication
CGIhas.
(c) Botha&b
(d) Allofthese
(d) Noneoftheabove
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