Midterm Question and answers already
passed
What are the Linux commands that were taught in class and what do they
mean? - correct answer ✔wget: download a file from the internet
cd: change the working directory
cp: copy files and directories
mkdir: make empty directories
tar: work with .tar archive files of directories
mv: move or rename files
scp: copy files, usually between two computers
gcc: compile a program including ones written in C
ls: list directory contents
touch: create a blank file if it does not already exist; if file does exist update its
modification timestamp to the present time
pwd: print name of current/working directory
hostname: show the name of the computer
rm: delete files or directories
ssh: connect to a remote machine
diff: compare two files line by line (assuming they are text files)
history: show a list of most recently entered commands
top: display a table of processes (i.e., programs) being run by users of the
computer
man: show the manual documentation for a command
grep: search for text in files
make: invoke Makefile to compile a program
, What is the format string in printf(char* format, args)? - correct answer ✔%d:
integer
%ld: long integer
%c: character
%s: string
%f: float
%p: pointer
After breaking down gcc -Wall -Werror -fsanitize=address -std=c99 -o
pythagorean pythagorean.c -lm, what does each part mean? - correct answer
✔gcc: GNU C Complier
-Wall -Werror: enable helpful warnings
-fsanitize=address: enable memory checking
-std=c99: Set C standard version number
-o pythagorean: output binary
pythagorean.c: source file
-lm: link the math library implementation
What are pointers? What are Dereference and Reference? - correct answer
✔A pointer is a type of variable that stores the address of another variable in
memory
- Allows us to indirectly access variables
Declaration: int*, double*, char*, etc
Pointer Operations:
-Dereference: (*p) - returns the value pointed by p