Assignment Chapter 1MCQ
Assignment Chapter 1MCQ
Q. 2 Which is the container that contain title bar and can have MenuBars. It can have other components
Q. 3 Which is a component in AWT that can contain another components like buttons, textfields, labels
etc.?
Q. 6 These two ways are used to create a Frame By creating the object of Frame class (association) By
Q. 7 Which is the container that doesn't contain titlebar and MenuBars. It can have other components
likebutton, textfield etc?
Q. 8 How many types of controls does AWT suppofis these controls are subclasses of component?
Q. 9 Which are passive controls that do not suppofi any interaction with the user?
(c) Labels
(d) Checkbox
Q. 11 Which class is used to create a pop‐up list of items from which the user may choose?
Q. 12 Which object can be constructed to show any number of choices in the visible window?
Q. 13 Which is used to store data and pafiial results, as well as to pefiorm dynamic linking, return values
(a) Window
(b) Panel
(c) Frame
(d) Container
Q. 14 The following way is used to create a frame is by creating the object of Frame class?
Q. 15 AWT more powefiul components like tables, lists, scroll panes, color chooser, tabbed pane etc.?
Q. 17 In Graphics class which method is used to draws a rectangle with the specified width and height?
(b) public abstract void fillRect(int x, int y, int width, int height)
(c) public abstract void drawLine(int x1, int y1, int x2, int y2)
(d) public abstract void drawOval(int x, int y, int width, int height)
Q. 18 Implement the Listener intefiace and overrides its methods is required to pefiorm in event
handling?
(a) MenuComponent
(b) MenuContainer
(c) ComponentMenu
(d) MenuBar
Q. 20. Which of the following is true about AWT and Swing components?
(a) AWT components creates a process where as swing components creates a thread
(b) AWT components creates a thread whereas swing components creates a process
Q. 21 Panel is defined as .
(b) A Panel is a window that does not contain titlebar, menubar and border.
(a) FlowLayout
(b) GridLayout
(a) getItem( )
(b) getSelectedItem( )
(c) getItemCount( )
(d) getCount( )
(a) GridLayout(int a)
(c) Modam
Q. 29 Which class is used to represent a single line textbox with password character facility?
Q. 31 Suppose a Panel is added to a Frame and a Button is added to the Panel. If the Frame’s font is
set to 12 point Times New Roman, the panel’s font is set 10 points Times New Roman and the
Button’s font is not set. What font will be used to display the Button’s label?
(a) FlowLayout can use multiple rows if the horizontal space in the container is too small tohold the
component.
(a) display( )
(b) print( )
(c) drawString( )
(d) transient( )
Q. 34 positions are the components into 5 regions east, west, south, nofih, center.
(a) CardLayout
(b) BorderLayout
(c) GridLayout
(d) FlowLayout
Q. 37 Which component of AWT provides compact, multichoice, scrolling component?
Q. 38 When there is a switching condition like ON or OFF, which control is used of following?
(a) setPas
(b) setEchoChar( )
(c) setPassChar( )
(d) setEchoCharacter( )
(a) JApplet
(b) JFrame
(c) JButton
Q. 42 Which Text Component method is used to set a TextComponent to the read‐only state?
Q. 43 How would you set the color of graphics context called g to cyan?
(a) g.setColor(“cyan”);
(b) g.setCurrentColor(cyan);
(c) g.setColor(“Color.cyan”);
(d) g.setColor(Color.cyan);
(a) Component
(b) Applet
(c) Object
(d) Graphics
Q. 46 What does the following line of code do? TextField tf = new TextField(10);
(a) Button
(b) RadioButton
(c) Choice
(d) Label
(a) FlowLayout
(b) BorderLayout
(c) GridLayout
(d) CardLayout
(a) getStatus( )
(b) getState( )
(c) isChecked( )
(d) getChecked( )
(a) Editable( )
(b) nonEditable( )
(c) setEchoChar( )
(d) setEditable( )
(b) Checkbox
(c) MenuItem
(d) TextField
Q. 54 Which of the following does not have its default layout as BorderLayout.
(a) Frame
(b) Dialog
(c) JApplet
(a) java.applet
(b) java.awt
(c) java.awt.image
(d) java.io
(a) Button
(b) TextField
(c) FlowLayout
(d) Label
(a) setAlignment( )
(b) getAlignment( )
(c) getText( )
(d) setText( )
(a) mb.addMenuItem(m)
(b) mb.addItem(m)
(c) mb.add(m)