Advanced Java Programming
1. Which is a component in AWT that can contain 7. The following way is used to create a frame is by
another components like buttons, textfields, labels creating the object of Frame class?
etc.? (a) inheritance
(a) Window (b) association
(b) Container (c) Both A & B
(c) Panel (d) None of the above
(d) Frame Answer: c
Answer:b
2. Which class provides many methods for graphics 8. Public class MenuBar extends ____.
programming? (a) MenuComponent
(a) [Link] (b) MenuContainer
(b) [Link] (c) ComponentMenu
(c) [Link] (d) MenuBar
(d) None of the above Answer: a
Answer:c
[Link] is the container that doesn't contain titlebar 9. 21 Panel is defined as________ .
and MenuBars. It can have other components like (a) The Panel class is a concrete subclass of
button, textfield etc? Container.
(a) Window (b) A Panel is a window that does not contain
(b) Frame titlebar, menubar and border.
(c) Panel (c) Panel is a superclass of Applet.
(d) Container (d) All of the above.
Answer:c Answer: d
4. By which method You can set or change the text 10. What is API?
in a Label ? (a) Application Programming Interchange
(a) setText() (b) Application Programming Interaction
(b) getText() (c) Application Programming Interface
(c) Both A & B (d) None of these
(d) None of the above Answer: c
Answer:a
5. Which class is used to create a pop‐up list of [Link] is default layout for Dialog?
items from which the user may choose? (a) FlowLayout
(a) List (b) GridLayout
(b) Choice (c) CardLayout
(c) Labels (d) BorderLayout
(d) Checkbox Answer: a
Answer:b
6. Which object can be constructed to show any 12. Which method is used to count the number of
number of choices in the visible window? items is the List.
(a) Labels (a) getItem( )
(b) Choice (b) getSelectedItem( )
(c) List (c) getItemCount( )
(d) Checkbox (d) getCount( )
Answer:c Answer: c
13. Which is used to store data and partial results, 19. __________ positions are the components into
as well as to perform dynamic linking, return values 5 regions east, west, south, north, center.
for methods, and dispatch exceptions? (a) CardLayout
(a) Window (b) Panel (b) BorderLayout
(c) Frame (d) Container (c) GridLayout
Answer:c (d) FlowLayout
Answer: b
14. The correct hierarchy for Panel is_____ 20. Panel is defined as________ .
(a) Component – Container – Window – Panel (a) Panel class is a concrete sub‐class of container
(b) Component – Container – Applet – Panel (b) A Panel is a window that does not contain a title
(c) Component – Container – Panel bar, menu bar or border
(d) Container – Component – Panel (c) Panel is the superclass of Applet
Answer: c (d) All of above
Answer: d
15. Which is the correct constructor of GridLayout. 21. Which component of AWT provides compact,
(a) GridLayout(int a) multichoice, scrolling component?
(b) GridLayout(int num_rows, int num_columns) (a) List
(c) GridLayout(int rows, int cols, int vert) (b) Choice
(d) GridLayout(int hor) (c) Panel
Answer: b (d) TextArea
Answer: a
16. What are the types of DialogBox? 22. Which component of AWT provides compact,
(a) Modal DialogBox multichoice, scrolling component?
(b) Modal and Modeless DialogBox (a) List
(c) Modam (b) Choice
(d) None of the above (c) Panel
Answer: b (d) TextArea
Answer: a
17. In the give constructor what third parameter 23. The getContentPane( ) method is of which
indicates : ScrollBar s = new class?
ScrollBar(0,10,20,0,1000); (a) JApplet
(a) size of thumb (b) JFrame
(b) minimum value (c) JButton
(c) Increment value (d) None of these
(d) Initial Value Answer: d
Answer: a
18. Which class is used to represent a single line 24. Which class defines setSize( ) method?
textbox with password character facility? (a) Frame
(a) TextField (b) Applet
(b) TextArea (c) Component
(c) Label (d) Panel
(d) Checkbox Answer: c
Answer: a
25. Which of the method can be used to output a 31. Which of the following does not have its default
String in an Applet? layout as BorderLayout.
(a) display( ) (a) Frame
(b) print( ) (b) Dialog
(c) drawString( ) (c) JApplet
(d) transient( ) (d) All of Above
Answer: c Answer: d
26. __________is a swing class that allows to enter 32. Which of the following package is used for
a single line of text. Graphical User Interface?
(a) TextField (a) [Link]
(b) JTextField (b) [Link]
(c) EditTextField (c) [Link]
(d) TextArea (d) [Link]
Answer: b Answer: b
27. Frame is a standard window, which is________ 33. 8 Java Applets are used to create
of Window class from AWT hierarchy? ________applications.
(a) Derived class / Subclass (a) Graphical
(b) Base class / Super class (b) user interactive
(c) Root class (c) Both A & B
(d) Family class (d) None of these
Answer: a Answer: c
28. A______ is a passive AWT control that do not 34. Which of the following sets the frame, say
generate any event? frame to 300 pixels wide by 200 high?
(a) Button a)[Link]( 300, 200 );
(b) RadioButton b) [Link]( 300, 200 );
(c) Choice c) [Link]( 300, 200 );
(d) Label d)[Link]( 300, 200 );
Answer: d Answer: a
29. Which method is used to check the status of 35. . Give the abbreviation of AWT ?
checkbox? (a) Applet Windowing Toolkit
(a) getStatus( ) (b) Abstract Windowing Toolkit
(b) getState( ) (c) Absolute Windowing Toolkit
(c) isChecked( ) (d) None of the above
(d) getChecked( ) Answer: b
Answer: b
30. Which of the following method is used to set a 36. Which is the container that contain title bar and
TextComponent to read‐only mode? can have MenuBars. It can have other components
(a) Editable( ) like button, textfield etc.?
(b) nonEditable( ) (a) Panel
(c) setEchoChar( ) (b) Frame
(d) setEditable( ) (c) Window
Answer: d (d) Container
Answer: b
37. Which of the below is not a session tracking 38. Which page directive should be used in JSP to
method? generate a PDF page?
(a)URL rewriting (a)contentType
(b)History (b)generatePdf
(c)Cookies (c)typePDF
(d)SSL sessions (d)contentPDF
Answer:b Answer :a
[Link] is an instance of which class? 40. “request” is an instance of which one of the
(a)[Link] following classes?
(b)[Link] (a)Request
(c)[Link] (b)HttpRequest
(d)[Link] (c)HttpServletRequest
Answer:d (d)ServletRequest
Answer:c
41. How constructor can be used for a 46. Out of these, which one is the
servlet? correct way of calling a constructor
(a) Initialization that has no parameters of the
(b) Constructor function superclass A by the subclass B?
(c) Initialization and Constructor function (a) superclass.();
(d) Setup() method
Answer:c
(b) super(void);
(c) super();
(d)super.A();
Answer:c
[Link] tag is used to set a value of 47. Out of these packages, which one
a JavaBean? contains an abstract keyword?
a. (a)<c:set> (a)[Link]
b. (b)<c:param> (b)[Link]
c. (c)<c:choose>
(c)[Link]
d. (d)<c:forward>
Answer :a (d) [Link]
Answer:b
43. Java code is embedded under 48. Out of these exceptions, which one
which tag in JSP? is thrown by the compareTo() method
a. (a)Declaration that is defined in a double wrapper?
b. (b)Scriptlet (a) SystemException
c. (c) Expression
(b)ClassCastException
d. (d) Comment
Answer :b (c)IOException
(d)CastException
Answer:b
44. What is it called when the child 49. Where does the String Pool get
object also gets killed when the parent stored?
object is killed in the program? (a) Metaspace
(a) Encapsulation (b) Java Stack
(b) Association (c) Java Heap
(c) Aggregation (d)Permanent Generation
(d) Composition Answer: c
Answer:d
45. Out of these methods of the String 50. Out of these methods, which one
class, which one can be used for makes the raw MIME formatted
testing the strings for equality? string?
(a) isequals() (a)toString()
(b)isequal() (b)getString()
(c)equals() (c)parse()
(d)equal() (d)parseString()
Answer:c Answer:c