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

A Bank (86 Questions) (Word) Copy

Uploaded by

donnoorain69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

A Bank (86 Questions) (Word) Copy

Uploaded by

donnoorain69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

AJP Question Bank

1. AWT stands for


a) All Window Toolkit
b) Abstract Work Toolkit
c) Abstract Window Toolkit
d) Abstract Window Text

2. How many layout managers defined in java.awt package?


a) 2
b) 3
c) 4
d) 5

3. Which method used to place some text in the text field?


a) getText(String str)
b) setText(String str)
c) putText(String str)
d) None of the above

4. Which are passive controls that do not support any interaction


with the user?
a) Choice
b) List
c) Labels
d) Checkbox

5. The various controls supported by AWT are:


a) Labels, push buttons
b) Checkboxes, choice list
c) Scroll bars, text fields, text area
d) All of these

6. Java applet are used to create_______applications.


a) graphical
b) user interactive
c) both (a) and (b)
d) none of the above
7. Which of the following is used to interpret and execute Java
Applet Classes Hosted by HTML?
a) Appletviewer
b) Appletscreen
c) Appletwatcher
d) Appletshow

8. Executable applet is nothing but __ file of the applet.


a) .txt
b) .java
c) .class
d) .html

9. When applet is dead, it automatically invokes the_____method


when We quit the browser.
a) Paint()
b) Stop()
c) Destroy()
d) Final()

10.Which of the following command is used to compile java


program?
a) Java
b) Javap
c) Javaq
d) Javac

11.Which can be used to represent a checkbox with a textual label


that can appear in a menu?
a) MenuBar
b) Menuitem
c) CheckboxMenuItem
d) Menu

12.Which methods in applet executes only once?


a) start() method
b) init() method
c) stop() method
d) java.awt

13.Which of these classes can be added to any Container class,


using the add method defined in Container class?
a) Button
b) CheckboxMenuItem
c) Menu
d) MenuBar

14.Which of these classes can be added to a Frame component?


a) Menu
b) Button
c) Window
d) Applet

15.Which of the following class is derived from the container class?


a) Component
b) Panel
c) MenuComponent
d) List

16.Which abstract class is the super class of all menu related


classes?
a) MenuComponent
b) MenuBar
c) MenuItem
d) CheckboxMenuItem

17.Package of drawString() method is________


a) java.applet
b) java.io
c) javax.swing
d) java.awt

18.Which method is used to count the number of items is the List.


a) getItem( )
b) getSelectedItem( )
c) getItemCount( )
d) getCount( )

19.Which is the correct constructor of GridLayout.


a) GridLayout(int a)
b) GridLayout(int num_rows, int num_columns)
c) GridLayout(int rows, int cols, int vert)
d) GridLayout(int hor)

20.Public class MenuBar extends ____________.


a) MenuComponent
b) MenuContainer
c) ComponentMenu
d) MenuBar

21.Which class is used to represent a single line


textbox with password character facility?
a) TextField
b) TextArea
c) Label
d) Checkbox

22.To set the title to the Frame window ________ method is used.
a) void setTitle(String str)
b) void setText(String str)
c) void settitle(String str)
d) None of the above

23.The default layout of Applet is _______.


a) GridLayout
b) CardLayout
c) FlowLayout
d) BorderLayout

24.Which of the following package is used for Graphical User


Interface?
a) java.applet
b) java.awt
c) java.awt.image
d) java.io

25.Which method is used to set password character


for a TextField?
a) setPasswordCharacter( )
b) setEchoChar( )
c) setPassChar( )
d) setEchoCharacter( )

26.Which component of AWT provides compact,


multichoice, scrolling component?
a) List
b) Choice
c) Panel
d) TextArea

27.___________ positions are the components into 5 regions east,


west, south, north, center.
a) CardLayout
b) BorderLayout
c) GridLayout
d) FlowLayout

28.What are the types of DialogBox?


a) Modal DialogBox
b) Modal and Modeless DialogBox
c) Modam
d) None of the above

29.What is default layout for Dialog?


a) FlowLayout
b) GridLayout
c) CardLayout
d) BorderLayout

30.Which method is used to check the status of checkbox?


a) getStatus( )
b) getState( )
c) isChecked( )
d) getChecked( )

31.___________ method returns currently selected item in


