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

Advance Java Test Paper

The document contains a multiple choice test on Java and AWT/Swing concepts with 65 questions. It covers topics like AWT components, applets, layout managers, Swing components and MVC architecture. The test aims to assess knowledge of core Java GUI topics.

Uploaded by

kharateojas
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

Advance Java Test Paper

The document contains a multiple choice test on Java and AWT/Swing concepts with 65 questions. It covers topics like AWT components, applets, layout managers, Swing components and MVC architecture. The test aims to assess knowledge of core Java GUI topics.

Uploaded by

kharateojas
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Advance Java Test Paper

1. Give the Abbreviation of AWT:

a. Applet windowing Toolkit


b. Abstract windowing toolkit
c. Absolute windowing toolkit
d. None of these

2. Which is a component in AWT that can contain another components like


buttons, textfields, labels etc?

a. Window
b. Container
c. Panel
d. Frame

3. How many types of controls does AWT support?

a. 7
b. 6
c. 5
d. 8

4. Which class provides may methods for graphics programming?

a. Java.awt
b. Java.graphics
c. Java.awt.graphics
d. None of these

5. Which is the container that doesn’t contain title bar and menu bars. It can
have other components like button, text field etc?
a. Window
b. Frame
c. Panel
d. Container

6. Which object can be constructed to show any number of choices in the visible
window?

a. Choice
b. Menu
c. List
d. Checkbox

7. By which method we can set or change the text in a label in AWT?

a. setText()
b. getText()
c. addText()
d. all of these

8. on which side applet always executed?

a. Server side
b. Client side

9. Which method of the applet class displays the result of applet code on screen?

a. Run() method
b. Paint() method
c. drawstring() method
d. main() method

10. Applet can be embedded in ______

a. HTML document
b. Word document
c. Gif file
d. Rtf file

11. Which of the following is true about applet?

a. Applets do not have a main() method.


b. Applets must run under applet viewer or web browser
c. The user I/O is not performed using java’s stream I/O class
d. All of these

12. Executable applet is ____________

a. .applet file
b. .java html
c. .java file
d. .class file

13. Which of the following is used to interpret and execute Java Applet Classes
Hosted by HTML?

a. Applet Viewer
b. Applet Screen
c. Applet watcher
d. Applet show

14. Java applet are used to create _______ applications

a. Graphical
b. User interactive
c. Both a & b
d. None of the above

15. Which of these functions is called to display the output of an applet?


a. Display()
b. Paint()
c. displayApplet()
d. show()

16. Which of these methods is a part of Abstract Window Toolkit ( AWT )?

a. Display()
b. Paint()
c. Show()
d. All of these

17. Which object can be constructed to show any number of choices in the
visible window?

a. Labels
b. Choice
c. List
d. Checkbox

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

a. Component
b. Panel
c. Menu component
d. List

19. When we invoke repaint() for a java.awt.component object, the AWT


invokes the method:

a. Draw()
b. Update()
c. Show()
d. Paint()
20. Which method executes only once ?

a. Start()
b. Stop()
c. Init()
d. Destroy()

21. What does the following line of code do?

TextField text = new TextField(20);


a. Creates text object that can hold 20 rows of text
b. Creates text object that can hold 20 columns of text
c. Creates the object text and initializes it with the value 20
d. This is invalid code

22. Which of these classes can be added to any container class, using the add
method defined in the container class?

a. Button
b. checkboxMenuItem
c. menu
d. menubar

23. which of the following methods can be used to change the size of a
java.awt.component object?

a. Dimension()
b. Setsize()
c. Area()
d. Size()

24. Which of the following methods can be used to remove a


java.awt.component object from the display()?
a. Disappear()
b. Delete()
c. Remove()
d. Hide()

25. These two ways are used to create a Frame

1. By creating the object of Frame class ( association )


2. By extending frame class ( inheritance )

a. True
b. False

26. The title of the frame can be set in AWT using the method.

a. setHeading
b. setTitle
c. Create Title
d. setTitle

27. Which are passive controls that do not support any interaction with the user?

a. Choice
b. List
c. Labels
d. Checkbox

28. How many ways can we align the label in a container?

a. 1
b. 2
c. 3
d. 4
29. By which method we can set or change the text in an Label In AWT?

a. setText()
b. getText()
c. addText()
d. all of these

30. The various controls supported by AWT are:

a. Labels, push buttons


b. Checkbxes, choice lists
c. Scrollbars, test fields, text area
d. All of these

31. Which layout manager places components in one of the five regions : north,
south , east , west and center?

a. Absolute layout
b. Grid layout
c. Border layout
d. Flow layout

32. Arranges the components horizontally:

a. Border layout
b. Card layout
c. Grid layout
d. Flow layout

