GkSeries.com

Applets - Core Java Questions and Answers - MCQs with Answers

(1) Which of the following will be used to print your name in an applet?
[A] drawText (myName)
[B] drawLine (myName, 10. 10)
[C] drawLetters (10, 10, myName)
[D] drawString (myName, 10, 10)

Comment

Answer: Option [D]

drawString is a Graphics class. It called within update() or paint() method to print a string to the applet window.

(2) The base class of the classes "Button" and "TestComponent" is
[A] Component
[B] Label
[C] Objects
[D] Container

Comment

Answer: Option [A]

The Component class is the base class for classes "Button" and "TestComponent". It is base class for almost all the interface components in the AWT.

DOWNLOAD CURRENT AFFAIRS PDF FROM APP

(3) Default layout manager for subclasses of "Window" is
[A] CardLayout
[B] GridBagLayout
[C] Frame
[D] BorderLayout

Comment

Answer: Option [D]

BorderLayout is the default layout manager for subclasses of "Window". For e.g. it default layout manager for JFrame, JWindow, JDialog, JInternalFrame, and JApplet.

(4) Applet can be embedded in a
[A] MS Word document
[B] RTF file
[C] html file
[D] gif file

Comment

Answer: Option [C]

Applets are written in Java and it can be included in html page by using HTML tag.

(5) What is the default layout for Dialogs ?
[A] FlowLayout
[B] BorderLayout
[C] CardLayout
[D] GridLayout

Comment

Answer: Option [B]

In a container BorderLayout is used to arrange components in five regions. The arrangement of components can be done by resizing and putting them in five regions North, South, East, West and Center.

Please share this page

Chapters

Click Here to Read more questions

Teacher Eligibility Test