ADV Java Mcqs PDF

You might also like

Download as pdf
Download as pdf
You are on page 1of 16
Question Bank (G scheme) Name of subject: ADVANCED JAVA PROGRAMMING Unit Test :} ‘Subject code: 17625 Course : CM/IFEG Semester: VI CHAPTER 1 : Introduction to the Abstract Windowing Toolkit (AWT) anid Swings (24 Marks) Q1. Which of the following class is derived from the container class? (a) Component oT Panel () MenuComponent (a) List Q2.Name of the class used to represent a GUI application window, whic! resizable and can have a title bar, an icon, and menus. {a)Window (b)Panel {c)Dialog \diframe Q3.Which abstract class is the super class of all menu related classes? \UsrMenuComponent —_(b )MenuBar {c)Menultem (4) CheckboxMenultem Q4, Which of these classes can be added to a Frame component? (2)Menu (b)Button (Window —_(d)Applet Q.5 Which can be used to represent a checkbox with a textual label that is optionally ‘can appear ina menu? (a)MenuBar (b)Menuitem ke CheckboxMenultem (d)Menu Q.6 Which of these classes can be added to any Container class, using t defined in Container class? {a)Button _(b) CheckboxMenultem {Menu (d) MenuBar 0.7 Package of drawString() method is (ajjava.applet_ —_(b)java.io {ojjavax.swing \Adfjeva.awt .8 Which methods executespnly once? {a)start{) method v¥sfinit() method {c)stop() method —(d)java.awt je add method 9 Object which can store group of other abject is caled_ WisfColecton object (tava object (Package ——_(d) Wrapper | 410 Al collection classes are availabe in {aljava.o package (ujvaang package (c)javaawt package (java.util package | 411 Tread ass aval {a java.io package (b]java.lang package (Gljavaawt package —dfva.util package Q.12 Minimum threads ina program are vait’ (le (a5 (aiMany 0.13,T meaning, (@liavatn Time Gaff in Time (Coin InTime [d)None ofthe Above 0.14 rogram wich executes applets known as_ ‘Vesipplet Engine. (bVirtual machine . (QVM (6) None ofthe Above Q.15 Inmain(method, datatype of parameter is__ {alint—(b}ehar spe Sing aloud 0.16 How many keywords (approximately are avaliable in java? } (May vary from version to version) (a) 32 (b) 39 Ver (15 Q. 17 Smallest individual unit in java program is known as___ {afstring (b)literal verTken (d)Operator 0.18 What does A WT stands for? (alAll Witing Tools UbAbstract Window Took (ej Abstract Writing Toolkit (d)AL Window Tools (19h thee atc esto ow wey ese VetfetMoien) —(bgetActionty {cj getdcionévent() HEE KerO 20 Which of the following statements about GUI components is wrong? {a) Swing exists since version 1.2 of the jdk {b) You cannot place AWT components on Swing containers (c) AWT stands for Abstract Window Toolkit The AWT classes are deprecated. ©. 21 Package is the first program in java. (a) True (b) False Q. 22 What do you mean by javap ? \Llay Tava disassemble (b) Java interpreter (c)Java compiler (d) Java debugger Q.23JVMisa__for byte code. Uartaterpreter (b) Disassemble (c)Compiler _(d) Debugger €.24 in applet, which of the following is used for accepting user defin {a) Body (b)Centre (c)Applet_ \ie}®aram (Q.25 What is runnable from following: (a) Class (b) Method " bl id parameter? pb4tertaca—{o} vara 10.26 Which of the following applet class displays the result of the applet code on the screen? Uarpainta —(b) void {elstringo (a) getkeyO 2.27 Onwhich side applet always executed? (a) Server side ypfClient side @. 28 Which of the following file is AP! document? {a) Hit (b) Java {c} Text (d) Doc «28 whats another coe ova ntermedat code? (able code. USFByte code (c)Referenee code —_(d) None of the above {0.30 Which stage language java is known as ? (a) Zero uo Two {e) Four (4) Eight 0.31 Which keyword is used to implement interface in the class? \larinplements (b) implement (cbinterface (a) extends Q. 32 In java, gei){i-e. garbage collector) metho« {a)javalang — (b)java.io {c)java.util (d)java.awt available in which pagkage? Q. 33 Vector class is available in. (a) java.io pacakage Wb} ava.util package (c) java.tang package (d) java.sql package Q.34 Which of the following terms are included inside the package? {a} Classes (b) Methods (clinterfaces. YdTAllofthe above. 0.35 isit possible to write nested try ? \prtes (b) No €@.26 Which method cannot be overtiden? fa) rina (2) print (escant gia (0.37 In which package, thread class is available? (a) Java.util_(b) Java.io ‘LieFiavalang (a) Java owt 0.38 Swing components that don't rely on Native GUI are refferedlto as la}tiethweight component (bJheavy weight component (¢)GUI component {d) Non GUI component Q. 39 What is jdb ? \UleTiava debugger (b) Java interpreter {(c) Java compiler (d) Java disassemble Q. 40 Isit possible to declare method of the interface as private? partes (b) No Q.41 Why we need to write static keyword to main method ? {a) It gives access to other methods {b) Itisin syntax {c) To create single copy {d) None of the above Q.42 “All methods of the interface are public and abstract.” vay True (b) False Q. 43 What is the latest version of dk ? (2)2.9 (b)7 (d) 1.6 Q. 44 Ifa class contains one or more abstract methods ther declared as (a) Final (b)static \JerMbstract_(d) Any of the above ‘Q.45 Which of the following command is used to compile java pros (a)Java—_(b) Javap (c)Javaq ULeTavac Q46. It is possible tocreate object of interface? (a)Yes ito am? Q.47. When applet is dead, it automatically invokes the__meth We quit the browser. (a)paint() (b) stop() ePestroy() (A) Final() @.48 In which process we create exact copy of the e (a) Overriding _(b) Overloading JerCloning (d) Cloping Q.49 Jar stands for. \UieTiava archived (b) Java array {c) Java architecture (d) None of the above }d when 0,90 API stands for, i (a) Application Programming infrastructure {Ulby"Application Prograsnming interface (c) Advaniced Programming interface {(d) Hone of the above .51.What layout manager shuld You use 40 that every componentiresuples the same size in the container? (a) 9 Flow Layout (b)-4nd Layout (¢) Border Layout (d) any Layout 0.52 bxecutable applet le nothing but __ file of the appfet, (a) txt (b) Java lass (id) tr {a) Component (bContainer €.52.can you use setBackground|) method to set the bectysound: jorfor_? (c) sSComponent (d) All three 0. 54 In which package, exception class is available? fra.lang (b)java.util (c) java.io (d)java.avt 55. Arguments passed via command line are stored as_ data ty {a) argument (b) double yrAring (4) integer 7.56 Object which can store group “OF Thier Object 15 KnOVIA: as (alJava object (b) Package ieee sleaTlection object (d) None of the above asTAG _ (2) uses buttons, menus, and icons (b) should be eavy for a user to manipulate {c] stands for Graphic Use Interaction. Uartiath (a) and (0. Q. 58 An object is composed of : {a) Properties (bjtfethods (chEvents arf the above Q,.59 Which Is a component in A WT that can contain another | components like buttons, textfields, labels etc. ? (a) Window. Xb}céntainer | (c)Panel (d)Frame .60 The Swing component classes that are used in encapsulate a mutually exclusive set of buttons ? (a) AbstractButton [b}CittonGroup {c)sButton (4) imegelcon 1.61 The Java Foundation Classes (JFC) Isa set of GU! components which simplify the development of desktop applications? Apr ie (b)False 62.70 specify font to be Bold and Italic use font style value {a) Font PLAIN (b) Font. BOLD {e) FontITALIC {J)F6nt.B0LD +Font ITALIC Q.63 In Graphics class, Which method is used to set the graphics cu To the specified color? a Public abstract void setFont(Font font) Lb Public abstract void setColor(Color c) ‘¢ Public abstract void drawString(String str,int x,int y) d None of the above 0.64 In Graphics class,which method is used to draws a rectangle w/ ‘Width and height? iBTic void draw Rect(int x, int y, int width, int height) {bJpublic abstract void fillRect {int x, th, int height) {c)public abstract void drawLine(int x1, int yA, int x2, int y2) (@)public abstract void drawOval\int x, int y, int width, int height) Q.65 Which of the following is used to interpret and execute Java Aff Hosted by HTML? Ualappletviewer —(b)Appletscreen {clAppletwatcher _(d)Appletshow 0.66 Which of these classes encapsulate run-time state of an object ‘UsiCTass — (b)System . | (Q)Runtime (d)Cache frent color th the specified _ plet Classes. | | | Q.67 The relationship between a parent class and a child class is referred to As a(n). relationship. {a)is-a (b )was-a (c)has-a \{d4ifistance-of (e) alias .68 Java does not support multiple inheritance, inheritance are available by. implementing interfaces bb creating aliases ¢ importing classes d using public rather than protected or private modifiers 0.69 Java applet are used to create applications. (a}graphical _(b)user interactive \c}toth (a) and (b) (d)none of the above Q.70. The various controls supported by AWT are: {a)Labels, push buttons (b)Checkboxes, choice list {c)Sergll bars, text fields, text area I of these CHAPTER 2 :Event Handling(20 Mark but some of the abilities of multiple ai package contains all the classes and methods required Event handling in java. (a) java.applet —(b) java.awt (c) java.event sree. awt.event 0.2 What is an event is delegation event model used by Java prog Language? {aiff event is an object that describes a state change in a sourcs {b) An event is an object that describes a state change in a proc (c) An event is an object that describes any change by the user a| system {dyn event is a class used for defining object, to create events. Q. 3 method are used to register a Keyboard event listener. istenerO (b) addKistenerO jor mming sing. id loridaKeyListenerO (qd) eventKeyboardListenerO Q4____ method are used to register a mouse motion listener. (a) addMouseO (b) addMouseListenerO Lfo}raMouseMotionListnes («) eventMouseMotionListenerO Q.5 What is listener in context to event handling? (a) A listener is a variable that is notified when an event occurs, Fstener isa ‘object that is notified when an event occurs. (©) Allistener is a method that is notified when an event ‘occurs. (a) None of the mentioned Q. 6 In which library event class is defined ? (a) javaio ybyfava.util (©javalang (@) java.net 0,7 Which ofthese methods can be used to determine the type of event? {a getSoureeO (0) etéventO UetTRUDO (6) getventObjetO —rsopercisrofatttheever UatérentObjeet (b) EventClass {c) Aetionévent (d) ItemEvent Q.9/f scroll bar is manipulated. ‘event will be notified. {a} AetionEvent —_(b) Compor yentEvent Usheusimentevent Vp Windowevent {2.101 we close an applet’s window generated. __event will be (a) Actionevent (8) Componentvent [eAdjstmentvent ndowevent {11 which ofthese events Is generated when a button is pressed? tionevent () KeyEvent {c] Window Event (d) AdjustmentEvent Q. 12 _method can be used to obtain the command name for invoking Action€vent object. {a) getCommand() _ (bygetActionCommand() (c) getActionEvent() (d) getActionEventCommand|() ‘Q. 13 Which of these are integer constants defined in ActionEvent cl4ss? (a) ALT_MASK — (b) CTRL_MASK (c)SHIFT_MASK (g)Atofthe mentioned Which of these methods can be used to determine type of Evert Ualsetio() —_(b)getSource() {c) getEvent() — (d) getEventObject() 1s method can be used to determine the type of adjustmept event. (a) getType() (b) getEventType() UsrattadjustmentType() (d) getéventObjectType() Q.16 _method can be used to know the degree of adjustment mage by the user. lareAvalue() —_(b) getAdjustmentTypet) {c) getAdjustmentValue() (d) getAdjustmentAmount() Q.17.what are the KeyListener Interface? (a) keyPressed (b) keyReleased {c) keyTyped (d) All three. 0.18 Which of these constant value will change when the button at the end of scroll bar was clicked to increase its value? (a) BLOCK_DECREMENT {b} SLOCK INCREMENT {c) UNIT_DECREMENT INIT_INCREMENT 0.19 When the size of component is changed, __ event is generated. \fayComponentEvent (b) ContainerEvent | {c)Focusévent —(d) InputEvent Q. 20 When the component is added or removed ? Which of these e fonts is generated ? (a) ComponentEvent tbyContainerEvent {c) FocusEvent (4) InputEvent @.21._ method can be used to obtain the reference to the container that generated a ContainerEvent. {a} getContainerO _(b) getContalnerCommandO {c) getActionEventO 3} fetContainerEventO ollbar always providing the vertical s is_NEEDED Q.22.\Which Is the constant used for (B)VERTICAL _SCROLLBAR {a) VERTICAL_SCROLLDAR_ALWAYS Ansib 23.Which Is the method used for WindowsClosing Event? {a}windowOpened() (b)windowClosed() \ferrindowClosing!) (2) windowDeactivated() Q,24____event is generated when c (a) ComponentEvent (b) ContainerEvent etocusévent (d) InputEvent Q.25 FocusEvent is subclass of which of these class ar ComponentEvent (b) Containerévent (c) ItemEvent (d) InputEvent ‘omputer gains or losses input focus. ses? 0.26 ___can be used to know the type of focus change. {a) typeFocus() (b) typeEventFocus() uleltsTemporary() (d) isPermanent() is superclass of Container Event class. Q27, apie (c) Itemevent (4) InputEvent Somporrenteventt 0.28 Which of the following method can be used to obtain the coowinates of amouse? ZetPoint|) (b) getCoordinates() {c) getMouseXY() (d) getMouseCordinates() 0,29___method can be used to change location of an event. (a) ChangePoint(). L¢sfTranslatePoint() {c) ChangeCordinates() (4) TranslateCordinates() 0,30 Which of the following is integer constants of TextEvent class?| (a) TEXT_CHANGED (b) TEXT_FORMAT_CHANGED {AEF TEXT_VALUE_CHANGED (a) TEXT_SIZE_CHANGED a. 31____ Is used to obtain the object that gen (3) getMethod!) Ubygetwindow() [a getWindowEvent() (d) getWindowobject() syent is subclass of which of these classes? 0.32 Mouset\ (a) ComponentEvent (b) ContainerEvent {c) temevent fa} Mputevent 0.33 __ method is used to get x coordinate of the mouse. Zixo —_(b) getXCoordinateO {e} getcoordinatex0 (d) getPointxO 0.34 Which of these are constants defined in windowEvent class? (a) WINDOW_ACTIVATED {b) wINDOW_CLOSED (c) WINDOW _DEICONIFIED Way of the mentioned ‘of Window Event class. a. 35___ is superclass ‘amponentevent i window {c) temEvent (d) InputEvent ve ese packages contains al the event handling int (b) java.awt java.event @.36 Which of ths (a) java.lang, lerjad awtevent (8) 037 wh the event? (a) cam onenttistener Wy Containertistener | {e)Focustistener _(d)Inputtistener en a component is added to a container which of these int 0.38 __ interface define a method actionPerformed(). {a) Componenttistener (b) Containertistener \prActiontistener(d)Inputtistener .39.Which method Is used to set a (a) seticon() (b)setimagel) fe}getimage() (d)seticontmagel) 1 icon to an Label? erated a Window Event. jaces? faces handles ‘Q. 40 _ interfaces define a method itemstateChangedl) {a) Componenttistner (b)ContainerListener {c) Actionlistener fd}temtistener Q.41 Which method from the following methods will respond when button by mouse? (a) mouseClicked!) (b) mouseEntered!) (c) mousePressed() (g)ATFof the mentioned Q. 42. methods will be invoked if a charaeter is entered, (a) keyPressed() (b) keyReleased() \oreTypedl) (a) keyEnteredt) 0.43____methods is defined in MouseMotionAdapter class- GuseDraggedl) (b) mousePressedt) (c)mouseReleased() (d)mouseClicked() {@.44:Which method is used to have rllover icon? (a)setDisabledicon() _(n)setDisabledl) {c) setRollover() (d)setRollovericon() as, js the superclass of all Adapter classes. UsrApplet (b) Componentévent (c)Event —(@) InputEvent Q.46 In Java, events are all the activities that occur between: {a)The user (b) The application ictBoth {a) and (b) (d) None of the above Jou click any 0.47 EventObject class belongs to: aHva.util (b)javaawt {ch javaiang (a) javasa! (0.48 The Component class is an abstract class and s0 is arg to create components. ‘ibclasses _(b)Superclasses (c)Both (a) and (b) * (d)None of these. Q.49 The AWT classes can be roughly categorized into the following {a)GUI component (b)Layouts {c) Graphics tools \fafAll of these Q.50 Window is used for. windows. {a)Creating — (b) Handling (o) Modifying {qth (a) and (b) used |groups: Q.51 The. inter is rface is used to handle th | {a} Containertistener (b) Focustistener a \JoAttionListener (a) WindowListner Q.52 The constructor that is defined by the Text Event clas is: ‘lar Textevenat (Object source, int event_type ) (b) textevent (Object source, int event_type ) (c) textevent (object Source, float event_type) (d) textevent (Object source, string event_type) Q.53 The name of the event classes are: (a) ActionEvent, ComponentEvent (b) ContainerEvent, FocusEvent (c) Itemevevt, KeyEvent VAGTAll of these 54 Java packages such as___ support the Event handling mechan. {a)Java.util — (b) Javaa (c)Java.awt.event (UYATTof these 1.55 An event is generated when the internal state of the event sourf> (a) Not changed Yb7 Changed (6) Either changed or not (d) None of these. 0.56 The____ interface handles list events: (a} Containerlistener of Tembistener (c) Focustistener__(d) ActionListener. 0.57 Which ofthe following are true? {a} The event-inhertence model has replaced the event delegation model. {b) The event-inheritance model is more effcient than the event-delegation model. ‘ Event Delegation Model uses event listeners to define the mathods of event Handling ‘lasses {d) The event delegation model uses handlefvent!) method to suppoft event handling, 0.58 Which ofthe followings the highest clas in the event-delegatlpn model ? (a) java.util Eventlistener Upp ava. util.EventObject (¢) java awt.A WTEvent (¢) java.awt.event.A WTEvent 59 when two or mare abject are added as listeners forthe same fent, tees which listener is first invoked to handle the event? ‘ (a) The first object that was added as listener. | (b) The last object that was added as listener. a eritere is no way to determine which listener will be woked first. {d) It is impossible to have more than one listener for 2 given event. Q. 60 Which ofthe following are true? (a) A TextField object may generate an ActionEvent. (b) A Button object may generate an ActionEvent. () A Menultem object may generate an ActionEvent. \ATAll of above Q..61 Which of the following are true? (a) The MouseListener interface defines methods for handling mouse clicks. (b) The MouseMotionListener interface defines methods for handling mouse clicks. (c) The ActionListener interface defines methods for handling the clicking of a button. saroption (a) and (e) 2.62 Suppose that you want to have an object “eh” to handle the| TextEvent of a TextArea object. How should you add eh as the every handler to it ? Pidiiadeic ih {c) addTextlistener(eh.t); (d) addTextListener(t.eh); 0. 63 What is the preferred way to handle an object's events in Javg 2? {a) Override the object's handleEvent( ) method. id one or more event listeners to handle the events. (c) Have the object override its processEvent() methods (a) Have the object override its dispatchEvent() methods. Q. 64 Which of the following are true? (a) A component may handle its own events by adding itself as an event listener. (b) A component may handle its own events by overriding its event-dispatching method. | {c) A component may not handle its own events. [Jar Option (a) and (b) {.65 The event delegation model, introduce in release 1.1 ofthe ‘DK, is Fully compatible withthe event model. fa)True fo) False plas tat has executed enableévents 8° event canmot also use ‘event. Q. 66 A component sul ‘enable processing ofa certain kind of ‘an adapter as listener forthe same kindof (a) True (p} False

You might also like