Basics of AWT and Swing - Java test

Basics of AWT and Swing - Java test


1) Give the abbreviation of AWT?

A) Applet Windowing Toolkit
B) Abstract Windowing Toolkit
C) Absolute Windowing Toolkit
D) None of the above
View Answer / Hide Answer

ANSWER: B) Abstract Windowing Toolkit




2) Which is the container that contain title bar and can have MenuBars. It can have other components like button, textfield etc.?

A) Panel
B) Frame
C) Window
D) Container
View Answer / Hide Answer

ANSWER: B) Frame




3) Which is a component in AWT that can contain another components like buttons, textfields, labels etc.?

A) Window
B) Container
C) Panel
D) Frame
View Answer / Hide Answer

ANSWER: B) Container




4) AWT is used for GUI programming in java?

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True




5) The following specifies the advantages of

It is lightweight.
It supports pluggable look and feel.
It follows MVC (Model View Controller) architecture.

A) Swing
B) AWT
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) Swing




6) Swing is not a part of JFC (Java Foundation Classes) that is used to create GUI application?

A) True
B) False
View Answer / Hide Answer

ANSWER: B) False




7) Which class provides many methods for graphics programming?

A) java.awt
B) java.Graphics
C) java.awt.Graphics
D) None of the above
View Answer / Hide Answer

ANSWER: C) java.awt.Graphics




8) These two ways are used to create a Frame

By creating the object of Frame class (association)
By extending Frame class (inheritance)

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True




9) The Following steps are required to perform

1) Implement the Listener interface and overrides its methods
2) Register the component with the Listener

A) Exception Handling
B) String Handling
C) Event Handling
D) None of the above
View Answer / Hide Answer

ANSWER: C) Event Handling




10) In which places can put the event handling code

A) Same class
B) Other class
C) Annonymous class
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above




11) 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
View Answer / Hide Answer

ANSWER: C) java.awt.event




12) To use the ActionListener interface it must be implemented by a class there are several ways to do that find in the following?

A) Creating a new class
B) using the class the graphical component
C) an anonymous inner class
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above




13) The ActionListener interface is not used for handling action events?

A) True
B) False
View Answer / Hide Answer

ANSWER: B) False




14) The ActionListener interface is used for handling action events,For example,it's used by a

A) JButton
B) JCheckbox
D) JMenuItem
C) All of these
View Answer / Hide Answer

ANSWER: C) All of these




15) Which is the container that doesn't contain title bar and MenuBars. It can have other components like button, textfield etc?

A) Window
B) Frame
C) Panel
D) Container
View Answer / Hide Answer

ANSWER: C) Panel




16) How many types of controls does AWT supports these controls are subclasses of component?

A) 7
B) 6
C) 5
D) 8
View Answer / Hide Answer

ANSWER: A) 7




17) Which are passive controls that do not support any interaction with the user?

A) Choice
B) List
C) Labels
D) Checkbox
View Answer / Hide Answer

ANSWER: C) Labels




18) By which method You can set or change the text in a Label?

A) setText()
B) getText()
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) setText()




19) Which class is used to create a pop-up list of items from which the user may choose?

A) List
B) Choice
C) Labels
D) Checkbox
View Answer / Hide Answer

ANSWER: B) Choice




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

A) Labels
B) Choice
C) List
D) Checkbox
View Answer / Hide Answer

ANSWER: C) List




21) Which class is used for this Processing Method processActionEvent( )?

A) Button,List,MenuItem
B) Button,Checkbox,Choice
C) Scrollbar,Component,Button
D) None of the above
View Answer / Hide Answer

ANSWER: A) Button,List,MenuItem




22) The Swing Component classes that are used in Encapsulates a mutually exclusive set of buttons?

A) AbstractButton
B) ButtonGroup
C) JButton
D) ImageIcon
View Answer / Hide Answer

ANSWER: B) ButtonGroup




23) Which is used to store data and partial results, as well as to perform dynamic linking, return values for methods, and dispatch exceptions?

A) Window
B) Panel
C) Frame
D) Container
View Answer / Hide Answer

ANSWER: C) Frame




24) The following way is used to create a frame is by creating the object of Frame class?

A) inheritance
B) association
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: B) association




25) AWT more powerful components like tables, lists, scroll panes, color chooser, tabbed pane etc.?

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True




26) In Graphics class Which method is used to set the graphics current color to the specified color?

A) public abstract void setFont(Font font)
B) public abstract void setColor(Color c)
C) public abstract void drawString(String str, int x, int y)
D) None of the above
View Answer / Hide Answer

ANSWER: B) public abstract void setColor(Color c)




27) These four methods commonly used in?

1)public void add(Component c)
2)public void setSize(int width,int height)
3)public void setLayout(LayoutManager m)
4)public void setVisible(boolean)

A) Graphics class
B) Component class
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: B) Component class




28) In Graphics class which method is used to draws a rectangle with the specified width and height?

A) public void drawRect(int x, int y, int width, int height)
B) public abstract void fillRect(int x, int y, int width, int height)
C) public abstract void drawLine(int x1, int y1, int x2, int y2)
D) public abstract void drawOval(int x, int y, int width, int height)
View Answer / Hide Answer

ANSWER: A) public void drawRect(int x, int y, int width, int height)




29) Implement the Listener interface and overrides its methods is required to perform in event handling?

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True




30) The Java Foundation Classes (JFC) is a set of GUI components which simplify the development of desktop applications?

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True



Post your comment

    Discussion

  • RE: Basics of AWT and Swing - Java test -jagruti patil (03/01/17)
  • can i get pdf file for mcq on advance java of awt,swing,event handelling ,servlet,jdbc .please...
  • RE: Basics of AWT and Swing - Java test -jagruti patil (02/25/17)
  • Can I get pdf file for mcq on advance java with answers. Please help me