Hide all answersHide all answersView all answersView all answersPrintTry the Quiz
Test your knowledge of Applet programming.
1. An applet may not create frames (instances of java.awt.Frame class). True
While applets must themselves reside within the browser, they may create other frames.
2. An applet is an instance of the Panel class in package jawa.awt. True False
Applets are small programs, meant not to run on their own but be embedded inside other applications (such as a web browser). All applets are derived from the class java.applet.Applet, which in turn is derived from java.awt.Panel.
3. The class file of an applet specified using the CODE parameter in an <APPLET> tag must reside in the same directory as the calling HTML page. True
The CODE parameter can specify complete or relative path of the location of the class file.
4. If getParameter method of an instance of java.applet.Applet class returns null, then an exception of type a NullPointerException is thrown. True
A NullPointerException is thrown only when a null value is used in a case where an object is required. For instance, trying to execute the equals method on a String object when the object is null.
5. Applets loaded over the internet have unrestricted access to the system resources of the computer where they are being executed. True
Due to security reasons, applets run under a restricted environment and cannot perform many operations, such as reading or writing to files on the computer where they are being executed.
6. An applet may be able to access some methods of another applet running on the same page. True False
Only public methods can be accessed in such a fashion.
7. The SecurityManager object is responsible for implementing the security policies for applets. True False
Each browser has a SecurityManager that controls the access to system resources by applets. A SecurityException is thrown when a violation is detected.
8. One of the popular uses of applets involves making connections to the host they came from. True False
An example of this feature can be implementation of a chat functionality.
9. Applets loaded from the same computer where they are executing have the same restrictions as applets loaded from the network. True
Applets loaded and executing locally have none of the restrictions faced by applets that get loaded from the network.
10. The methods init, start, stop and destroy are the four major events in the life of an applet. True False
These methods initialize, start the execution, stop the execution, and perform the final cleanup respectively. Not each of these methods may be overridden in every applet.
11. Applets are not allowed to have contsructors due to security reasons. True
Applets may have constructors, but usually don't as they are not guaranteed to have access to the environment until their init method has been called by the environment.