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)

  1. remove pr*.pas
  2. remove progm*.pas
  3. remfiles progm1.pas progm2.pas
  4. erase progm*.pas
  5. erase prog*.pas

 

5.        The compiler translates a high level language to:

  1. another high level language
  2. English
  3. machine instructions
  4. pseudo-code
  5. none of the above

 

6.        Which of the following are output devices?

  1. keyboard and monitor
  2. monitor and printer
  3. mouse and monitor
  4. central processing unit
  5. mouse and keyboard

 

7.        Which of the following is the method to get to the root directory from one of its subdirectories?

  1. cd
  2. cd \
  3. cd root
  4. cd \root
  5. none of the above

 

8.        Which of the below commands is the easiest way to copy all the files from one floppy to another?

  1. cp a: b:
  2. cp a:*.* b:*.*
  3. transfer a: b:
  4. copyall a: b:
  5. diskcopy a: b:

 

9.        Which of the following is responsible for the arithmetic or logical calculations in a computer?

  1. mouse
  2. memory
  3. central processing unit
  4. all three of the above (a, b and c)
  5. none of the above

 

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  

 

 

  1. (1 point) What is the name of the instructor of the this course ?

 

 

 

  1. (1 point) What is the name of your TA ?