CS-701 Final Exam, Spring 1995

1. What is the relationship between SCCS keywords and the SCCS subcommands, "get" and "edit?"

The next two questions refer to the following function definition.



char *
myFunc(int fd, int *numBytes) {
  char *buffer;
  *numBytes = read(fd, buffer, *numBytes);
  if (*numBytes < 0) {
    perror("read in myFunc");
    return (char *) NULL;
    }
  return buffer;
  }

2. Explain what is wrong with the use of the variable buffer in the function definition, and show how to correct it.

3. Write a block of comments that would introduce this function definition properly.

4. What two pieces of information must be specified identically by a client and a server in order to create a socket connection between them? What system call does the client use to pass this information to the kernel? What system call does the server use to pass this information to its kernel?

5. How does an X Window client start its event loop executing? How does the client's code receive control once the event loop starts?

6. Two processes use a pipe for inter-process communication. One process calls:

read(fd, buffer, 1024);

Under what conditions would execution of this call cause the following actions?

A) The call blocks. When would it return?

B) The call returns a value of -1.

C) The call returns a value of 0.

D) The call returns a value between 1 and 1023.

E) The call returns a value of 1024.



Dr. Christopher Vickery
Computer Science Department
Queens College of CUNY