Programming MCQs

Top 20 Objective Questions On Applets In Java

Pinterest LinkedIn Tumblr
Here is the collection of objective questions on Applets in Java which includes the definition of applets, the applet class, uses of applets in HTML, the life cycle of an applet, and the graphics class in Java Applet. It also includes objective questions on the components, containers and layout managers in java applets, update( ), paint( ) and repaint( ) methods used in applets in java.

Read Also: MCQ On Inheritance, Package And Interface In Java

1. When the ………………. method of the Applet class is called, it displays the result of the Applet code on the screen.
A) paint( )
B) repaint( )
C) update( )
D) reupdate( )

2. Before we try to write applets, we must make sure that Java is installed properly and also ensure that either the java is installed properly and also ensure that either the java …………….. or a java-enabled browser is available.
A) viewer( )
B) appletviewer( )
C) appletrunner( )
D) browserviewer( )

3. Arrange the steps involved in developing and testing the applet in correct order.
i) creating an executable applet (.classfile)
ii) preparing <APPLET> tag
iii) creating HTML file
iv) building an applet code (.java file)
v)  testing the applet code
A) 1-i, 2-ii, 3-iii, 4-iv, 5-v
B) 1-ii, 2-iii, 3-iv, 4-v, 5-i
C) 1-iv, 2-i, 3-ii, 4-iii, 5-v
D) 1-iii, 2-iv, 3-v, 4-i, 5-ii

4. State whether the following statements about the Applets are True or False.
i) Applets can communicate with other services on the network.
ii) Applets cannot run any program from the local computer.
A) True, False
B) False, True
C) True, True
D) False, False

5. Applet class is a subclass of the panel class, which is again a subclass of the ………………….. class.
A) object
B) component
C) awt
D) container

6. The ………………… method called the first time an applet is loaded into the memory of a computer.
A) init( )
B) start( )
C) stop( )
D) destroy( )

7. The ……………………… method is called every time the applet receives focus as a result of scrolling in the active window.
A) init( )
B) start( )
C) stop( )
D) destroy( )

8. Which of the following applet tags is legal to embed an applet class named Test into a webpage?
A) <applet class=Test width=200 height=100>
</applet>
B) <applet>
code=Test.class width=200 height=100>
</applet>
C) <applet
code=Test.class width=200 height=100>
</applet>
D) <applet
param=Test.class width=200 height=100>
</applet>

9. If you want to assign a value of 88 to the variable year, then which of the following lines can be used within an <applet> tag.
A) number = getParameter(88)
B) <number=99>
C) <param = radius value=88>
D) <param name=number value=88>

10. The …………………. class is an abstract class that represents the display area of the applet.
A) display
B) graphics
C) text
D) area
Read Also: Top 20 MCQ Questions On Exception Handling In Java

11. The graphics class provides methods to draw a number of graphical figure including
i) Text        ii) Lines        iii) Images         iv) Ellipse
A) i, ii and iii only
B) ii, iii and iv only
C) i, iii and iv only
D) All i, ii, iii and iv

12. The ………………. method is called to clear the screen and calls the paint( ) method.
A) update( )
B) paint( )
C) repaint( )
D) reupdate( )

13. The ………………….. method is automatically called the first time the applet is displayed on the screen and every time the applet receives focus.
A) update( )
B) paint( )
C) repaint( )
D) reupdate( )

14. The ………………. method is defined by the AWT which causes the AWT runtime system to execute a call to your applet’s update( ) method.
A) update( )
B) paint( )
C) repaint( )
D) reupdate( )

15. Text field can be created by which of the following methods.
i) TextField( )                          ii) TextFieldString( )
iii) TextField(int)                    iv) TextField(string, int)
A) i, ii and iii only
B) ii, iii and iv only
C) i, ii and iv only
D) All i, ii, iii and iv

16. In java applet, we can display numerical values by first converting them into string and then using the ………………… method.
A) paint( )
B) drawstring( )
C) draw( )
D) convert( )

17. We can change the text to be displayed by an applet by supplying new text to be displayed by an applet by supplying new text to the applet through a ……………………… tag.
A) <EDIT>
B) <CHANGE>
C) <REPLACE>
D) <PARAM>

18. Which of the following is/are the possible values for alignment attribute of Applet tag.
i) Top           ii) Left          iii) Middle           iv) Baseline
A) i, ii and iii only
B) ii, iii and iv only
C) i, iii and iv only
D) All i, ii, iii and iv

19. The ……………….. attribute of applet tag specifies the amount of horizontal blank space the browser should leave surrounding the applet.
A) SPACE=pixels
B) HSPACE=piexls
C) HWIDTH=piexls
D) HBLANK=pixels

20. ……………………. attribute of applet tag specify the width of the space on the HTML page that will reserved for the applet.
A) WIDTH=pixels
B) HSPACE=piexls
C) HWIDTH=piexls
D) HBLANK=pixels

Answers

1. A) paint( )
2. B) appletviewer( )
3. C) 1-iv, 2-i, 3-ii, 4-iii, 5-v
4. B) False, True
5. D) container
6. A) init( )
7. B) start( )
8. C) <applet code=Test.class width=200 height=100> </applet>
9. D) <param name=number value=88>
10. B) graphics
11. D) All i, ii, iii and iv
12. A) update( )
13. B) paint( )
14. C) repaint( )
15. C) i, ii and iv only
16. B) drawstring( )
17. D) <PARAM>
18. D) All i, ii, iii and iv
19. B) HSPACE=piexls
20. A) WIDTH=pixels

Read Next:Top 20 MCQ Questions On Streams In Java

Please follow and like us:
RSS
Follow by Email
X (Twitter)
Visit Us
Follow Me
YouTube
YouTube
LinkedIn
linkedIn | Top 20 Objective Questions On Applets In Java
Share

Author

Shuseel Baral is a web programmer and the founder of InfoTechSite has over 8 years of experience in software development, internet, SEO, blogging and marketing digital products and services is passionate about exceeding your expectations.

2 Comments

  1. Hi there,
    please change the answer of 13 number mcq because there is a little mistake the answer should be the repaint() method instead of Update().
    By the way thanks for providing such a good mcqs bro

Write A Comment

RSS
Follow by Email
X (Twitter)
Visit Us
Follow Me
YouTube
YouTube
LinkedIn
Share