UP | HOME

Midterm Review
COP-3402

Table of Contents

Exam format

Category Points per question Number of questions Total points
Multiple choice 1 13 13
Short answer 1 6 6
Long answer 5 1 5
Total   20 24

Final score: (Total points) / 3

Question topics and examples

File systems

  • What makes the Unix file system "hierarchical"?
  • What is the difference between absolute vs. relative paths?
  • How are parent directories referenced in the file system?
  • Given a tree, which file is being reference by a given path?
  • Draw a file system tree.

Navigation

  • What is the working directory and how do you display it?
  • What is the Unix standard command to rename a file?
  • What is tab-completion?
  • What Unix standard command will show you the text of a file?
  • What does grep do?
  • How do you change the working directory to your home directory?
  • What is the Unix command to delete a file?
  • How does the implementation of deleting a file work? Does it remove the file's contents from the storage medium?
  • What is the difference between hard links and symbolic (soft) links?
  • What Unix standard command can I use to view help for shell commands that are programs?
  • What shell builtin can I use to check whether a shell command is a program or a shell builtin?
  • What shell builtin can I use to view help for other shell builtins?

Processes, advanced processes?

  • How do you redirect standard (out, in) of bash command to a file? For instance, if I want to redirect grep's (out, in) to the file grep.txt what do I type?
  • How do you redirect standard out from one command to another command's standard in? For instance, if I want to count the results of find with wc, what do I type?

Build automation

  • What does the (target, recipe, prerequisite) of a makefile rule do?
  • Write a Makefile that will create a program called hello from two source files, main.c and hello.c, when make is run.
  • By convention, what does the clean target do?
  • Given a makefile, add a clean target to remove the binaries.

Version control

  • What git command stages a new file?
  • What git command creates a log of the change to a staged file to the local repository?
  • What git command copies commits from the local repository to the remote repository?
  • What git command copies commits from the remote repository to the local repository?

File syscalls

  • Using the open syscall (man 2 open, not fopen) to open a path given in the string char *filepath variable.
  • How do you check for and terminate the program on an error with opening a file?
  • Using the read syscall (man 2 read, not fopen), you already have an open file with the file descriptor stored in fd, read the first 200 bytes of the file and print it to stdout
  • What syscall can you use to find the (size, number of hard-links) of a file?
  • What syscall can you use the find the name of a file?
  • Write a code snippet that will print all files in a given directory, except do not print the "." and ".." names

Process, pipe, syscalls

  • Write code that creates a new process, where the original process writes "parent" and the new process writes "child", both to stdout.
  • Write code that replaces the current processes running program with the stat/ls command (not the stat syscall).
  • Write code that uses Unix standard syscalls to create a new process that runs the ls command.
  • Write a program that opens a pipe and reads to and writes from it.
  • Write a program that redirects the standard output to a file called "output.txt".

Author: Brent Pappas

Created: 2026-03-12 Thu 13:52

Validate