Question | Answer | Explanation |
An applet may not create frames (instances of java.awt.Frame class). True
False
| False | While applets must themselves reside within the browser, they may create other frames. |
An applet is an instance of the Panel class in package jawa.awt. True False
| True | 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. |
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
False
| False | The CODE parameter can specify complete or relative path of the location of the class file. |
If getParameter method of an instance of java.applet.Applet class returns null, then an exception of type a NullPointerException is thrown. True
False
| False | 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. |
Applets loaded over the internet have unrestricted access to the system resources of the computer where they are being executed. True
False
| False | 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. |
An applet may be able to access some methods of another applet running on the same page. True False
| True | Only public methods can be accessed in such a fashion. |
The SecurityManager object is responsible for implementing the security policies for applets. True False
| True | Each browser has a SecurityManager that controls the access to system resources by applets. A SecurityException is thrown when a violation is detected. |
One of the popular uses of applets involves making connections to the host they came from. True False
| True | An example of this feature can be implementation of a chat functionality. |
Applets loaded from the same computer where they are executing have the same restrictions as applets loaded from the network. True
False
| False | Applets loaded and executing locally have none of the restrictions faced by applets that get loaded from the network. |
The methods init, start, stop and destroy are the four major events in the life of an applet. True False
| True | 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. |
Applets are not allowed to have contsructors due to security reasons. True
False
| False | 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. |