CPSC 100, Fall 1997:
Answers to Quiz #4

This is the fourth quiz from the course Computer Science 100: Principles of Computer Science, taught by David Eck. The answers that are included here are sample answers only. There might be many other answers to a given problem that would also receive full credit. See the home page for the text, The Most Complex Machine, for more information about the course.

Question 1: Explain the term computational universality.

Answer: Computational universality refers to the fact that, if considerations of time and memory are ignored, all computers are equivalent in the problems that they can solve. Any given computer, given enough time and memory capacity, can do anything that any other computer can do.

Question 2: What is the difference between a compiler and an interpreter

Answer: A CPU can only directly execute machine language instructions designed for that particular type of CPU. Programs written in any other language have to be translated into this machine language before they can be executed. Both compilers and interpreters are programs that translate instructions from another language into machine language. The difference is that a compiler does the translation all at once, producing a complete program expressed in machine language, while an interpreter goes through the program translating one instruction at a time and carrying it out.

Question 3: The Java programming language is unusual in that the execution of a Java program involves both a compiler and an interpreter. Explain how this works.

Answer: A Java program is compiled into Java bytecode, which is the machine language for the Java Virtual Machine. This virtual machine does not really exist. However, real computers can use a Java bytecode interpreter to execute the compiled Java bytecode program. The advantage of doing things this way is that a compiler is a complex and relatively slow program. A Java bytecode interpreter, on the other hand, can be small and relatively fast. Any computer that has a Java bytecode interpreter can execute the same compiled bytecode program. This is important for a language that is meant to be downloaded over the Internet and run on many different types of computers.

Question 4: What is the difference between a Web browser program, such as Netscape, and a Web server program?

Answer: A Web browser is used to view pages of information that have been published on the Web. A Web server is responsible for providing those pages. A Web server is a program running on a computer at some particular address, such as www.hws.edu. (Sometimes the computer itself is also called a Web server.) The server has charge of all the Web pages on that computer. It listens for requests for these pages that come in from browsers all over the Internet. When it receives a request, it replies by sending back a copy of the file that contains the page.

Question 5: What is HyperText Markup Language (HTML)? What is it used for?

Answer: HTML is the language that is used to write Web pages. A Web page is described, or specified, by an HTML file. The file contains all the text that appears on the page together with "tags" that say how the text is to be formatted, what images are to appear on the page, and so forth.

David Eck, 18 October 1997