You are on page 1of 10
pom 3 — = graphics class which method is useq angle withthe specified width ang public void drawRecttint x, height) ublic abstract void filRect( (0) ath, int height) saipens public abstract void drawLine| int x2, int y2) (@)_ public abstract void drawoval width, int height) Mi. to draws a th and height? int, int width, int inty, int @ int x2, int ya, Kint x, int y, int implement the Listener interface and overrides its methods is required to perform in event handling? fe) Tue (b) False 7 s x public class MenuBar extends A Seer 4 Je MenuComponent (b) — MenuContainer {9 ComponentMenu (d) — MenuBar which of the following is true about AWT and swing components. (a) AWT components creates a process where as swing components creates a thread AWT components creates a thread where as swing components creates a process Both AWT and Swing components creates a process A ) @ (4) Both AWT and swing components creates a thread Panel is defined as . a) The Panel class is a concrete subclass of Container. ‘A Panel is a window that does not contain titlebar, menubar and border. Panel is a superclass of Applet. Allof the above. (b) (0 () 2 What is API? (a) Application Programming Interchange (b) Application Programming Interaction (0) Application Programming Interface (2) None of these 13 What is default layout for Dialog? 4) Flowtayout —(b)_ GridLayout (2) Cardtayout —_(), ‘BorderLayout M24 Which method is used to count the number of items is the List. | (a) getitem() getSelecteditem| ) getCount( ) (b) (c) getitemcount() — (d) — -2 7 — 25 _the correct hierarchy or Hi forPanelis_ 7 Component ~ Container - Window — Panel ta Component - Container — ‘Applet - Panel Component - Container - Panel (8) Container ~ Co mponent — 26 ponent — Panel . ‘Which is the correct constructor of GridLayout. (3) Gridtayout(int a) (b) GridLayouttint num_rows, int num_columns) (6) Gridtayouttint rows, int cols, int vert) (4) Gridtayouttint hor) 27 What are the types of DialogBox? 1 (a) Modal DialogBox {b) Modal and Modeless DialogBox (2) Modam {d) None of the above. Q.28 In the give constructor what third parameter indicates : ScrollBar s = new SerollBar(0,10,20,0,1000); (2) sieofthumb ——_(b) ( (@) 29 Which class is used to represent a single line textbox with password character facility? (a) TextField {b) Textarea (c)_ Label (a) Checkbox To set the title to the Frame window method is used. (a) void setTitle(string str) (b) void setText(string str) (c) void settitiestring str) (a) None of the above minimum value Increment value Initial Value Q.30 0.31 o Suppose a Panel is added to a Frame and a Button is added to the Panel. If the Frame’s fontis set to 12 point Times New Roman, the panel's font is set 410 points Times New Roman and the Buttons font is not set. What font will be used to display the Button’s label? (a) 12 point Times New Roman (b) 11 point Times New Roman (c)_ 10 point Times New Roman (d) 9 point Times New Roman Q, 32 / Which of the following i true about FlowLayout? (a) FlowLayout can use multiple rows ifthe horizontal space in the container is too small to hold the component FlowLayout is the default layout manager of. panel and applet itis the default layout manager Both A&B. (b) for window. (0) (a) A Q.33. Which of the method can be used to output 2 u String invan Applet? (a) display() {c)_ drawstring( ) ced Java Programming (MSBTE} {b) print() (a) transient() positions are the components into 5 regions east, west, south, north, center. (a) Cardlayout —(b)_ BorderLayout () Gridlayout — (d)_FlowLayout What is API? (a) Application Programming interchange (b) Application Programming interaction (€) Application Programrning Interface (a) None of these am a.35 Q.36 Panels defined as SX (a) Panel class is container {b) A Panel is a window that does not contain a title bar, menu bar or border Panel is the superclass of Applet All of above concrete sub-class of (c) (a) Q.37 Which component of AWT provides compact, multichoice, scrolling component? (a) List (b} Choice (3) Panel _ (d) Textarea Q. 38" When there is a switching condition like ON or OFF, which control is used of following? (2) Button (b) RadioButton {c) ToggleButton (d) TextField “x Which method is used to set password character for a TextField? (a) setPasswordCharacter( ) {b) setEchoChart ) (c)_setPassChar( ) (a) setEchoCharacter( ) The getContentPane| ) method is of which class? “ (2) JApplet (b) JFrame (c) sButton (a) None of these Which class defines setSize( ) method? (a) Frame (b) Applet () Component (d)_ Panel is a swing class that allows to enter a single line of text. fa). TextField °K (b) JTextField Abstract Windowing Toolkit (AW” Q.43 Which Text Component method is used to set a ‘TextComponent to the read-only state? ' (a) Editable (b)Nonéditable {c)_ setEchoChar (d) set ditable 0.44 low would you set the color of graphics context called g to cyan? (a) g.setColor(*cvan”); {b) gsetCurrentColor(cyan); (c)_gsetColor("Color.cyan”}; {d)_gsetColor(Color.cyan}; 45 _Wihat Is use of second parameter in given constructor Lable(String,int) (a) specifies height of label (b) specifies width of label in terms of pixel (c) specifies the alignment of text in label in ~~ terms of pixel specifies width of label (a) Q.46 _ The setBackground() method is part of which of a +L the following class java.awt package? (b) Applet (d) Graphics (a) Component () Object What does the following line of code do? “TextField tf = new TextField(10); (a) will set 10 to TextField as its initial text. JA} willset the character capacity t0 20 (c). BothA&B (d)_ None of These 0,47 Frame is a standard window, which is cof Window class from AWT hierarchy? (a) Derived class / Subclass (b) Base class / Super class 0.48 A. {c) Root class (a) Family class ao A is a passive AWT control that do K not generate any event? {a) Button {b) RadioButton (c) Choice (a) Label Q.50 The default layout manager of Frame is U~ (a) FlowLayout (b)BorderLayout (c) Gridtayout (d) Cardlayout Q.51 Which method is used to check the status of checkbox? (a) getStatus{) — (b)_getState( ) (c) isChecked() {d)_getChecked() (c) EdittextField (d) Textarea ced Java Programming (MSBTE) ‘ch of the following method is used to seta Fextcomponent t0 read-only mode? P fa) Editable() —(b) nontltabie() fe) setechoChart) (d) setéditabie) Mtg generates action events 2 Zaouble-clicked. Vine {e) Menultem which of the following does not have its def 154 jgyout as BorderLayout. ae (a) Frame (b) Dialog (ce) JApplet (2) All of Above Which of the following statement about GU} ‘component is wrong? (a). swing exists since the version 1.2 of the JOK (p) AWT stands for Abstract Window Toolkit (c)_ You cannot place AWT component on container. ‘The AWT classes are deprecated, when an item (b) Checkbox (d) TextField swing (a) 156 Which of the following package is used for s< Graphical User Interface? (a) java.applet (b) {c)_ java.awt.image (a) 7_ Sat are the variables detinedn Dimension? (a). length and width (b) height and length (o)_ height and width (d)_ None of these 7 a AWT component is not editable? * (a) Button (b) TextField () Flowtayout (4) Label ps _Saeet text of Label can be obtained using java.awt java.io {a) setAlignment()(b) getAlignment( ) (c) getText( ) (d) setText() 60 es method 'e MenuBar mb. fa) mb.addMenultem(m) (b)mb.additem(m) (2) mb.add(m) places a Menu m into (6) None of these Which of these Components cannot be added to fame? (2) Labet {b) Button (2) CheckboxGroup (d)_—_Allof above Abstract Windowing Toolkit (AWT) 62 a What is use of second parameter given in Label constructor : Label(String, int) 2). Specifies height of label in terms of pixels. (b) specifies width of label in terms of pixels. (6) specifies the alignment of text in label in terms of pixels. Specifies maximum numbers of characters in label. (a) .63 Which of these classes can be added to any Container class, using the add method defined in Container class? (a) ) Button (b). CheckboxMenultem Menu (d) MenuBar Q.64 What is the use of setEchoChar( ) method? ~~ §)_ toset echo in symbol form {b) to set char in symbol form (c) Botha&B (4) to create password in symbol form 65 uw method returns currently selected item in choice. (a) getSelécteditem() (b) getSelectedElement( ) (c) getSelectedindex( ) (¢) getitem() Q.66 _.Which statement with respect to inner class is Sg tive: A tis a way of logically grouping classes that are only used in one place. 8 c. Itincreases encapsulation. Itcan lead to more readable and maintainable code. (a) Only A statement is true. (b) Only B statement is true. {c)_ Only C statement is true. (4) AIIAB and Care true. Q. 67_/ The default layout of Applet is (2) Gridtayout —(b)_Cardtayout (c) Flowlayout (a) BorderLayout Q.68 Java Applets are used to create applications. (3) Graphical (b)_ user interactive (2) Bothaas (4) None of these ——— Qa Qaz Qa as Qé ef True az Give the abbreviation of AWT? (a) Applet ‘Windowing Toolkit stract Windowing Toolkit \ @ Absolute Windowing Toolkit (d) None of the above Which is the container that contain title bar and can have MenuBars. It can have other components like button, textfield etc.? (a) Panel () Window Frame {) Container Which is a component in AWT that can contain another components like buttons, textfields, labels etc.? (a) Window (8) Container (2) Panel (d) Frame AWT is used for GUI programming in java? (9) True (b) False Which class provides many methods for’ ‘graphics programming? (a) java.awt (b) java.Graphics ‘| java.awt.Graphics (d)_ None of the above These two ways are used to create a Frame By creating the object of Frame class (association) By extending Frame class (inheritance) (b) False Which is the container that doesn't contain title bar and MenuBars. It can have othér tomponents like button, textfield etc? Abstract Windowing Toolkit (AWT) as Cee nee ee Which are passive controls that do not ‘support any interaction with the user? (2) Choice (b) List Labels (a) Checkbox Q.10 By which method You can ‘set or change the text in a Label ? 1-15) setText() (b) getText() {c) BothA&B — (d). None of the above i Q.11 Which class is used to create a pop-up list of items Q12 Q,13, Q14 from which the user may choose? fa) List Aer choice (0) Labels (a) Checkbox Which object can be constructed to show any number of choices in the visible window? (2) Labels (b) Choice ler List (0) Checkbox ‘Which is used to store data and partial results, as. well as to perform dynamic linking, return values for methods, and dispatch exceptions? (a) Window {b) Panel Frame {d) Container The following way is used to create a frame is by creating the object of Frame class? (a) inheritance (b) association (c) BothA&B —(d)_ None of the above AWT more powerful components like tables, lists, scroll panes, color chooser, tabbed pane etc.? (a) True (b) False These four methods commonly used in? (i) Public void add(Component c) (a) Window (b) Frame public void setSize(int width,int height) Panel ()'| Contajner (ili) public void setLayout{LayoutManager m) a How many pes pf conto dog A supports iv) public void setVisible(boolean) a these-Controls are sub srs conor ? fa) Graphicscass (b) Component class fa)/7/ () 6 / (c) BothA&B — (d) None of the above Jo 3s (a) 8 _ Aavanced vava rruyrannimiy vs: Q1 (b) QI (c) Q.17 (b) Q.25- (c) Q.33 (c) Q.41 (c) Q.49 (a) Q57 (c) Q65 (a) Q2 (b) Q.10 (a) Q.18 (a) Q.26 (b) Q.34 (b) Q.42 (b) Q.50 (c) Q.58 (b) Q.66 (d) Q.3 . (b) Q.11 (b) Q.19 (a). Q.27. (b) Q.35 (c) © Q.43 (d) Q.51 (b) Q.59 oo Q.67 (c) a4. (a) §Q.12 (c) 0.20: (c) Q.28 (a) Q.36 (d) Q.44 (d) -Q.52. (d) Q.60 (c) Q.68 (c)” Qs (c) Q.13 (c) Q.21 (d) a.29 (a) i -Q.37 (a) Q45 (c) Q53 (c) Q.61 (c) Q.6 (a) Q.14 (b) Q.22 (c) Q.30 (a) Q.38 (c) Q.46 (a) Q.54 (d) Q.62 (c) Q7 (c) Q.15. (a) Q.23 (a) Q.31 (c) Q.39 (b) Q.47 (b) Q.55. (c) Q.63 (a) Qs (a Q16 (b) Q.24 (c) Q.32 (y) 240 (4) 48 (a) Q.56 (b) Q.64 (c) De Reraccente ACen ee =e ing specifies the advantages of i i te Supports pluggable look and feel. i + Tyows MVC (Model View Controller) architecture. swing (b) AWT {9 BAhA&B — (d) None ofthe above ings not a part of JFC Java Foundation Classes) | /patis used to create GUI application ? Ya) Tue, (b) False swing Component classes that are used in | encapsulates @ mutually exclusive set of buttons? / (qj Abstract Button(b) Button Group {) sutton (a) Imagetcon | The Java Foundation Classes (JF(c) is a set of GUI components which simplify the development of ison applications ? (a) True Oh Fale ; Which package is used for import the swing ponents ? (2) javaswing —(b)_java.awt (2) javaxswing - (d) All of the above, $ The String parameter to JButton constructor _. tell which region to put the JButton in, (b)_ tells the color of the JButton, (c)_ tells what text will appear on JButton, (4) tells what should happen when JButton is pressed. MVC architecture is (2)_ Modelling - visual - Controller (6) Model — view - Controller (2) Model ~ viewable - Controller (4) Many— View - Controller * Which package is used for imporing swing mMponents ? (2) java.swing (b) javax.swing (o)_avaawt. {d)_Allof the above 3 Inswing, Buttons are subclasses of which class ? (a) AbstractButton (b) JButton (c) Button (d) JRadioButton aw STree class belongs to which package? (a) java.awt (c) java.swing (b) java.applet (a) javax.swing ce component is swing represents data in row and columns? fa) JTextArea (b) JTable {c) JPanel (d) JtabbedPane 12 Which of the following is not constructor of JTree? (a) Mree(TreeNode tn) (b) sTree(Vector v) (c)_sTree(int x) (d) none of the above a3 class used to create node in tree. | ~ (a). TreeNode (6) DefaultMutableNode (c)_ DefaultMutableTreeNode (a) Node @.14 _ATabbedPane class is present in which package? (a) java.awt (b) java.swing (c)javaawtswing (d)_javax.swing @15 What is purpose of JTree? @ we {b) ic) (d) To show data in form of parent and child nodes. To show data in list view. To show data in tabular form. To show data in menu-bar. 216 What is the use of : Container getContentPane( ) ~~ |) Returns Container for a JDialog. (b) Returns a ContentPane for Menu i) Returns a ContentPane for Applet (d) None of the above = SF _Acvancod Java Programming (MSBTE) M MCQ'S 0" Onno Exam (d) Imagetcon Getimagetcon( ) 17 Which of the following method Is not applicable for Button in swing. (a) setDiabletcon( ) (b)setPressedicon( ) {c)__setSelectedicon( ) (d) setRotlOvertcon( ) icon of Button? la) Icon geticon{ ) {b) Imageicon getimagelcon( ) (c) Imagetcon geticon( ) Q1 (a) Q2 (b) Q6 (c) Q7 (b) Q.11 (b) Q.12 (c) Q.16 (c) Q.17 (c) Which of the following method is used to retrieve | Q.3 (b) Qs (b) Q.13 (c) Q.18 (c) From following list which ts not Swing clogs? (a) dabel {b) Button (c) Jimagelcon —(d)_JCheckBox Which component provides support for two-site buttons? (a) Button, Checkbox {b) sCheckBox,JRadioButton (c) Button, Menultem (d) JCheckBox, TextField Q4 (a) Q5 (c) Q9 (a) Q.10 (d) Q.14 (4) Q.15 (a) Q.19 (c) Q.20 (b) gat i Que: fe folowing 095 are reaured to perorm 11_/ARplement the Listener interface and overrides its methods Register the component with the Listener fa) Exception Handling (b) String Handling (_EventHandling (4) None of the above z fe “chic places can put the event handling code fa). Same class {b) Other class fe) Anmonymous class (@)_Allmentioned above which package provides many event classes ahd _ Aare terfoces for event handling? (a) java.awt (b) java.awt.Graphics {q) javaawtevent —(d)_ None of the above Jo-use the ActionListener interface it must be “ apes by a class there are several ways to do that find inthe following? (a) Creating a new class (b) using the class the graphical component (c)_ ananonymous inner class {@)_Allmentioned above is ‘ActionListener interface is ‘handling action events? (a) True (b) False js not used for \6 The ActionListener interface is used for handling it's used by 2 \_2aion events, For example: (b) sCheckbox {@) JButton {c) Allof these {d) JMenultem 17 Which class is used for this Processing Method process Action Event( )? laf Button, List, Menultem {b) Button, Checkbox, Choice (c}_Scrolibar, Component, Button Event Handling a 10 au / In Graphics class Which method Eka used to set the graphics current color to the specified color? (a) public abstract void setFont(Font font) (b) public abstract void setColor(Color ¢) (c) public abstract void drawStringtstring str, int x, inty) (d) None of the above Which of the following method is used to determine the type of adjustment event? (a) getType() (b) getéventType( ) (c)_getAdjustmentType( ) (d)_ getEventObjectTypel } Text Field generates event. a) ActionEvent,Itemévent (b) ActionEvent, TextEvent (c)_Serolivent,TextEvent (a) ActionEvent, Scrollevent void keyTyped (KeyEvent ke) called when a key on the keyboard is_____— {a) pressed and then released. (b). pressed {c)_ released (d) none of the above Which event is generated when the position of scrollbar is changed? (a) KeyEvent (c)_ ItemEvent (b) Mouseévent (d) Adjustmentévent The signature for the registration method for 2 ActionEvent should be (a) public vold addA ctiontistener(ActionEvent L) (b) public void setAction( Actiontistener U) {c) public void setActiontistener (Actiontistener uy (d) None of the above 1s Eve rn Ma. nt He, Aceneed ve ogerng SST jonent Event is the gy = istener (Actiontistener | a.24 Comp brea (a) public void addActiontiste ee . u .16 ‘Which of the following component generates \/ Adtionévent? (2) Window (b)_ RadioButton (c) Scrolltar (a): None ais method Is used to register 2 keyboard event listener. A (a). Keytistener( ) 7 (b) addkeyListener( ) (c)addkeyListenerEventt } (d)_eventKeyboardListener( ) Name the method defined in EventObject class Oe adres object generated from the event. (a) getEvent()’ (b) getObject() (c) getid() (a) getSource( ) 17 _The Mouselistener interface is used to make ‘mouse handling. (2) True (b) False 18 _ActionEvent is applied on (a) Frame (b) Checkbox, Choice, List (c) Scrolibar {d) Button, TextField, List, Menu 19 ComponentEvent isthe super class of (a) Focustvent — (b) MouseEvent (c) WindowEvent’ (d) All of the above 2.20 _ jFwe close an applet window events will be generated, (a) Actionévent (b) Componentévent (¢) AdjustmentEvent (4) WindowEvent G21 Which of the following component generate ‘ActionEvent? “(a) ScroliBar = (b)_ window () RadioButton (d) None of these & 22 _Which Listener handle all List related Events ? \—~ (a) Itemtistener (by Inputévent (€) Selectevent (d) Listévent .23 How to obtain the command na me ActionEvent? {or Invoking (a) getCommandName() (b) getActionEventCommand( ) ()_ getActionCmd( ) (d) _getActionCommand( ) a) ActionEvent (b) ItemEvene (e) Textevent (4). Allofabove 25 When we need to use Checkbox or item i list or use @ checkable Menu an generated. (a) ActionEvent () Menuévent is (b) ttemevent (d) ClickEvent 26 Which of the following constant isnot de, WindowEvent class? HOt defined iy (2) WINDOW_ACTIVATED (b) WINDOW_CLOSED (¢)_ WINDOW_DEICONIFIED (d) None of these 27 Which of the following isn oP tending window ever? ot he meth of (0) void windowClosed(Windowevent we (8). void windowClosing(Windowtvent we) (0) void windowaterCesing( Window uy (4) Allof these @.28 Which method is used to process mouse ik? ee (2) public void mouseClicked(Mouselistener mn) (b) public void mouselsClicked(MouseEventm) (€) public void mouseclicked(MouseEvent m) (8) public void mouseClick(MouseEvent m) Which class is used for this processing method _ProcessActionEvent( ) method? \—" (a) Button, List, Menuttem (6) Button, Checkbox,Choice {c) _ScrollBar, Component, Button (4) None of the above, 30 Which of this package contains all the clases ad ~ Methods required for event handling in Java. 29 ‘~~ a} javaapplet (6 java.awt (c) javaevent — (d)_java.awtevent 31 Name the method defined in EvenObject clas tt _~Teturns the object generated from the event. (a) getEvent() — (b)_getObject!) ()_ getia() {d) getSource( ) Which of these interfaces define a mebtl actionPerformed{) \“a)Componentuistener (b) . Containertister™ (c)_ ActionListener (d) InputListener Qaz Eee ie ee rete cee .d Java Programming (MSBTE) 3-3 gon control implements. following listener interface. fa) emustener (b) ActionListener jowlistener (d) Adapter a3 @ F jing the closing button vfa)_ Itemevent {b) windowEvent {g, MouseMotionEvent (a) ComponentEvent = whic of the following method must be a Gyerridden in the order to handle KeyEvent. (a) keyPressed{KeyEvent obj) (b)_ KeyReleased(KeyEvent obj) (@)_KeyTyped(KeyEvent obj) (d)_ Allof these a3 0.39 Which of these methods can be used to know the degree of adjustment made by the user? a) getValue( ) (0) getAdjustmentType( ) Evont H (c) getAdjustmentvalue( ) {d)_ getAdjustmentAmount() MouseEvent is subclass of which of the following class ? (a) Componentévent (b) ContainerEvent {c)_ temevent (2) Inputévent EN a1 (9 a2 @ a3 © as a7 @ a8 Ww) Quit (ek 242 (d) 033 Q.16 (d) Q.17. (a) 18 (d) zt (@) 02 (2) 223 ©) 26 (4) 027 @ 28 (c) ast (a 032, 038.0) hes oad) ode) The ____is an object that is notified when an event occurs. (a) Listener {b) Sources (c) Event [d) None of the above What is the use of String getActionCommand( ) method of ActionEvent cass? (a) to obtain the label(caption) of Button {b) to obtain the reference of Button {c)_ to obtain object of Button (d) to obtain the label(caption) and object of Button aa (d) OS. (b) Q9 (c) Q10 (b) ais (4) ats tb) a19 (4) 20 (4) 0.24 (d) 225 () 29 (2) 2:30 (¢) 0,34 (b) O35 (d) ie Q39 (2) aaa

You might also like