0% found this document useful (0 votes)
123 views4 pages

Awt Answer1

1. The document appears to be a practice test for a class on AWT (Abstract Window Toolkit) in Java. It contains 60 multiple choice questions testing concepts about AWT classes, components, layout managers, and applets. 2. Key concepts covered include the final keyword, threads and runnable interfaces, collection classes, JDBC, AWT components like labels, text fields and text areas, layout managers, menus, events, applets, and the paint() method. 3. The test asks questions about properties, methods and relationships between AWT and Swing classes like Frame, Panel, Button, TextField and more.

Uploaded by

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

Awt Answer1

1. The document appears to be a practice test for a class on AWT (Abstract Window Toolkit) in Java. It contains 60 multiple choice questions testing concepts about AWT classes, components, layout managers, and applets. 2. Key concepts covered include the final keyword, threads and runnable interfaces, collection classes, JDBC, AWT components like labels, text fields and text areas, layout managers, menus, events, applets, and the paint() method. 3. The test asks questions about properties, methods and relationships between AWT and Swing classes like Frame, Panel, Button, TextField and more.

Uploaded by

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

Sanjivani Rural Education Society’s

SANJIVANI K. B. P. POLYTECHNIC
Department of Computer Technology
KOPARGAON – 423601, DIST: AHMEDNAGAR
2023-2024

Class Test: [Unit I-AWT] Date: / /2023


Name : Set: I
Roll No :

1. Which class cannot be subclassed (or extended) in java?


a) abstract class b) parent class c) Final class d) None of above

2. Can we declare abstract static method


a) Yes b) No

3. Can we access private class outside the package


a) Yes b) No

4. Why we use array as a parameter of main method


a) it is syntax b) Can store multiple values c) Both of above d) None of above

5. Suspend thread can be revived by using


a) start() method b) Suspend() method c) resume() method d) yield() method

6.Runnable is
a) Class b) Method c) Variable d) Interface

7. Which collection class associates values with keys, and orders the keys according to their naturalorder
a) java.util.HashSet b) java.util.LinkedList c) java.util.TreeMap d) java.util.SortedSet

8. Which method is used to perform DML statements inJDBC


a) execute() b) executeUpdate() c) executeQuery() d) None of above

9. In Runnable, many threads share the same object instance


a) True b) False

10. Program which executes applet is known as


a) applet engine b) virtual machine c) JVM d) None of above

11. 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

12. 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

13. A is a passive AWT control that do not generate any event?


a) Button b) RadioButton c) Choice d) Label
14. The default layout manager of Frame is .
a) FlowLayout b) BorderLayout c) GridLayout d) CardLayout

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


a) getStatus( ) b) getState( ) c) isChecked( ) d) getChecked( )
16. Which of the following method is used to set a TextComponent to read‐only mode?
a) Editable( ) b) nonEditable( ) c) setEchoChar( ) d) setEditable( )

17. generates action events when an item is double‐clicked.


a) List b) Checkbox c) MenuItem d) TextField

18. Which of the following does not have its default layout as BorderLayout.
a) Frame b) Dialog c) JApplet d) All of Above

19. Which of the following statement about GUI component is wrong?


a) swing exists since the version 1.2 of the JDK
b) AWT stands for Abstract Window Toolkit
c) You cannot place AWT component on swing container
d) The AWT classes are deprecated.

20.Which of the following package is used for Graphical User Interface?


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

21. What are the variables defined in Dimension?


a) length and width b) height and length c) height and width d) None of these

22. Which AWT component is not editable?


a) Button b) TextField c) FlowLayout d) Label

23. Current text of Label can be obtained using .


a) setAlignment( ) b) getAlignment( ) c) getText( ) d) setText( )

24. 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

25. Which of these Components cannot be added to Frame?


a) Label b) Button c) CheckboxGroup d) All of above

26. What is use of second parameter given in Label constructor : Label(String, int)
(a) Specifies height of label in terms of pixels
(b) specifies width of label in terms of pixels

27.Which of these classes can be added to any container class, using the add method defined incontainer
class?
a) Button b) CheckboxMenuItem c) Menu d)MenuBar

28.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()

29.Which of the following methods can be used to remove a java.awt.Component object from thedisplay?
a) disappear() b) delete() c) remove() d) hide()
30.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

31. The tittle of the frame can be set in AWT using the method.
a) setHeading b) setTitle c) createTitle d) settitle

32. Which are passive controls that do not support any interaction with the user?
a) Choice b) List
c) Labels c) Settitle
33.How Many ways can be align the label in a container?a) 1 b) 2
c) 3 d) 4

34. 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

35. Default layout manager for subclasses of window is


a) CardLayout b) BorderLayout c) Frame d) BorderLayout

36.Each menu is associated with a list of menu items:


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

37.Which is the immediate super class of Applet?


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

38.Which class encapsulates a blank window upon which we can draw?


a) Window b) Frame c) Applet d) Canvas

39.Color class can create object of it using which of the following color values?
a) RGB b) RYB c) CMY d) HSB

40.Which of the following style is not supported by Font class?


a) Font.UNDERLINE b) Font.ITALIC c) Font.PLAIN d) Font.BOLD

41.Which of the following is passive AWT control?


a) Label b) Button c) Checkbox d) TextField

42.A checkbox is a control that consist of a


a) Combination of a small box b) A label
c) Combination of a large box and a label d) Both a & b

43. All AWT controls are subclass of which class?


a) Component b) Container c) AWT Control d) Window

44. The concept of Menu Bar can be implemented by using three java classes-
a) Menu b) MenuBar c) MenuItem d) All of these

45. Which method is used to append the text at the end of TextArea?
a) append() b) add() c) appendAt() d) addAt()
46. The immediate super class of TextArea is
a) TextField b) TextBox c) TextComponent d) Component

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

48. Which object can be constructed to show any number of choices in the visible window?
a) Choice b) Menu c) List d) Checkbox

49. 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

50. On which side applet always executed?


a) Server side b) Client side

51. Applet can be embedded in


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

52. 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.

53. Executable applet is


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

54. Java applet are used to create applications


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

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


a) Display() b)paint() c) displayApplet() d)show()

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


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

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


a) display() b) paint() c) displayApplet() d) Show()

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


a) display() b) paint() c) show() d) all of the above .

59. Which object can be constructed to show any number of choices in the visible window?
a) Label b) Choice c) List d) Checkbox

60. Which of the following class is derived from the container class?
a) Component b) Panel c) MenuComponent d) List

You might also like