Professional Documents
Culture Documents
(d) does not preserve all the information given in the source code
Correct answer is (d)
Your score on this question is: 7.14
Feedback:
See section 1.1.3 of the course notes.
III. If x and y are both positive, an integer greater than both will be printed.
(a) none
(c) II only
3. When debugging using Visual C++, which of the following are possible through
the Watch window?
I. The program's execution can be stopped.
II. The value of an arbitrary C expression can be calculated.
(b) II only
(c) a program that is able to control the operating system of a windows computer
(d) the simplest type of application Visual C++ can generate
Correct answer is (d)
Your score on this question is: 7.14
Feedback:
See section 1.2.1 of the course notes.
5. When executing a function callee(), which of the following are true regarding the value of the
frame pointer?
I. It marks the top of the stack frame of the function that invoked callee().
II. It marks the bottom of the stack frame of callee()
(c) II only
(d) I only
Correct answer is (b)
Your score on this question is: 0.00
Feedback:
See section 1.4.2 of the course notes.
(a) i only.
(a) 4
(b) 8
(c) 5
(a) a
(c) &a
(a) the names and values of variables in memory, interpreted as 32-bit integers no matter
what the variables' types
(b) the contents of memory, interpreted as 32-bit integers, without the associated variable
names
(c) the contents of memory, interpreted in one of several ways, without the associated
variable names
(d) the names and values of variables in memory, interpreted in one of several ways
Correct answer is (c)
Your score on this question is: 7.14
Feedback:
See section 1.3.3 of the course notes.
(c) changes the program counter only if its operand is equal to zero
12. Programs compiled for an Intel Pentium processor do not execute properly on
a SPARC processor fromSun Microsystems because
(b) the operation codes understood by the two processors are different
(d) the assembly mnemonics for the same "opcode" are different in the two processors
Correct answer is (b)
Your score on this question is: 7.14
Feedback:
See section 1.5.1 of the course notes.
13. Suppose that, using a tool such as the memory window of Visual C++, we found that a certain
set of contiguous memory locations contained the integer 0xC605CD623A8365000000. What
could these memory locations hold?
I. the integer 0xC605CD623A8365000000
II. a string
(b) I only
14. How many return addresses does a C function have as a program executes?
(a) as many as the number of return statements within the function
(b) one
Go to top of assessment.
Total score: 64.29
Your performance was as follows:
1. Which of the following does a debugger do?
I. Analyze the source code to find programming errors.
II. Decode machine code generated by a compiler.
2. Which of the following Visual C++ objects are contained within a "Project"?
I. Files
II. Visual C++ Solutions
(a) II only
(c) I only
3. Within Visual C++, which of the following will reveal the value of a variable when the program is
stopped at a breakpoint?
I. Placing the mouse pointer over the variable name in the source file window.
II. Inserting a printf() in the program.
(a) it is often necessary to start the program multiple times under the debugger
(b) the program is usually executed to the point at which the behavior occurs and then
executed backwards to find the cause
(d) it is fastest to start by stopping the debugger long before the behavior appears
Correct answer is (a)
Your score on this question is: 7.14
Feedback:
See section 1.2.4 of the course notes.
(a) 8
(b) 5
(c) 4
6. When executing a function callee(), which of the following are true regarding the value of the
frame pointer?
I. It marks the top of the stack frame of the function that invoked callee().
II. It marks the bottom of the stack frame of callee()
(a) I only
(b) II only
(c) III only
(a) 4
(b) 5
(c) 1
(d) 0
Correct answer is (a)
Your score on this question is: 7.14
Feedback:
See section 1.4.2 of the course notes.
(a) a[3]
(b) a[0] + 4
(c) a[4]
(d) the integer stored in the bytes a[4], a[5], a[6] and a[7]
Correct answer is (c)
Your score on this question is: 7.14
Feedback:
See section 1.3.5 of the course notes.
(a) i will have the value of the last element of the array a at the end of any execution of the
segment.
(c) When executed, the program will be prematurely terminated by the operating system
because of an illegal memory access.
(d) i will have the value 99 at the end of any execution of the segment.
Correct answer is (d)
Your score on this question is: 7.14
Feedback:
See section 1.3.5 of the course notes.
11. Which of the following is a good reason (are good reasons) to equip the CPU with small
amounts of fast memory?
I. To make the design of the compiler simpler
II. To make some CPU instructions smaller
(d) II only
Correct answer is (a)
Your score on this question is: 7.14
Feedback:
See section 1.5.3 of the course notes.
13. Immediately after the CPU executes an instruction that is neither a branch nor a jump
instruction, the program counter
14. Which of the following computations may be performed by exactly one CPU instruction?
I. a = 5;
II. a = b + c * 5;
(b) II only
(c) I only
1.
(c) C code
Feedback:
2.
Feedback:
(a) it is fastest to start by stopping the debugger long before the behavior
appears
(c) the program is usually executed to the point at which the behavior occurs and
then executed backwards to find the cause
(d) it is often necessary to start the program multiple times under the debugger
Feedback:
4.
Feedback:
5.
int i;
int * jp = &i;
Feedback:
6.
int factorial(int n) {
if (n == 1) return n;
(a) 5
(b) 1
(c) 4
(d) 0
Feedback:
int factorial(int n) {
if (n == 1) return n;
How many activation records are "popped" when it is invoked by the expression
factorial(4)?
(a) 4
(b) 0
(c) 1
(d) 5
Feedback:
8.
int n = * arg;
return n * n;
return square(arg);
Feedback:
9.
int i = 99;
int a[100];
i = a[i + 1];
(a) i will have the value 99 at the end of any execution of the segment.
(b) i will have the value of the last element of the array a at the end of any
execution of the segment.
(c) When executed, the program will be prematurely terminated by the operating
system because of an illegal memory access.
Feedback:
10.
In a computer in which both addresses and integers are 32 bits wide, how
many bytes of memory will the compiler allocate for following code fragment?
int a;
int * b = &a;
(a) 32
(b) 4
(c) 8
(d) 0
Feedback:
11.
Feedback:
(d) one
Feedback:
13.
0x40B7D8 i = i - 1
if (i != 0) i = i -1;
while (--i);
do { i = i - 1; } while (i);
(a) II only
(b) I only
Feedback:
14.
We want the variable factorialfunc to hold the address of the first instruction
of the following function:
int factorial(int n) {
if (n == 1) return n;
Feedback:
Go to top of assessment.