Final Review
COP-3402
Table of Contents
Exam details
| Duration | 2 hours |
| Date and time | Thursday, 12/04, 1000–1200 |
| Location | Lecture room, HEC-0125 |
| Format | 32 multiple choice questions |
Question topics and example questions
| Material | Questions |
|---|---|
| Mid-term | 14 |
| Second-half | 18 |
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, 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 or emacs (pick one)?
- How do you save a file in emacs (pick one)?
- How do you quit the editor or emacs (pick one)?
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
- 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?