Quiz on More Applet Features

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
Historical topic: Java appletsModern web browsers do not run Java applets. The Applet API was deprecated for removal before Java 25 and was removed in Java 26. Treat applet examples on this page as historical object-oriented/GUI examples; for new desktop interfaces use Swing where appropriate or JavaFX/OpenJFX.

created: 01/22/00; revised: 10/04/03, 02/12/06


Quiz on More Applet Features

This is a practice quiz. The results are not recorded anywhere and do not affect your grade. The questions on this quiz might not appear in any quiz or test that does count toward your grade.

Instructions: For each question, choose the single best answer. Make your choice by clicking on its button. You can change your answers at any time. When the quiz is graded, the correct answers will appear in the box after each question.



1. What reserved word is used to distinguish the instance variables of an object from identically named parameters of a constructor?

A.    this
B.    that
C.    mine
D.    main

2. What is the class that applets are based on?

A.    applet
B.    JApplet
C.    Apple
D.    AWT

3. What class creates a random number generator object?

A.    JApplet
B.    Graphics
C.    Math
D.    Random

4. What is an immutable object?

A.    One that can never be created.
B.    One that once created can never be changed.
C.    One that once created can never be destroyed.
D.    One that can easily be changed by other objects.

5. What is Color.red ?

A.    A static final object of class Color that represents the color red.
B.    A constructor of class Color.
C.    A private method of class Color.
D.    An object of class Graphics.

6. What reserved word is used when an instance variable is declared for a class that prevents methods from outside classes from seeing it?

A.    final
B.    int
C.    public
D.    private

7. Does an immutable object have all private methods?

A.    No---it might or might not.
B.    No---if all the methods were private none would ever be called.
C.    Yes---to prevent any outside use of the object.
D.    Yes---that is what makes it immutable

8. What HTML tags are used to show the main, content-containing part of a web page?

A.    <applet>   </applet>
B.    <body>   </body>
C.    <h1>   </h1>
D.    <html>   </html>

9. Which of the following generates an integer in the range 0 to 9 ?

A.   
Random randNum = new Random();
int someInt = randNum();
B.   
Random randNum = new Random();
int someInt = randNum.nextInt() ;
C.   
Random randNum = new Random();
int someInt = Math.abs( randNum.nextInt() )%9
D.   
Random randNum = new Random();
int someInt = Math.abs( randNum.nextInt() )%10

10. Can two or more applets appear on the same web page?

A.    No, only one per page.
B.    No, applets can't appear on web pages.
C.    Yes, put them all between <applet> and </applet>
D.    Yes, but there must be <applet> and </applet> for each one.

The number you got right:       Percent Correct:       Letter Grade:   


Click here

If you have returned here from another page, or have re-loaded this page, you will need to click again on each of your choices for the grading program to work correctly. You may want to press the SHIFT KEY while clicking to clear the old answers.