choice.
a) getSelectedItem( )
b) getSelectedElement( )
c) getSelectedIndex( )
d) getItem( )

32.Which of the following method is used to set a TextComponent


to read‐only mode?
a) Editable( )
b) nonEditable( )
c) setEchoChar( )
d) setEditable( )

33.Frame is a standard window, which is of Window class from


AWT hierarchy?
a) Derived class / Subclass
b) Base class / Super class
c) Root class
d) Family class

34.__________________positions are the components into 5


regions east, west, south, north, center.
a) CardLayout
b) BorderLayout
c) GridLayout
d) FlowLayout

35.The correct hierarchy for Panel is ___________________


a) Component – Container – Window – Panel
b) Component – Container – Applet – Panel
c) Component – Container – Panel
d) Container – Component – Panel

36.In the give constructor what third parameter indicates :


ScrollBar s = new ScrollBar(0,10,20,0,1000);
a) size of thumb
b) minimum value
c) Increment value
d) Initial Value

37.Java Applets are used to create applications


a) Graphical
b) user interactive
c) Both A & B
d) None of these

38._______________generates action events when an item is


double‐clicked.
a) List
b) Checkbox
c) MenuItem
d) TextField

39.What does the following line of code do? TextField tf = new


TextField(10);
a) will set 10 to TextField as its initial text.
b) Will set the character capacity to 10
c) Both A & B
d) None of These

40.Which component of AWT provides compact, multichoice,


scrolling component?
a) List
b) Choice
c) Panel
d) TextArea

41.Which class defines setSize( ) method?


a) Frame
b) Applet
c) Component
d) Panel

42.The method_______________places a Menu m into the


MenuBar mb.
a) mb.addMenuItem(m)
b) mb.addItem(m)
c) mb.add(m)
d) None of these

43.Which package is used for import the swing components?


a) java.swing
b) java.awt
c) javax.swing
d) All of the above

44.The String parameter to JButton constructor.


a) tell which region to put the JButton in.
b) tells the color of the JButton.
c) tells what text will appear on JButton.
d) tells what should happen when JButton is pressed.

45.MVC architecture is__________________


a) Modelling – Visual – Controller
b) Model – View – Controller
c) Model – Viewable – Controller
d) Many – View – Controller

46.In swing, Buttons are subclasses of which class?


a) AbstractButton
b) Jbutton
c) Button
d) JRadioButton
47.JTree class belongs to which package
a) java.awt
b) java.applet
c) java.swing
d) javax.swing
48.Which component is swing represents data in row and
columns?
a) JTextArea
b) Jtable
c) Jpanel
d) JtabbedPane

49.Which of the following is not constructor of JTree?


a) JTree(TreeNode tn)
b) JTree(Vector v)
c) JTree(int x)
d) none of the above

50.________________class used to create node in tree.


a) TreeNode
b) DefaultMutableNode
c) DefaultMutableTreeNode
d) Node

51.JTabbedPane class is present in which package?


a) java.awt
b) java.swing
c) java.awt.swing
d) javax.swing

52.What is purpose of JTree?


a) To show data in form of parent and child nodes.
b) To show data in list view.
c) To show data in tabular form.
d) To show data in menu‐bar.

53.What is the use of : Container getContentPane( )


a) Returns Container for a JDialog.
b) Returns a ContentPane for Menu
c) Returns a ContentPane for Applet
d) None of the above
54.Which of the following method is used to retrieve icon of
JButton?
a) Icon getIcon( )
b) ImageIcon getImageIcon( )
c) ImageIcon getIcon( )
d) ImageIcon GetImageIcon( )

55.Which component provides support for two‐state


buttons?
a) Button, Checkbox
b) JCheckBox,JRadioButton
c) Button, MenuItem
d) JCheckBox, TextField

56. What is the name of the Swing class that is used for frames?
a) Window
b) Frame
c) JFrame
d) SwingFrame

57.Which of the following classes in Java contains swing version of


an applet?
a) JButton
b) JCheckBox
c) JApplet
d) AbstractButton

58. Which of the following classes of Java swing extends Applet


class?
a) JButton
b) JApplet
c) AbstractButton
d) None of these

59.In Java swing, which of the following components is/are


represented by a rectangular area in which a component may be
viewed?
a) Scroll pane
b) Tabbed pane
c) Combo boxes
d) None of these

