SSD6 Multiple-Choice Quiz 4

1.To quickly allocate and free many variables of a commonly used data type, we could  
 (a) minimize the size of the data type.
 (b) coalesce blocks when they are freed.
 (c) use sizes which are powers of two.
 (d) keep a linked list of free objects of that type's size.

Correct answer is  (d)
 
2."CPU time" measures  
 (a) the percentage utilization of the CPU by the system.
 (b) the time spent executing system functions.
 (c) the time spent by a program executing program instructions.
 (d) wall time

Correct answer is  (c)
 
3.Which of the following are useful for observing program performance?
I. Direct measurement with a stopwatch.
II. Statistical Sampling.
III. System Monitors
 
 (a) I, II, and III
 (b) I and III only
 (c) I and II only
 (d) II and III only

Correct answer is  (a)
 
4.Amdahl's law, applied to program optimization, says that  
 (a) algorithmic design is more important than code quality for performance
 (b) program measurement is a prerequisite to optimization
 (c) each optimization about doubles a program's performance
 (d) successive program optimizations tend to produce diminishing returns
Correct answer is  (d)
 

2."Wall time" measures  
 (a) the total duration of a program's execution.
 (b) idle time.
 (c) the user time plus the system time.
 (d) the time a program spends waiting for input and output.

Correct answer is  (a)
 
3.Which of the following are advantages of using statistical sampling to profile programs?
I. Exact run times of all functions can be determined.
II. Code can be instrumented automatically.
III. The performance impact due to measurement can be minimal.
 
 (a) I and III only
 (b) II and III only
 (c) I and II only
 (d) I, II, and III

Correct answer is  (b)
 

4.Which of the following is likely to offer the best performance improvement for programs that spend 50% of their time comparing strings?  
 (a) Be sure to use hardware string-comparison instructions.
 (b) Call a library function for string comparison.
 (c) Store strings uniquely so that pointer comparison can be used.
 (d) Write in-line code for string comparison to eliminate a procedure call.
Correct answer is  (c)

 

1.A memory pool is a large block of memory from which small objects are allocated piecemeal by breaking them off from the pool as required. Under which of the following conditions would such a scheme result in greatly improved performance?
I. All objects allocated from the pool are freed at around the same time.
II. All objects allocated from the pool are of similar sizes.
III. A garbage collector takes care of freeing memory.
 
 (a) II only.
 (b) I only.
 (c) I and II only.
 (d) III only.

Correct answer is  (b)
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值