CIS 2107 006 Midterm Exam
CIS 2107 006 Midterm Exam Computer Systems and Low-Level
This exam is closed book and closed notes. You may not
use a graphing calculator, cell phone, etc.
You may use the “cheat sheets” provided (see me for a
black and white copy if the colored version isn’t readable
for you). Also, you may use a simple calculator if you’d
like, though you wi
...[Show More]
CIS 2107 006 Midterm Exam
CIS 2107 006 Midterm Exam Computer Systems and Low-Level
This exam is closed book and closed notes. You may not
use a graphing calculator, cell phone, etc.
You may use the “cheat sheets” provided (see me for a
black and white copy if the colored version isn’t readable
for you). Also, you may use a simple calculator if you’d
like, though you will be just fine without one.
If you need to leave the room during the exam, please
place your test face-down on the table in the front of the
room, and then pick it up again when you return.
There is no time limit, so please take your time and
double-check your work.
Once you are finished, hand your exam to me. At that
point, you are free to go.
If you have any questions, feel free to ask.
For each question on this exam, you can assume
the following sizes for C data types.
Type Byte
s
char 1
short 2
int 4
long 8
float 4
double 8
void * 4
1 10
2 8
3 4
4 8
5 4
6 14
7 16
8 14
9 10
10 12
Subtot
al 110
Bonus 15
CIS 2107 006 Midterm
Exam
Computer Systems and Low-Level
Programming
2019
1. (10 points) Given the directory structure depicted below, let’s assume that we are
initially starting out in the root directory (i.e. “/”). Using this information, please
respond to the following questions.
Note: Assume that you are executing each command in the order that they appear
on this page and that the results of each command may affect the context of
subsequent commands. (e.g. If you change directories, assume that for the
next command, you are starting in that directory to which you just changed.)
a. Without leaving the root directory, what command can I run to create a
directory called my_program under the directory /usr/local/src?
mkdir usr/local/src/my_program
b. What command can I run to change my current working directory from
the root directory to the directory I just created in part (a)?
cd usr/local/src
c. What command can I run to copy or move (either is fine) the file prog.c
from its original location (see above) into my current working directory?
mv home/sophias/prog.c
usr/local/src/my_program/prog.c
d. What command can I run to compile the file prog.c, naming the resultant
executable my_prog and placing it in the directory /usr/local/bin?
gcc -o ../bin/my_program/prog.c
e. If I want to run the executable program that I have just created in part (d),
how might I do this? (ask in class)
[Show Less]