Exam with Reviewed Questions and
Answers Latest 2025/2026 GRADED A+
Suppose I'm debugging a program in GDB. If I examine a byte of memory and see that
it contains the ASCII code for 'q', which of the following can I safely conclude? -
CORRECT ANSWER-None of the above. (There are other possibilities for the byte.)
Explanation: All information is represented as a bunch of bits. The only thing that
distinguishes different data objects in the context we view them in. The byte in question
could also be part of a float or double, or it could be part of a pointer value.
Which of the following was NOT suggested by the text as a reason for the success of C?
- CORRECT ANSWER-C was designed by an ANSI standard committee.
Explanation: See page 4 of the text.
A program that merges separately compiled files - CORRECT ANSWER-Linker
A fast, temporary staging area for information - CORRECT ANSWER-Cache
An abstraction of a running program - CORRECT ANSWER-Process
,An abstraction of both main memory and disks - CORRECT ANSWER-Virtual memory
An abstraction of I/O devices - CORRECT ANSWER-File
A model defining correct instruction execution - CORRECT ANSWER-Instruction set
architecture
Suppose we are comparing two different versions of a computer program. Version B is
identical to version A except that one portion of the code has been optimized in B. If the
portion that the optimization affects accounts for 3/4 of A's execution time, what
speedup must we achieve on the optimized portion to get an overall speedup of 5? -
CORRECT ANSWER-No speedup on the optimized portion can result in an overall
speedup of 5
Explanation: Amdahl's Law is great for back-of-the-envelope calculations like this.
Suppose, for example, that we got infinite speedup on the portion of the code in
question. (This isn't realistic, but it does give us a useful bound.) The overall speedup in
this case would be 4, since we would have eliminated 3/4 of the execution time. Since
we can't do better than infinite speedup on the optimized part, there is no speedup we
can achieve that gives us a speedup of 5.
For each entry in Column A, choose from Column B the correct size of that datatype on
the Intel x86-64 architecture.
char - CORRECT ANSWER-1 byte
For each entry in Column A, choose from Column B the correct size of that datatype on
the Intel x86-64 architecture.
int - CORRECT ANSWER-4 bytes
,For each entry in Column A, choose from Column B the correct size of that datatype on
the Intel x86-64 architecture.
long - CORRECT ANSWER-8 bytes
For each entry in Column A, choose from Column B the correct size of that datatype on
the Intel x86-64 architecture.
float - CORRECT ANSWER-4 bytes
For each entry in Column A, choose from Column B the correct size of that datatype on
the Intel x86-64 architecture.
double - CORRECT ANSWER-8 bytes
Explanation: See page 40 or page 178 in the text.
The function below should return 1 if the computer it is running on uses big-endian
byte ordering, otherwise it returns 0. Choose the correct alternative for the last line of
code in the function.
int isBigEndian (void) {
int i = 0x12345678;
char *c;
c = (char *) &i;
// missing line of code goes here
} - CORRECT ANSWER-return (c[0] == 0x12);
, Explanation: On a big-endian machine, the byte containing the most-significant part of
the four-byte integer should come first -- at the big end. That corresponds to choice A.
For each of the following problems, select the response that matches the resulting value
(in hex) of the indicated variable after the corresponding code fragment executes.
Assume the code is compiled by GCC and that it executes on an x86-64 CPU.
What is the value of z after this code executes?
int x = 2;
int y = 4;
int z = (x << 3) + (y << 2); - CORRECT ANSWER-0x20
For each of the following problems, select the response that matches the resulting value
(in hex) of the indicated variable after the corresponding code fragment executes.
Assume the code is compiled by GCC and that it executes on an x86-64 CPU.
What is the value of z after this code executes?
int x = 0xabcd;
int y = 0x1234;
int z = (~x & y) | (x ^ y); - CORRECT ANSWER-0xb9f9
For each of the following problems, select the response that matches the resulting value
(in hex) of the indicated variable after the corresponding code fragment executes.
Assume the code is compiled by GCC and that it executes on an x86-64 CPU.
What is the value of z after this code executes?
int x = 0x0c;
int y = 0x03;