Awt(Engineering > Computer Science And Engineering ) Questions and Answers

Question 1. Which class can be used to represent a checkbox with a textual label that can appear in a menu.
  1.    MenuBar
  2.    MenuItem
  3.    CheckboxMenuItem
  4.    Menu
Explanation:-
Answer: Option C. -> CheckboxMenuItem





Question 2. Which class provides many methods for graphics programming?
  1.    java.awt
  2.    java.Graphics
  3.    java.awt.Graphics
  4.    None of the above
Explanation:-
Answer: Option C. -> java.awt.Graphics





Question 3. By which method You can set or change the text in a Label?
  1.    setText()
  2.    getText()
  3.    Both A & B
  4.    None of the above
Explanation:-
Answer: Option A. -> setText()





Question 4. The following specifies the advantages of
It is lightweight.
It supports pluggable look and feel.
It follows MVC (Model View Controller) architecture.
  1.    Swing
  2.    AWT
  3.    Both A & B
  4.    None of the above
Explanation:-
Answer: Option A. -> Swing





Question 5. The Java Foundation Classes (JFC) is a set of GUI components which simplify the development of desktop applications?
  1.    True
  2.    False
  3.    All of these
  4.    None
Explanation:-
Answer: Option A. -> True





Question 6. Which is the container that doesn't contain title bar and MenuBars but it can have other components like button, textfield etc?
  1.    Window
  2.    Frame
  3.    Panel
  4.    Container
Explanation:-
Answer: Option C. -> Panel





Question 7. In Graphics class which method is used to draws a rectangle with the specified width and height?
  1.    public void drawRect(int x, int y, int width, int height)
  2.    public abstract void fillRect(int x, int y, int width, int height)
  3.    public abstract void drawLine(int x1, int y1, int x2, int y2)
  4.    public abstract void drawOval(int x, int y, int width, int height)
Explanation:-
Answer: Option A. -> public void drawRect(int x, int y, int width, int height)





Question 8. Which package provides many event classes and Listener interfaces for event handling?
  1.    java.awt
  2.    java.awt.Graphics
  3.    java.awt.event
  4.    None of the above
Explanation:-
Answer: Option C. -> java.awt.event





Question 9. Name the class used to represent a GUI application window, which is optionally resizable and can have a title bar, an icon, and menus.
  1.    Window
  2.    Panel
  3.    Dialog
  4.    Frame
Explanation:-
Answer: Option D. -> Frame





Question 10. The Swing Component classes that are used in Encapsulates a mutually exclusive set of buttons?
  1.    AbstractButton
  2.    ButtonGroup
  3.    JButton
  4.    ImageIcon
Explanation:-
Answer: Option B. -> ButtonGroup