1. Define the terms macro, function call, and system call. Tell what features of each contributes to its execution time.
  2. Tell what the setenv command does. Tell what the getenv() function does. Name three different environment variables that you have encountered this term, and tell what each is used for.
  3. List in order the programs that may be invoked by a compiler driver such as g++ and tell what operation is performed by each program. Describe these operations by telling what information is in the files that are read by the program and what information is in the files that are written by the program.
  4. For this question, assume that all the C programs involved are "simple" in the sense that they do not make calls to functions defined in any library other than the standard C library. Draw a box around each Makefile, and label the boxes "1" and "2."
    1. Write the simplest Makefile possible that would allow a C program named x to be built from a source file named x.c when a user types the command make with no command line arguments.
    2. Write a Makefile that would cause the command "make x" to build a program from two source files, a.c and b.c, both of which include a header file named b.h. The same Makefile also causes the files x, a.o, and b.o to be deleted if the user types "make clean."
  5. Assume a program named x contains a function named func_a() which contains a statement, "my_value = this_value * that_value;" Tell exactly how to use gdb to look at the values of each of the three variables immediately after this statement is executed. Include in your answer all of these pieces of information: How to compile the program so it can be used with gdb; How to invoke gdb to debug the program; How to get execution to reach the statement in question as efficiently as possible; How to display the values of the variables.
  6. Give function prototypes for fork() and execve(), document each argument and return value, and tell what each function does.

Christopher Vickery
Queens College of CUNY
Home Page