Midterm Review
COP-3402
Table of Contents
Exam format
| Type | Count | 
|---|---|
| Multiple choice | 6 | 
| Short answer | 7 | 
| Long answer | 3 | 
| TOTAL | 16 | 
- In-person, paper exam
 - Separate question sheet and answer sheet
- Additional blank paper will be provided
 
 - Eight double-sided pages of reasonably-sized notes permitted
 - No other items (cell phones, laptops, etc.) permitted besides a writing implement with no information
 - Put full name and NID on every page (including additional paper, scratch paper, and notes)
 - Bring your UCF ID to confirm your identify when taking and submitting the exam.
 - Review course policies
 - Midterm is worth 8pt. Each question is worth .5pt.
 
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 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?
 
Processes, advanced processes?
- how do you redirect standard (out, in) of bash command to a file? for instance, 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, let's say i want to count the results of find with wc, what do i type?
 
Editor
- How do you edit files in vim or emacs (pick one)?
 - How do you quit the editor in vim or emacs (pick one)?
 
Build automation
- What does the (target, recipe, prerequisite) of a makefile rule do.
 - By convention, what does the clean target do?
 - Here is a makefile, add a clean target to remove the binaries.
 - Write a Makefile that will create a program called 
hellofrom two source files,main.candhello.c, whenmakeis run. 
Version control
- 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?
 - What git command stages a new file?
 - What git command creates a log of the change to a staged file to the local repository?
 
File syscalls
- Using the open syscall (man 2 open, not fopen) to open a path given in the 
string char *filepathvariable. - 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
 - Write a program that uses the opendir/readdir syscalls to list the names of files in the current working directory.
 - 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?
 
Process, pipe, syscalls
- Write code that uses unix standard syscalls to create a new process that runs the ls command.
 - 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 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".