2025/2026 CS160 MIDTERM EXAM CURRENTLY
TESTING QUESTIONS AND DETAILED CORRECT
ANSWERS (VERIFED) GUARANTEED PASS
ALREADY TOP-RATED A+.
CS160
Ace your CS160 midterm exam with this focused guide, designed to
clarify core programming concepts and their practical application. This
resource provides essential practice problems and clear explanations
covering fundamental syntax, logic structures, and debugging
techniques.
What is a process? ...... ANSWER ....... is an instance of
a running program
What type of abstractions do processes provide ......
ANSWER ....... *logical control* flow (each process
seems to have exclusive use of the cpu)
*private copy* of program state (ex: PC,Stack,general
registers, condition, codes) and virtual address space
What is multiprocessing ...... ANSWER ....... Single
Processor:
- process executions interleaved
- address spaces managed by virtual memory system
,2|Page
- register values for non executing processes saved in
memeory
MultiProcessors:
- multipul CPUs on single chip
- share main memory
- each can execute a seperate process
What is multithreading? ...... ANSWER ....... - single
process runs multipul threads concurrently
- each has own control flow and runtime state
Multithreading is a form of parallelization or dividing up
work for simultaneous processing
whats the difference between a thread and a process ......
ANSWER ....... Processes are the programs that are
programs executed on the CPU
Thread: A thread is a segment of a process which means a
process can have multipul threads. contained withing a
process
,3|Page
What is concurency? ...... ANSWER ....... When
multipul programs/threads are executing at once
What is context switching ...... ANSWER ....... when
control flow passes from one process to another
How does fork() work? ...... ANSWER ....... - creates a
new process that is identical to the calling process
- appears to create complete new copy of program state
- child and parent then execute independent processes
What does fork return ...... ANSWER ....... in the child
precess fork will return 0 and in the parent process fork
will return childs pid
How do we end a process? ...... ANSWER ....... exit(iint
status)
- exits a process, normaly returned with status 0
What is a zombie process? ...... ANSWER ....... When a
process terminates, but still consumes system resources
, 4|Page
What is the reaping? ...... ANSWER ....... - Performed
by parent on terminated child (by using wait or waitpid)
- parent is given exit status info
- Kernel discards process
How is reaping related to wait and waitpid ...... ANSWER
....... it is called in the parent in order to perform reaping
How do we get the status that shows why the child process
was terminated ...... ANSWER .......
WIFEXITED(status): returns true if the child terminated
normally
WEXITSTATUS(status): returns the exit status of the child.
This macro should be employed only if WIFEXITED
returned true.
What is an Orphan process ...... ANSWER ....... - A
child process that is still active even though parent has
terminated
- this process must be killed explicitly or else it will keep
running indefinitely