Java AWT And Swing MCQs

Java AWT And Swing MCQs

Answer these Java AWT And Swing MCQs and see how sharp is your knowledge of Java AWT And Swing. Scroll down and let's start!

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

A.   AbstractButton

B.   ImageIcon

C.   ButtonGroup

D.   JButton

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

A.   False

B.   True

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

A.   Public abstract void drawOval(int x, int y, int width, int height)

B.   Public abstract void drawLine(int x1, int y1, int x2, int y2)

C.   Public void drawRect(int x, int y, int width, int height)

D.   Public abstract void fillRect(int x, int y, int width, int height)

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

A.   Inheritance

B.   Association

C.   Inheritance And association

D.   None

5:

The Following steps are required to perform


1) Implement the Listener interface and overrides its methods

2) Register the component with the Listener


A.  

String Handling


B.  

Event Handling


C.  

Exception Handling


D.  

None

6: 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 drawString(String str, int x, int y)

C.   Public abstract void setColor(Color c)

D.   None

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

A.   None

B.   Scrollbar,Component,Button

C.   Button,List,MenuItem

D.   Button,Checkbox,Choice

8: By which method You can set or change the text in a Label?

A.   None

B.   SetText()

C.   GetText() And setText()

D.   GetText()

9: In which places can put the event handling code:

A.   Other class

B.   All

C.   Annonymous class

D.   Same class

10: 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.   Graphics class And Component class

C.   Component class

D.   None

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

A.   Window

B.   Container

C.   Panel

D.   Frame

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

A.   Container

B.   Window

C.   Frame

D.   Panel

13:

The following specifies the advantages of

It is lightweight.

It supports pluggable look and feel.

It follows MVC (Model View Controller) architecture.

A.   AWT And Swing

B.   AWT

C.   None

D.   Swing

14:

These two ways are used to create a Frame

By creating the object of Frame class (association)

By extending Frame class (inheritance)

A.   False

B.   True

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

A.   False

B.   True