1. If your e-mail doesn't go through, you'll receive a warning message. Most Unix systems will continue trying to send it for 3 days, and you'll receive warning messages each time an attempt fails. If the system ultimately gives up, it will send you a message to that effect.
2. "Outline" is an alternative way to view and reorganize your document in Microsoft Word.
3. The top left triangle in the MS Word ruler controls the left margin of the first line of the paragraph. The bottom left triangle controls the rest of the lines.
4. Web pages are written in HTML (HyperText Markup Language, which is a type of SGML (Standard Generic Markup Language).
5. An rtf (rich text format) file contains all the formatting information for a document. It can be transferred between different word processing programs and even different computing systems (PC, Mac).
6. The "Stand on Taxes" column has paragraphs that "wrap" (continue onto the next line) within the column. That's very tedious to do without the Table feature. The other two tables could be done easily with tabs (in fact, they were).
7. The home page needs to be on a server that's always (or usually) on-line. That's inconvenient to do with a home PC unless you have a special phone line installed.
8. The thrust of the DoD effort was to design a reliable system -- one that didn't depend on any central computer, and that could still carry messages even if one or many machines were destroyed. The Internet itself is not owned by the DoD, but it incorporates many of the reliability features.
9. Technically, Netscape is a "browser," which is your window into functionality and data provided by other computers. Netscape itself can only display web pages (or edit them, in some of the most recent versions). But by displaying the pages, Netscape allows your machine to act as a "client" to distant "servers". Those servers do the actual work of searching the network for the information you've requested. (In the CU computer labs, Netscape's print function also calls on a server.)
10. Binary numbers (base 2) are useful because they are noise resistant and simple for computers to work with. Digital data, usually represented in binary form, is useful because it allows all kinds of information (graphics, sounds, numbers) to be stored on computers, transmitted over computer networks, and analyzed with computer programs. The alternative to digital data is analog data -- continuously variable volume, tone, color, etc., like old-style phonograph records and photography.
11. Most computer users can do everything they need without programming. Apple was probably the first to recognize this when they shipped the Macintosh without a programming language -- something that many users of personal computers found very strange at the time.
12. When the computer is shut off, data is still held in ROM (Read Only Memory. RAM requires power to constantly refresh its contents. (The CPU has a small amount of memory, in "registers", and those also require power.)
13. Probably the two main reasons for increasing power in personal computers are faster clock speeds and large data word sizes. "Moore's Law", proposed by one of the most influential engineers in the semiconductor industry, states that the power of state-of-the-art computer CPUs doubles every two years. The law has held true for almost two decades, even though scientists keep predicting that we're nearing a theoretical maximum level of performance. (Another important reason for increasing power available to consumers is the increasing use of multiple processors, in both parallel and distributed applications.)
14. Experienced users typically scan the tutorial materials to get a feeling for what the new software will do. Then they wait until they have a real job to perform with the software and learn it using trial and error, along with assistance as needed from on-line help, manuals, and other users. Because new software versions and packages are introduced so frequently, most users find that they don't have the time to take classes or make an extensive effort to learn something in detail before they really need it. (However, you do need some basic skills to build on -- the homework in this class should force you to develop those basic skills.)
15. In MS Word, you can copy the paragraph marker (the stylized, backwards "P") from the end of the formatted paragraph to the end of the one you want to format. This is often useful when you have just a couple of paragraphs that need special treatment, and you don't want to give them a named Style.
16. GOTO is actually a very powerful statement, and it lets the programmer do anything that could be done with while loops and other "structured programming" constructs. It also makes it easy to write quick programs -- whenever the program needs to branch or loop, just stick in another GOTO. Unfortunately, the resulting programs are so convoluted that they are almost impossible to check or revise, even by the programmer who created them.
17. The result of any trial depends on the data you use. Trial-and-error alone can't predict with certainty how a program will behave when it runs with the user's data. Of course, you will use some trial-and-error to test your understanding of what you read in the official description of a programming language's behavior. However, you should be using it as a supplement to the manual, not the other way around.
18. Effective programming for interactive systems relies on (1) early and continual focus on users and their tasks, and (2) "iterative" development, in which programs are repeatedly designed, tested, revised. Note that simply testing the program with users isn't enough -- you have to start out by finding out what the users want, then go back several times to see if you've got it right.
19. copy a:data.txt c:\windows\temp (There are some variations on this that will also work.)
20. Variables must be declared to the compiler in the var statement so it will know (1) to reserve space in RAM and (2) how to treat the data that's placed there (as an integer, a real, a character, an array of reals, etc.)
21. If the loop doesn't terminate, check to make sure that (1) the variable controlling the loop was properly initialized, (2) the boolean test is correctly written, so it will eventually become false, and (3) that the variable is actually being changed by the action of the body of the loop. (For critical software, these conditions can be represented formally, and it can be proven without running the program that the code will never produce an infinite loop.)
22. Division and multiplication have "precedence" over addition and subtraction, which means the computer always performs them first. In effect, the compiler adds its own parentheses, so the code looks like:
x := y + (z/5) + (w*w) + 5;
23. x must be declared as real. The compiler can't predict what value z will have, so it demands that you declare an x that can hold the result in cases where z/5 doesn't produce an integer.
24. In the var statement after "real" add a semicolon. In the line "y:=x;" delete the semicolon, because you cannot have one immediately before an "else". The semicolon in the line "writeln(x);" is optional -- there are no more statements before "end", so there's no need to put in a statement separator (which is what a semicolon is in Pascal).
25.
program showDiscount;
var listPrice, discount, sellPrice: real;
{ in the next line...
we've changed "procedure" to "function"
we've deleted "var sp: real" from the parameters
we've added ":real" after the parameter list }
function calcSP (lp, dis: real): real;
begin
{ in the next line, we've changed "sp" to "calcSP" -- that
tells the compiler, do the calculation and return it (in
a CPU register) as the result of this function }
calcSP := lp * (1 - dis);
end;
begin
writeln('Enter list price and percent discount');
readln(listPrice,discount);
{ in the next line...
we've added "sellPrice := " -- that's because
the entire function call "turns into" the result, and
it must be immediately used or assigned to some other
variable for later use.
we've also deleted "sellPrice" from the parameter
list, to match the parameter list where the function
is declared }
sellPrice := calcSP(listPrice,discount);
writeln('Selling price is" $', sellPrice:6:2);
end;
26. Some of the things programmers do to make Pascal programs (and programs in other languages) more readable are: use meaningful identifier names (variables, programs, procedures, ...), indent and space the code to show its structure, use comments (in {} ), and use logical processes, structure, and modularization.
27. a. The calling program can send data to the procedure through all
of the parameters: A,B,M,N. We usually use value parameters to send
data (A,B), but sometimes it's appropriate to do it with variable parameters
(M,N). For example, arrays are often too large to pass by copying (value),
so we would send their address to the procedure (variable parameter) even
if the procedure only needed to read the array.
b. Only the variable parameters (M,N) allow the procedure to send
data back to the program that called it. (A function could send data
back through its return value.)
Note that X and Y are not parameters at all. They are variables,
"local" to the procedure. The procedure can use them, but when it is
finished, their value is lost.
28.
{ read lines containing n1 and n2 from 'c:\data.txt' }
{ multiply n1 * n2 and write result to screen }
program multiplyIntsFromFile;
var
n1, n2, product: integer;
inFileID: TEXT; { declare file variable }
begin
assign(inFileID,'c:\data.txt'); { associate file_var with name }
reset(inFileID); { prepare to read at start of file }
while not eof(inFileID) do { read until end of file }
begin
readln(inFileID,n1,n2); { read one line (two ints) }
product := n1*n2;
writeln('Product is', product);
end;
close(inFileID); { release file so others can use }
end.