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)

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

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.

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

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

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

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.


current affairs 2021 pdf plan

Current Affairs MCQs

State-wise Current Affairs

Month-wise Current Affairs 2021

Category-wise Current Affairs

Jobs by Qualification

Free Mock Test