Quiz 1b Name:
_____________________
CPSC 110 Section:
____________________
(c)opyright 2002 Brent M. Dingle ID:
________________________
Part I -- Choose the best answer (each question is worth 2 points)
1. A directory can contain only files in it ( T / F ).
2. A program must be stored in secondary memory while being executed by the computer ( T / F ).
3. Pascal is a low level language ( T / F ).
4.
Assume that the only files in the current directory are
progm1.pas, progrm1.pas,
progm2.pas and program.pas.
What command will ONLY remove the files progm1.pas and progm2.pas ?
(i.e. program.pas and progrm1.pas will not be removed, but the other two files will be)
5. The compiler translates a high level language to:
6. Which of the following are output devices?
7. Which of the following is the method to get to the root directory from one of its subdirectories?
8. Which of the below commands is the easiest way to copy all the files from one floppy to another?
9. Which of the following is responsible for the arithmetic or logical calculations in a computer?
Part 2
c:\ a:\
JOHN CASEY INVENTORY PAYROLL
CP610 CFILES PAS_FILES STUDENTS FACULTY
hello.c average.pas data.txt pete.txt jim.txt
NOTE: JOHN, CASEY, CP610, CFILES, PAS_FILES, INVENTORY, PAYROLL, STUDENTS,
FACULTY are directories.
hello.c, average.pas, data.txt, pete.txt, jim.txt are files.
1. (1 point) Give the full path name of pete.txt: _____________________________________________
3. (2 points) The current directory is PAYROLL.
Write a command to copy the file pete.txt to the directory CFILES in drive c:
2. Suppose the current directory is PAYROLL:
a. (2 points) What is the output to the screen when the command dir a: is issued ?
b. (2 points) Write a command to create a subdirectory STAFF under PAYROLL: ________________
4. The current directory is PAS_FILES.
a. (2 points) Write a command to change to the directory CFILES: __________________________
b. (2 points) After the command in 4a is executed, write a command to change the name of the file
hello.c to greeting.c.
5. The current directory is PAYROLL.
a. (2 points) Write a command to change the current directory to its parent directory (note that the
parent directory of PAYROLL is the root directory of a: )
c. (2 points ) After the command in 5a is executed, write a command to remove the directory
INVENTORY.
PART 3 – This part requires that you use the computer ( each question is worth 2.5 points)
NOTE: When you are asked to list menu items that you selected, give both the menu name and the name of the item in that menu. For example, "File | Save"
PROGRAM SquareRoot;
VAR
value : integer;
square_root : real;
BEGIN
write('Enter an integer and I will compute its square root: ');
readln(value);
square_root := sqrt(value);
writeln('The square root of ', value, ' is: ', square_root:5:3);
END.
1. (2.5 points) Enter the Turbo Pascal environment and list all the steps you went through (i.e. what menu items did you click on, what keys did you press, etc).
2. (2.5 points) Type in the above program and save it to the current drive under the name "First.pas".
List all the commands you used (again menu items and/or keys pressed).
3. (2.5 points) Compile the program and run it on the input data your TA assigned. Write the output of the program.
4. (1.5 points) What error do you get if you change the type of the variable square_root to integer instead of real (write the error message).
(1 point) What is this type of error called: syntax error or run time error ?
5. (1.5 points) Run the above program on input: -4 Write the error message you get:
(1 point) What is this type of error called: syntax error or run time error ?
6. (2.5 points) Exit Turbo Pascal and logoff your account. List all the steps that you went through.
PART 4 – Easy Part