33. The most commonly used layout managers are ______.

a. Flow layout
b. Border layout
c. Grid layout
d. All of these

34. Default layout manager for subclasses of window is _____

a. Card layout
b. Gridbag layout
c. Frame
d. Border layout

35. Each menu is associated with a _______ list of menu items.

a. Checkbox
b. Drop-down
c. Choice
d. None of these

36. Pluggable look and feel and lightweight components are the features
supported by ________

a. Swing
b. AWT
c. Core java
d. None of these

37. Swing is based on _____ architecture

a. Client server
b. Model view controller
c. layered
d. None of these

38. Swing is not a part of JFC that is used to create GUI application.

a. True
b. False
39. The java foundation classes ( JFC ) is a set of GUI components which
simplify the development of desktop applications.

a. True
b. False

40. Following letter used a prefix to swing component.

a. A
b. S
c. G
d. J

41. _____ is one of the features of object oriented programming that allows the
creation of hierarchical classifications.

a. Polymorphism
b. Class
c. Inheritance
d. Object

42. In swing JButton class is derived from _________

a. AbstractButton
b. JToggleButton
c. JComponent
d. None of these

43. The JTextComponent derives two components JTextField and ______

a. JComboBox
b. JTextArea
c. JSlider
d. All of the above
44. In swing class hierarchy the class present at the root is ___

a. Component
b. Window
c. Container
d. Object

45. ________ pane can be used to add component to container.

a. Glsass
b. Content
c. Container
d. All of the above

46. To represent icon file in swing label, we use

a. Setimg
b. setIcon
c. serLabelIcon
d. none of this

47. which of the following component allows multiple selection?

a. JList
b. JComboBox
c. JLabel
d. All of the above

48. The subclass of JToggleButton is _____

a. JButton
b. JCheckBox
c. JRadioButton
d. Both b & c
49. The swing component classes that are used in encapusulates a mutually
exclusive set of buttons?

a. Abstractbutton
b. ButtonGroup
c. JButton
d. ImageIcon

50. Which method of the component class is used to set the position and size of
a component?

a. setPosition
b. setBounds
c. setSize
d. none of these

51. select the correct option

1. canvas is a component
2. scrollpane is a container

a. 1 is true and 2 is false


b. 1 is false and 2 is true
c. I & 2 both are false
d. 1 & 2 both are true

52. The difference between scrollbar and scrollpane is __________

a. Scrollbar is component and scrollpane is container


b. Scrollbar is container and scrollpane is component
c. Scrollbar and scrollpane both are components and not containers
d. Scrollbar and scrollpane both are containers and not components

53. Frame class extends window


a. True
b. False

54. Which is the container class?

a. Window
b. Frame
c. Dialog
d. All of the above

55. Following is uneditable control

a. Button
b. Textfield
c. Label
d. List

56. Jpanel and Applet use _____ as their default layout.

a. Flowlayout
b. Gridlayout
c. Border layout
d. Gridbag layout

57. MVC stands for ____

a. Model version control


b. Model view controller
c. Mini view controller
d. Major view controller

58. MVC architecture is used by swing ____

a. True
b. False
59. In swing _____ gives the visual representation of the component.

a. Model
b. View
c. Controller
d. None of these

60. In swing the event handling task is carried out by _______

a. Model
b. View
c. Controller
d. None of these

61. Which of these packages contains all the event handling interfaces?

a. Java.lang
b. Java.awt
c. Java.awt.event
d. Java.event

62. Where can the event handling code be written?

a. Same class
b. Other class
c. Anonymous class
d. All of these

63. Which of these class is super class of all the events?

a. EventObject
b. Eventclass
c. ActionEvent
d. ItemEvent
64. Which package provides many event classes and Listener interfaces for
event handling?

a. Java.awt
b. Java.awt.graphics
c. Java.awt.event
d. None of the above

65. Which of these interfaces handles the event when a component is added to
the container?

a. componentListener
b. ContainerListener
c. FocusListener
d. InputListener

66. Which of these interfaces define a method actionPerformed() ?

a. Componentlistener
b. Containerlistener
c. Actionlistener
d. Inputlistener

67. Which of these interfaces define four methods?

a) Componentlistener
b) Containerlistener
c) Actionlistener
d) Inputlistener

68. Which of these event will be generated if we close an applet’s widow?

a. Actionevent
b. Componentevent
c. adjustmentEvent
d. WindowEvent

69. Which of these event is generated when a button is pressed?

a. ActionEvent
b. KeyEvent
c. WindowEvent
d. AdjustmentEvent

70. Which of these methods can be used to obtain the command name for
invoking ActionEvent object ?

a. getCommand()
b. getActionCommand()
c. getActionEvent()
d. getActionEventCommand()

You might also like