?? ssd6-choice.txt
字號:
--------------------------------------------------------------------------------
Go to top of assessment.
Total score: 85.71
? 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: 3
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 13 minutes on this assessment from Thu Nov 29 09:22:28 UTC+0800 2007 to Thu Nov 29 09:35:11 UTC+0800 2007.
Total score: 100.00
1.
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 only
(b) I and III only
(c) II and III only
(d) I, II, and III
Correct answer is (b)
Your score on this question is: 14.29
Feedback:
See section 2.4.3 of the course notes.
--------------------------------------------------------------------------------
2.
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) 1005
(b) 5
(c) 1020
(d) 20
Correct answer is (b)
Your score on this question is: 14.29
Feedback:
See section 2.4.1 of the course notes.
--------------------------------------------------------------------------------
3.
Given the following declarations, h[] takes 7 bytes and t[] takes 6 bytes. What is the minimum amount of memory (in bytes) required to store the concatenation of h and t?
char h[] = "hello ";
char t[] = "there";
(a) 12
(b) 14
(c) 11
(d) 13
Correct answer is (a)
Your score on this question is: 14.29
Feedback:
See section 2.4.1 of the course notes.
--------------------------------------------------------------------------------
4.
In a computer with 4-byte words, which of the following C expressions tests whether ptr contains the address of a word?
(ptr & 3) == 0
(ptr | 3) == 0
(ptr % 4) == 0
(a) III only
(b) I only
(c) I and III only
(d) II only
Correct answer is (c)
Your score on this question is: 14.29
Feedback:
See section 2.2.1 of the course notes.
--------------------------------------------------------------------------------
5.
In C, using default floating point settings, what happens when a floating-point computation results in an overflow?
(a) A special value "infinity" is computed, testable with _finite().
(b) An exception is raised unless disabled by calling _controlfp().
(c) An erroneous value is computed and execution continues.
(d) Program execution is halted.
Correct answer is (a)
Your score on this question is: 14.29
Feedback:
See section 2.3.3 of the course notes.
--------------------------------------------------------------------------------
6.
What is the value of the following C expression?
0x1234 << 3
(a) 0x1234000
(b) 0x9340
(c) 0x91A0
(d) 0x48CE
Correct answer is (c)
Your score on this question is: 14.29
Feedback:
See section 2.1.3 of the course notes.
--------------------------------------------------------------------------------
7.
What is the value of the following C expression?
0x1234 ^ 0x5432
(a) 0x5434
(b) 0x1030
(c) 0x4606
(d) 0x5636
Correct answer is (c)
Your score on this question is: 14.29
Feedback:
See section 2.1.3 of the course notes.
--------------------------------------------------------------------------------
Go to top of assessment.
Total score: 100.00
? 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 3
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 23 minutes on this assessment from Thu Nov 29 09:39:08 UTC+0800 2007 to Thu Nov 29 10:01:26 UTC+0800 2007.
Total score: 83.33
1.
Which of the following are true about statically allocated data in C programs?
Its location is chosen by the compiler.
Its location may change during execution if more memory is required.
Its location is not known directly but can be found in a static symbol table.
(a) II and III only.
(b) I only.
(c) III only.
(d) I and II only.
Correct answer is (b)
Your score on this question is: 16.67
Feedback:
See section 3.1.1 of the course notes.
--------------------------------------------------------------------------------
2.
The key feature of implicit memory management is that memory is freed automatically. Which of the following features of C make(s) it difficult to add support for implicit memory management in C?
Pointers are not always initialized.
Type casting makes it impossible to know when a value could be a pointer.
C programs can allocate memory at runtime.
(a) I and II only
(b) III only
(c) II only
(d) I only
Correct answer is (a)
Your score on this question is: 0.00
Feedback:
See section 3.1.2 of the course notes.
--------------------------------------------------------------------------------
3.
Why is it wrong to return the address of a local variable?
(a) The variable address is invalid after the return.
(b) It allows illegal access to the variable from arbitrary functions.
(c) The local variable may be in a machine register.
(d) It is faster to return the value of the variable.
Correct answer is (a)
Your score on this question is: 16.67
Feedback:
See section 3.3.3 of the course notes.
--------------------------------------------------------------------------------
4.
A memory leak is caused by a
(a) failure to free allocated memory
(b) bug in which too much memory is allocated, causing internal fragmentation
(c) function that allocates a large amount of memory from the heap
(d) bug in the memory allocator that fails to free memory
Correct answer is (a)
Your score on this question is: 16.67
Feedback:
See section 3.3.5 of the course notes.
--------------------------------------------------------------------------------
5.
A garbage collector
(a) frees memory blocks that cannot be reached by dereferencing pointers.
(b) frees all memory blocks that will not be accessed in the future.
(c) removes old versions of local variables from the stack .
(d) frees memory blocks marked as "deleteable".
Correct answer is (a)
Your score on this question is: 16.67
Feedback:
See section 3.3.7 of the course notes.
--------------------------------------------------------------------------------
6.
In this sequence of C statements
long a[10];
ptr = a + 5;
*ptr++ = x;
the last line could be rewritten as
(a) ptr = ptr + 1; *ptr = x;
(b) a[6] = x;
(c) a[5] = x; ptr = ptr + 1;
(d) ptr = x; *ptr++;
Correct answer is (c)
Your score on this question is: 16.67
Feedback:
See section 3.3.1 of the course notes.
--------------------------------------------------------------------------------
Go to top of assessment.
Total score: 83.33
? 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 3
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 14 minutes on this assessment from Thu Nov 29 10:04:39 UTC+0800 2007 to Thu Nov 29 10:17:45 UTC+0800 2007.
Total score: 50.00
1.
Suppose a compiler uses static storage to store all variables, function parameters, saved registers, and return addresses. Which of the following language features can this compiler support?
Local variables.
Function calls.
Recursion.
(a) I, II, and III
(b) I and II only
(c) II only
(d) I only
Correct answer is (b)
Your score on this question is: 0.00
Feedback:
See section 3.1.2 of the course notes.
--------------------------------------------------------------------------------
2.
Which of the following are true about statically allocated data in C programs?
Its location is chosen by the compiler.
Its location may change during execution if more memory is required.
Its location is not known directly but can be found in a static symbol table.
(a) III only.
(b) I only.
(c) I and II only.
(d) II and III only.
Correct answer is (b)
Your score on this question is: 16.67
Feedback:
See section 3.1.1 of the course notes.
--------------------------------------------------------------------------------
3.
Why is it wrong to return the address of a local variable?
(a) The local variable may be in a machine register.
(b) It is faster to return the value of the variable.
(c) The variable address is invalid after the return.
(d) It allows illegal access to the variable from arbitrary functions.
Correct answer is (c)
Your score on this question is: 16.67
Feedback:
See section 3.3.3 of the course notes.
--------------------------------------------------------------------------------
4.
In C, to allocate an array of 100 longs on the heap you should write
(a) long *a = (long *) malloc(100);
(b) long a[] = (long *) malloc(100);
(c) long a[100] = (long *) malloc(sizeof(a));
(d) long *a = (long *) malloc(100 * sizeof(long));
Correct answer is (d)
Your score on this question is: 16.67
Feedback:
See section 3.3.3 of the course notes.
--------------------------------------------------------------------------------
5.
In C, when a struct is freed,
(a) only those pointers within the struct that point into the heap are freed automatically.
(b) any pointers within the struct are also freed automatically.
(c) a destructor function is called automatically to clean up.
(d) no pointers within the struct are freed automatically.
Correct answer is (d)
Your score on this question is: 0.00
Feedback:
See section 3.3.5 of the course notes.
--------------------------------------------------------------------------------
6.
In C, which of the following is the best way to detect when a pointer is freed twice?
(a) Modify free() to set the freed data to zero.
(b) Set pointers to NULL after freeing them.
(c) Keep a log of addresses that have been freed and scan the log before calling free().
(d) Flag all blocks as free or not, and check the flag when calling free().
Correct answer is (d)
Your score on this question is: 0.00
Feedback:
See section 3.3.6 of the course notes.
--------------------------------------------------------------------------------
Go to top of assessment.
Total score: 50.00
? Copyright 2005 iCarnegie, Inc. All rights reserved.
View Assessment Result: Multiple-Choice Quiz 1
Your performance was as follows:
1.
Which of the following does a debugger do?
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -