[ Quiz Answers | Chapter Index | Main Index ]

Quiz on Chapter 11

This page contains questions on Chapter 11 of Introduction to Programming Using Java. You should be able to answer these questions about studying that chapter. Sample answers to these questions can be found here.

Question 1:

In Java, input/output is done using streams. Streams are an abstraction. Explain what this means and why it is important.

Question 2:

Java has two types of streams: character streams and byte streams. Why? What is the difference between the two types of streams?

Question 3:

What is a file? Why are files necessary?

Question 4:

What is the point of the following statement?

out = new PrintWriter( new FileWriter("data.dat") );

Why would you need a statement that involves two different stream classes, PrintWriter and FileWriter?

Question 5:

The package java.io includes a class named URL. What does an object of type URL represent, and how is it used?

Question 6:

Explain what is meant by the client / server model of network communication.

Question 7:

What is a socket?

Question 8:

What is a ServerSocket and how is it used?

Question 9:

Network server programs are often multithreaded. Explain what this means and why it is true.

Question 10:

What is meant by an element in an XML document?

Question 11:

What is it about XML that makes it suitable for representing almost any type of data?

Question 12:

Write a complete program that will display the first ten lines from a text file. The lines should be written to standard output, System.out. The file name is given as the command-line argument args[0]. You can assume that the file contains at least ten lines. Don't bother to make the program robust. Do not use TextIO to process the file; use a FileReader to access the file.


[ Quiz Answers | Chapter Index | Main Index ]