CS 47 Midterm 2 Study Guide
This material is designed to get you to think about the
kinds of facts that are important in this class. I make no claim that it is
comprehensive. There are topics that may not be mentioned in this guide that are
on the final because they appear in the textbook or in my notes.
Ch 7. Evaluating the Instruction Set Architecture of H1: Part 1
- What is the difference between CISC and RISC? What prompted the development
of RISC technology?
- Explain what is ISA.
- What differentiates a dumb compiler from a smart one?
- What is constant folding and what are examples of how it is handled?
- In C++ what is a global variable? How are global variables handled by
the assembler?
- What is the scope of a variable? What is the scope of a local variable in
C++ ? How about a global variable in C++ ?
- If x is associated with a global variable in an assembly version of a C++ program,
what is the difference between ldc x and ld x ?
- How are dynamic local variables and static local variables treated differently
by the compiler?
- How does the compiler distinguish between static local variables and global variables
with the same name?
- Where are dynamic local variables stored?
- What is the difference between the push instruction and the aloc instruction?
- Compare call by value and call by reference. Isn't what gets sent to a function
always a copy of some value that we place on the stack?
- Given a function that takes a fixed number of parameters, what is the sequence of
assembly instructions necessary to handle the communication between the calling function
and the called function?
- How are values returned by a called function?
- Where are dynamic local variables stored? How do we get the address of the location
when we need it?
- Be sure you understand the C++ meaning of things like &x, *y.
Ch 8. Evaluating the Instruction Set Architecture of H1: Part 2
- How do we implement call by reference?
- How do we access and use reference parameters in the called function? How do we
pass reference parameters from the calling function?
- Make sure you understand the meaning and the use of z in each of the
two forms: void f(int &z) and void f(int *z).
- What is the need for name mangling? What can you tell from the mangled name of
a function?
- Be able to work with C++ structs. You should be able to define them, create
variables of struct types, create and use pointers to structs.
- How are global arrays defined in assembly language? How about dynamic local arrays?
- Make sure you understand the close relationship between the name of an array and
a reference to its 0th element.
- Each of the control structures in C++ has an assembly form. Be sure you are
able to translate C++ control structures to assembly language.
- Can you translate a C++ recursive function into assembly language?
- Can you follow the contents of the stack during the course of a series of
recursive function calls?
Ch 9. Advanced Assembly Language Programming
- First of all, be sure you understand in C++ what a pointer to a pointer
is and how it is represented in the C++ language.
- Do you understand how the C++ program in Figure 9.3 gets converted
to assembly language?
- Do you understand the use of pointers to pointers in the linked list
example? Why did we have to have a pointer (headp) to the pointer (head)
in the add_node function?
- How do we handle function calls where the parameter is an expression?
- What if the parameter is a reference parameter; how is that handled?
- How are boolean expressions evaluated? How is a true value or false
value represented in C++ (and the resulting assembly language program)?
- what is short-circuit evaluation?