QUIZ

CHAPTER 12

Your Name:


12.1 Which of the following best describes what an applet is?
(a) a program stored on the local hard-drive, run from the command prompt
(b) a program stored on a remote system that is transferred to the local system and run within a web browser
(c) a program stored remotely that is executed remotely, with the results transferred to the local system and displayed in the web browser
(d) a program stored remotely that is executed remotely, with the results transferred to the local system and displayed in the Java console window or command prompt window

12.2 What does interpretation mean, in the sense of a Java program?
(a) the compiler decides what your code is supposed to mean, then creates an executable file, using a translating dictionary, that will run the program
(b) the compiler generates byte-code as an intermediate step, which is then stored on the hard-drive as an executable file
(c) the compiler generates byte-code from your source-code and stores this byte-code in a binary form in a class file. When you run the program, a module called the Java Virtual Machine reads the byte-code and converts it into machine-code, which is then executed in the normal fashion. This ensures that the program can be run anywhere
(d) the compiler will read any strings you have within your code and translate them into all the languages of the world, so that your program can be run anywhere

12.3 What are the advantages of having applets in web pages?
(a) less network traffic, faster code execution due to local execution, and having access to the full facilities of Java
(b) more hits to your web page
(c) answer (a), as well as enhanced security
(d) giving a remote programmer access to the user's machine

12.4 An applet stops executing when
(a) a new web page is loaded into the browser
(b) the user clicks on the applet's Close button
(c) a call is made to System.exit()
(d) when the user scrolls beyond the applet

12.5 The default layout for an applet is
(a) GridLayout
(b) BoxLayout
(c) BorderLayout
(d) FlowLayout

12.6 HTML stands for
(a) Hyperspace Marketing for Mobile Links
(b) Hypertext Mark-up Language
(c) How To Make Links
(d) Hyperlinks, Tables, Movies and Lists

12.7 What is most novel about Java's approach to applets?
(a) all the books needed to describe it
(b) doing all the work on the host site
(c) making more money from web surfers
(d) genetic engineering to make things smaller

12.8 If an applet includes lines to print to a console (System.out.println()), where can the output be found?
(a) the printer
(b) the command prompt window
(c) it does not get displayed anywhere
(d) in the browser's Java console window

12.9 Which of the following best describes what privileges an applet has that is stored on a remote machine and loaded in a browser?
(a) connecting back to the host and creating a pop-up window
(b) accessing local files, running another program, calling exit and creating a pop-up window
(c) finding out the local machine's name and passwords, formatting the hard-drive and loading a Java library
(d) no privileges

12.10 What are observers, in a Java applet's context?
(a) objects in Java that keep track of how much of an image is loaded, allowing the applet to continue execution
(b) objects in Java that keep track of how much of an image is loaded, pausing the applet's execution until the image is fully loaded and displayable
(c) Java methods which can be called to handle remote events
(d) Java methods on the applet's remote machine which are automatically called when a corresponding local listener is called