CS-701 Midterm Exam, Spring 1996
1.
- Define "signal handler."
- Tell how the signal() system call would relate to a
signal handler.
- Tell what causes signal handlers to be called in general.
- Tell what causes the function named sig_int() in Program
1.8 to be called in particular.
2.
- List all the processing programs that might be invoked by
a compiler driver in the sequence in which they would be invoked.
- Give an example of a command line that would invoke all of
the processing programs.
- Give an example of a command line that would invoke all but
the last of the processing programs.
- Give an example of a command line that would invoke only the
last of the processing programs.
3.
- What is the advantage of using gdb compared to the
use of output statements inserted into a program.
- What is the advantage of using ddd compared to the
use of gdb.
4. Which would take longer to execute, and why:
- A call to read() to read one byte of data, or a call
to strcmp() to compare two 20-byte strings?
- A call to lseek() to move from the beginning of a 1
MB file to its end, or a call to read() executed immediately
after this call to lseek()?
5. Define and describe "file descriptor" and the FILE
data structure. Tell how each is used, and how the two are related
to each other.
6. Tell how to define a program element so that it occupies each
of the following regions of a program's address space: code,
constant data, variable data, stack, heap.
7. A call to times() gives three different pieces of timing
information about a process. Name and define all three.
8.
- How are all Unix processes created, and what is the one exception
to this?
- Trace the process ancestry of a process that runs a command
you type, such as ls. Your answer should tell what programs
were executed by each process in the chain, back to the process
with pid 1.
9.
- How can a user give a value to an environment variable from
the command line?
- How can a user see the value of an environment variable from
the command line? (There are at least two correct answers.)
- How can a program determine the value of an environment variable
while it is executing?
- How does the environment variable PATH relate to
the execlp() system call?
Dr. Christopher Vickery
Computer Science Department
Queens College of CUNY