60.Swing elements are preceded by the letter


a) S
b) A
c) X
d) J

61.The following specifies the advantages of


It is lightweight.
It supports pluggable look and feel.
It follows MVC (Model View Controller) architecture.
a) Swing
b) AWT
c) Both A & B
d) None of the above

62.Which of the following method is not applicable for Button in


swing.
a) setDiableIcon( )
b) setPressedIcon( )
c) setSelectedIcon( )
d) setRollOverIcon( )

63.The Swing Component classes that are used in Encapsulates a


mutually exclusive set of buttons?
a) AbstractButton
b) ButtonGroup
c) JButton
d) ImageIcon
64.JButtons generate what type of event?
a) ActionEvents
b) ChangeEvents
c) WindowEvents
d) MouseEvents
65.Which of the following is false?
a) JFrame is a lightweight component.
b) JFrame is a subclass of Frame (which is a subclass of Window).
c) JFrames have a title bar and a border.
d) A JFrame window will look like all other windows displayed on that
platform.

66.What happens if setSize is not called on a JFrane (assume pack


is not called)?
a) The window is displayed at its preferred size.
b) It is a syntax error.
c) The window is not displayed.
d) Only the title bar appears

67.What code adds this JButton to this JPanel?


JPanel panel = new JPanel();
JButton button = new JButton();
a) panel.add(button);
b) button.add(panel);
c) frame.add(panel);
d) panel.add(JButton);

68.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 where as swing components
creates a process
c) Both AWT and Swing components creates a process
d) Both AWT and swing components creates a thread

69.Which method will cause a Frame to be displayed?


a) show ()
b) setVisible ()
c) display()
d) displayFrame ()
70.The ActionListener interface is used for handling action
events,For example,it's used by a
a) JButton
b) JCheckbox
c) JMenuItem
d) All of these

71.The Following steps are required to perform ____


1) Implement the Listener interface and overrides its methods
2) Register the component with the Listener
a) String Handling
b) Exception Handling
c) Event Handling
d) None of the above

72.The Swing Component classes that are used in Encapsulates a


mutually exclusive set of buttons?
a) ImageIcon
b) Jbutton
c) ButtonGroup
d) AbstractButton

73.What is an event in delegation event model used by Java


programming language?
a) An event is an object that describes a state change in a source
b) An event is an object that describes a state change in processing
c) An event is an object that describes any change by the user and
system
d) An event is a class used for defining object, to create events

74.From following list which is not Swing class?


a) JLabel
b) JButton
c) JImageIcon
d) JCheckBox
75.JButton class is present in which package?
a) java.awt
b) java.swing
c) java.awt.swing
d) javax.swing

76.JCheckBox is component defined in .......................package


a) Awt
b) Net
c) Javax
d) Swing

77.Swing components are


a) Platform dependent
b) Platform independent
c) Both a & b
d) Platform Oriented

78.MutableTreeNode is extends.................. interface


a) TreePath
b) TreeNode
c) DefaultMutableTreeNode
d) MutableTreeNode

79.In swing MVC architecture used in that M stands for


a) Main
b) Muiti-Level
c) Model
d) Method

80.What is the purpose of JTable?


a) JTable object displays rows of data
b) JTable object displays columns of data
c) JTable object displays rows and columns of data
d) JTable object displays data in Tree form
81.Event is called as?
a) Object that describe a state change in processing
b) Object that describe any change by the user and system
c) Event is class defining only object
d) Object that describe a state change in source

82.Which of these methods are used to register a keyboard event


listener?
a) KeyListener()
b) addKistener()
c) addKeyListener()
d) eventKeyboardListener()

83.Which of these methods are used to register a mouse motion


listener?
a) addMouse()
b) addMouseListener()
c) addMouseMotionListner()
d) eventMouseMotionListener()

84. creates a new object of a specific class (in this case a new
JFrame object called myFrame) is generally called a ...
a) Constructor
b) Layout manager
c) Parameter
d) GUI

85.What are the names of the list layout managers in Java?


a) Flow Layout Manager
b) Grid Layout Manager
c) Box Layout Manager
d) All of the above
86.Which of these methods can be used to know the degree of
adjustment made by the user?
a) getValue( )
b) getAdjustmentType( )
c) getAdjustmentValue( )
d) getAdjustmentAmount( )

You might also like