📄 ssd6-choice.txt
字号:
7.
Activation records are organized in stacks because
(a) functions need to access all the variables of the functions that call them.
(b) they are seldom needed during program execution.
(c) stacks allow activation records to be pushed and popped in any order.
(d) stacks are simple enough for the hardware to manage.
Correct answer is (d)
Your score on this question is: 0.00
Feedback:
See section 1.4.2 of the course notes.
--------------------------------------------------------------------------------
8.
Consider the following program segment.
int factorial(int * arg) {
int n = *arg;
if (n == 1) return n;
return n * factorial(n - 1);
}
When the segment is executed, the variable n is allocated to
(a) just one address, and it is not known to the compiler
(b) many addresses none of which is known to the compiler
(c) many addresses that were chosen by the compiler
(d) just one address, and it was chosen by the compiler
Correct answer is (b)
Your score on this question is: 7.14
Feedback:
See section 1.4.1 of the course notes.
--------------------------------------------------------------------------------
9.
In a computer in which both addresses and integers are 32 bits wide, how many bytes of memory will the compiler allocate as a result of the following pointer declaration?
int * pointer;
(a) 4
(b) 0
(c) 64
(d) 8
Correct answer is (a)
Your score on this question is: 7.14
Feedback:
See section 1.3.2 of the course notes.
--------------------------------------------------------------------------------
10.
Consider the following segment of a C program.
int i = 99;
int a[100];
i = a[i + 1];
Which of the following is true of the segment?
(a) When executed, the program will be prematurely terminated by the operating system because of an illegal memory access.
(b) Execution will fail because a has the wrong size.
(c) i will have the value 99 at the end of any execution of the segment.
(d) i will have the value of the last element of the array a at the end of any execution of the segment.
Correct answer is (c)
Your score on this question is: 7.14
Feedback:
See section 1.3.5 of the course notes.
--------------------------------------------------------------------------------
11.
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;
return n * factorial(n -1);
}
How would we declare the variable?
(a) factorial() * factorialfunc;
(b) we can't: C cannot extract the addresses of instructions.
(c) int (*factorialfunc)(int);
(d) int (int) * factorialfunc
Correct answer is (c)
Your score on this question is: 7.14
Feedback:
See section 1.5.2 of the course notes.
--------------------------------------------------------------------------------
12.
Which of the following computations may be performed by exactly one CPU instruction?
a = 5;
a = b + c * 5;
for (i = 0; i < 10; i += a[i++]);
(a) II only
(b) I, II, and III
(c) I only
(d) I and II only
Correct answer is (c)
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?
the integer 0xC605CD623A8365000000
a string
a CPU instruction
(a) III only
(b) I and II only
(c) I, II, and III
(d) I only
Correct answer is (c)
Your score on this question is: 7.14
Feedback:
See section 1.5.1 of the course notes.
--------------------------------------------------------------------------------
14.
Which of the following are true of the effect that optimizations have on the machine code generated by compilers?
The resulting code will be faster and/or smaller.
The resulting code will be clearer.
The resulting code will be harder to debug.
(a) I and II only
(b) I and III only
(c) I only
(d) I, II, and III
Correct answer is (b)
Your score on this question is: 7.14
Feedback:
See section 1.5.3 of the course notes.
--------------------------------------------------------------------------------
Go to top of assessment.
Total score: 92.86
? Copyright 2005 iCarnegie, Inc. All rights reserved.
View Assessment Result
Family Name: Li
Given Name: Qin
Login: nwpu053816
E-mail: lqw3816@163.com
Status: Enrolled
Assessment Name: Multiple-Choice Quiz 2
Instance: 1
Section: NWPU-SSD6-6
During: Fall/Autumn 2007
Section Status: Active
For course: System-Level Programming
(SSD6)
Corresponding to: SSD6
At: Software College of Northwestern Polytechnical University
--------------------------------------------------------------------------------
Your performance was as follows:
You took 30 minutes on this assessment from Thu Nov 29 08:30:27 UTC+0800 2007 to Thu Nov 29 09:00:05 UTC+0800 2007.
Total score: 57.14
1.
In C, assuming that an int takes 4 bytes, how many bytes are required to represent the following array?
int a[12];
(a) 12
(b) 48
(c) 52
(d) 44
Correct answer is (b)
Your score on this question is: 14.29
Feedback:
See section 2.4.1 of the course notes.
--------------------------------------------------------------------------------
2.
How many bytes are allocated by the following C declaration and initialization?
char s[] = "quiz";
(a) 5
(b) 4
(c) 20
(d) 16
Correct answer is (a)
Your score on this question is: 14.29
Feedback:
See section 2.4.1 of the course notes.
--------------------------------------------------------------------------------
3.
Assume that array a is at location 1000 (decimal). Execution of the following program results in what being printed?
int a[12];
main() {
int i;
for (i = 0; i < 12; i++) a[i] = i;
printf("%d\n", *(a + 5));
}
(a) 5
(b) 1005
(c) 20
(d) 1020
Correct answer is (a)
Your score on this question is: 0.00
Feedback:
See section 2.4.1 of the course notes.
--------------------------------------------------------------------------------
4.
In modern computers, each address represents one _____ of memory.
(a) bit
(b) page
(c) byte
(d) word
Correct answer is (c)
Your score on this question is: 0.00
Feedback:
See section 2.2.1 of the course notes.
--------------------------------------------------------------------------------
5.
What is the purpose of the exponent in floating point numbers?
(a) to indicate where the decimal or binary point should be
(b) the mantissa is raised to the power of the exponent
(c) to specify the base as binary, octal, or hexadecimal
(d) to specify the superscript
Correct answer is (a)
Your score on this question is: 0.00
Feedback:
See section 2.3.1 of the course notes.
--------------------------------------------------------------------------------
6.
What is the value of the following C expression?
0x1234 ^ 0x5432
(a) 0x5434
(b) 0x1030
(c) 0x5636
(d) 0x4606
Correct answer is (d)
Your score on this question is: 14.29
Feedback:
See section 2.1.3 of the course notes.
--------------------------------------------------------------------------------
7.
In C, what is the following binary number in hexadecimal?
11010101
(a) 0x5D
(b) 0xAB
(c) 0xB5
(d) 0xD5
Correct answer is (d)
Your score on this question is: 14.29
Feedback:
See section 2.1.2 of the course notes.
--------------------------------------------------------------------------------
Go to top of assessment.
Total score: 57.14
? Copyright 2005 iCarnegie, Inc. All rights reserved.
View Assessment Result
Family Name: Li
Given Name: Qin
Login: nwpu053816
E-mail: lqw3816@163.com
Status: Enrolled
Assessment Name: Multiple-Choice Quiz 2
Instance: 2
Section: NWPU-SSD6-6
During: Fall/Autumn 2007
Section Status: Active
For course: System-Level Programming
(SSD6)
Corresponding to: SSD6
At: Software College of Northwestern Polytechnical University
--------------------------------------------------------------------------------
Your performance was as follows:
You took 15 minutes on this assessment from Thu Nov 29 09:03:48 UTC+0800 2007 to Thu Nov 29 09:18:43 UTC+0800 2007.
Total score: 85.71
1.
In C, assuming that an int takes 4 bytes, how many bytes are required to represent the following array?
int a[12];
(a) 44
(b) 52
(c) 48
(d) 12
Correct answer is (c)
Your score on this question is: 14.29
Feedback:
See section 2.4.1 of the course notes.
--------------------------------------------------------------------------------
2.
How many bytes are allocated by the following C declaration and initialization?
char s[] = "quiz";
(a) 16
(b) 5
(c) 20
(d) 4
Correct answer is (b)
Your score on this question is: 14.29
Feedback:
See section 2.4.1 of the course notes.
--------------------------------------------------------------------------------
3.
Which of the following statements about alignment within C struct's is true?
Alignment may cause the allocation of unused space.
Alignment is required by all modern processors.
Alignment can help processors access data more efficiently.
(a) I and III only
(b) II and III only
(c) I, II, and III
(d) I only
Correct answer is (a)
Your score on this question is: 0.00
Feedback:
See section 2.4.3 of the course notes.
--------------------------------------------------------------------------------
4.
In modern computers, each address represents one _____ of memory.
(a) word
(b) byte
(c) bit
(d) page
Correct answer is (b)
Your score on this question is: 14.29
Feedback:
See section 2.2.1 of the course notes.
--------------------------------------------------------------------------------
5.
Why is the mantissa of a floating point number shifted left as far as possible?
(a) to avoid overflow
(b) to avoid underflow
(c) to align bit positions, simplifying addition
(d) to retain as much precision as possible
Correct answer is (d)
Your score on this question is: 14.29
Feedback:
See section 2.3.1 of the course notes.
--------------------------------------------------------------------------------
6.
In C, what is the following binary number in hexadecimal?
11010101
(a) 0xAB
(b) 0x5D
(c) 0xB5
(d) 0xD5
Correct answer is (d)
Your score on this question is: 14.29
Feedback:
See section 2.1.2 of the course notes.
--------------------------------------------------------------------------------
7.
What is the value of the following C expression?
0x1234 >> 5
(a) 0x0092
(b) 0x0000
(c) 0x0091
(d) 0x00A3
Correct answer is (c)
Your score on this question is: 14.29
Feedback:
See section 2.1.3 of the course notes.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -