AWT MCQ Questions And Answers - Java Technologies
AWT MCQs : This section focuses on "basics" of AWT. These Multiple Choice Questions (MCQ) should be practiced to improve the AWT skills required for various interviews (campus interviews, walk-in interviews, company interviews), placements, entrance exams and other competitive examinations.
1. AWT stands for ?
A. All Window Toolkit
B. Abstract Work Toolkit
C. Abstract Window Toolkit
D. Abstract Window Text
View Answer
Ans : C
Explanation: AWT stands for Abstract Window Toolkit and infact it is a package – java.awt. The classes of this package give the power of creating a GUI environment to the programmer in Java.
2. The subclass of a java.awt.Component class is known as a ?
A. system
B. component
C. container
D. component manager
View Answer
Ans : B
Explanation: By definition, the subclass of a java.awt.Component class is known as a component.
3. What is the super class of all components of Java?
A. java.all.Component
B. all.awt.Component
C. java.awt.Component
D. awt.Component
View Answer
Ans : C
Explanation: It is java.awt.Component.
4. The subclass of a java.awt.Container class is known as a container.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: True, the subclass of a java.awt.Container class is known as a container.
5. How many layout managers defined in java.awt package?
A. 2
B. 3
C. 4
D. 5
View Answer
Ans : D
Explanation: There are 5 layout managers defined in java.awt package – FlowLayout, BorderLayout, GridLayout, CardLayout and GridBagLayout.
6. A ___________ dictates the style of arranging the components in a container.
A. border layout
B. grid layout
C. panel
D. layout manager
View Answer
Ans : D
Explanation: A layout manager dictates the style of arranging the components in a container.
7. 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
View Answer
Ans : B
Explanation: setText(String str) method of TextField class.
8. What is the listener used to handle the events of a text field?
A. java.awt.ActionListener interface
B. java.awt.event.ActionListener
C. awt.event.ActionListener interface
D. java.awt.event.ActionListener interface
View Answer
Ans : D
Explanation: java.awt.event.ActionListener interface used to handle the events of a text field.
9. Which method used to change the foreground (text) color of components like text field?
A. setBackground(Color clr)
B. setForeground(Color clr)
C. setColor(Color clr)
D. setEditable(boolean state)
View Answer
Ans : B
Explanation: setForeground(Color clr) of java.awt.Component class.
10. getLabel() method used to retrieve the label of a button.
A. Yes
B. No
C. Can be yes or no
D. Can not say
View Answer
Ans : A
Explanation: getLabel() method used to retrieve the label of a button.
Discussion