Final Review
COP-3402
Table of Contents
Exam details
| Duration | 110 minutes |
| Date and time | Wednesday, 07/29, 1600–1750 |
| Location | Lecture room, ENG2-102 |
Exam questions
| Category | Points per question | Number of questions | Total points |
|---|---|---|---|
| Multiple choice | 1 | 26 | 26 |
| Short answer | 2 | 3 | 6 |
| Long answer | 4 | 1 | 4 |
| Total | 30 | 36 |
Multiple choice question breakdown
| Material | Questions |
|---|---|
| Mid-term | 10 |
| Second-half | 16 |
Question topics and example questions
Mid-term material
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, 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, let's say I want to count the results of find with wc; what do I type?
Build automation
- What does the
makecommand do? - What do the target, recipe, and prerequisite of a Makefile rule do?
- By convention, what does the clean target do?
- Given a makefile, how can I add a clean target to remove its 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
- If I want to access the manual for a syscall, what command should I use? What if a command shares the same name as the syscall, e.g., `open`?
- 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
- 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 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".
Second-half material
Source code to processes
- Know each phase of the toolchain, what it does, and their ordering: preprocessing, compilation, assembly, linking, loading
Arithmetic
- Understand and write both SimpleIR and assembly code for arithmetic
- What assembly instructions perform arithmetic?
- Write equivalent assembly code
- Write equivalent SimpleIR code
Branching
- Understand and write both SimpleIR and assembly code for branching
- What assembly instructions perform branching?
- Write equivalent assembly code
- Write equivalent SimpleIR code
Pointers
- Understand and write both SimpleIR and assembly code for pointers
- Write equivalent assembly code
- Write equivalent SimpleIR code
- Use the register indirect addressing modes in x86 64 to implement SimpleIR pointers
Functions and their implementation
- What are the contents of the stack frame in the x86 64 System V ABI?
- How are parameters passed in the x86 64 System V ABI?
- How are variables represented and accessed in memory?
- How is the stack frame managed?
- What do the prologue and epilogue do?
- How are values returned from a function in the x86 64 System V ABI?