View Assessment Result: Multiple-Choice Quiz 3
2.
Which of the following is an example of a pure virtual function?
(a) virtual int Compute();
(b) int Compute() { Compute = 0; };
(c) virtual int Compute() { return 0; };
(d) virtual int Compute() = 0;
Correct answer is (d)
Your score on this question is: 10.00
Feedback:
See section 1.5.2 of the course notes.
(d)
--------------------------------------------------------------------------------
3.
Inheritance is an important feature of C++ because
(a) it makes type-checking much easier
(b) it can often replace templates
(c) it greatly increases efficiency
(d) it is a powerful code reuse mechanism
Correct answer is (d)
Your score on this question is: 10.00
Feedback:
See section 1.5.1 of the course notes.
(d)
--------------------------------------------------------------------------------
4.
Which of the following is true of inheritance?
(a) It causes one type to behave like several types.
(b) It is an important idea in Object Oriented Programming, but currently it is not implemented in C++.
(c) It protects data members from illegal access.
(d) It provides for the elegant construction of a new class from an existing class.
Correct answer is (d)
Your score on this question is: 0.00
Feedback:
See section 1.5.1 of the course notes.
(a)
--------------------------------------------------------------------------------
5.
In C++ exception handling, intermediate exception handlers typically are used to:
(a) ensure allocated resources are properly released
(b) throw user-defined exception classes
(c) catch exceptions polymorphically
(d) override the guarantees of exception specifications
Correct answer is (a)
Your score on this question is: 0.00
Feedback:
See section 1.5.4, subsection "Using Intermediate Handlers," in the course notes.
(c)
--------------------------------------------------------------------------------
6.
In C++ exception handling, a try block must be followed by _____ catch block(s).
(a) exactly one
(b) one or more
(c) exactly two
(d) three or fewer
Correct answer is (b)
Your score on this question is: 10.00
Feedback:
See section 1.5.4, subsection "C++ Exception Handling Fundamentals," in the course notes.
(b)
--------------------------------------------------------------------------------
7.
Which of the following is (are) true about template classes in C++?
Methods cannot be overloaded in templated class definitions.
Private data of a templated class cannot be declared to have the type of the templated parameter.
(a) II only
(b) I only
(c) I and II
(d) None
Correct answer is (d)
Your score on this question is: 10.00
Feedback:
See section 1.5.3 of the course notes
(d)
--------------------------------------------------------------------------------
8.
Consider the following definitions of a C++ class.
class Array {
public:
typedef float Item; // <-- change here
Item& operator[](int i) {return arr[i];}
private:
int len; // length of array
Item *arr; // pointer to first elm
};
template<typename T>
class Array {
public:
T& operator[](int i) {return arr[i];}
private:
int len; T *arr; };
The second definition of class Array is _____ versatile than the first _____ efficient at run time when used in a program.
(a) more, but less
(b) more, and equally
(c) less, and equally
(d) less, but less
Correct answer is (b)
Your score on this question is: 0.00
Feedback:
See section 1.5.3 of the course notes.
(a)
--------------------------------------------------------------------------------
9.
Which of the following is true about compilation of a template function or class?
(a) Compilation takes less time.
(b) Compilation takes much, much longer.
(c) Compilation takes slightly longer.
(d) Templates are not handled during compilation.
Correct answer is (c)
Your score on this question is: 0.00
Feedback:
See section 1.5.3 of the course notes.
(d)
--------------------------------------------------------------------------------
10.
Consider the following template swap function and data types.
template<typename T> void swap( T& a, T& b ){
T tmp = a; a = b; b = tmp;
}
char c1, c2;
int i1, i2;
float A[10];
Which of the following calls to swap produces a compile time error?
swap( i1, c2 )
swap( c1, i2 );
swap( A[5], A[2] );
(a) I and II
(b) II and III
(c) I only
(d) I, II, and III
Correct answer is (a)
Your score on this question is: 10.00
Feedback:
See section 1.5.3 of the course notes.
(a)
--------------------------------------------------------------------------------
View Assessment Result: Multiple-Choice Quiz 3
Your performance was as follows:
1.
Which of the following is an example of a pure virtual function?
(a) virtual int Compute();
(b) virtual int Compute() { return 0; };
(c) virtual int Compute() = 0;
(d) int Compute() { Compute = 0; };
Correct answer is (c)
Your score on this question is: 10.00
Feedback:
See section 1.5.2 of the course notes.
(c)
--------------------------------------------------------------------------------
2.
Polymorphism is a mechanism that is used in order to
(a) build new classes on top of existing ones
(b) determine methods of a class based on its data members
(c) determine the type of an object dynamically at run time
(d) protect data members from illegal access
Correct answer is (c)
Your score on this question is: 10.00
Feedback:
See section 1.5.2 of the course notes.
(c)
--------------------------------------------------------------------------------
3.
What is composition?
(a) It is the inclusion of one class in another as a data member.
(b) It is an important idea in Object Oriented Programming, but currently it is not implemented in C++.
(c) It is the same as polymorphism.
(d) It is a method to build new classes on top of existing ones.
Correct answer is (a)
Your score on this question is: 0.00
Feedback:
See section 1.5.1 of the course notes.
(b)
--------------------------------------------------------------------------------
4.
Which of the following is true of inheritance?
(a) It protects data members from illegal access.
(b) It is an important idea in Object Oriented Programming, but currently it is not implemented in C++.
(c) It causes one type to behave like several types.
(d) It provides for the elegant construction of a new class from an existing class.
Correct answer is (d)
Your score on this question is: 10.00
Feedback:
See section 1.5.1 of the course notes.
(d)
--------------------------------------------------------------------------------
5.
Consider the following C++ program segment:
try {
throw out_of_range("out of range");
cout << "try ";
}
catch (...) {
cout << "catch ";
}
The above program segment will output which of the following character strings?
(a) "try catch "
(b) "catch try "
(c) "catch "
(d) "out of range catch "
Correct answer is (c)
Your score on this question is: 10.00
Feedback:
See section 1.5.4 in the course notes.
(c)
-----------------------------------------------------------------------
没有合适的资源?快使用搜索试试~ 我知道了~
ssd5 经过调试的所有答案

共44个文件
cpp:24个
h:12个
txt:8个

需积分: 3 42 浏览量
2010-12-14
10:37:12
上传
评论
收藏 35KB RAR 举报
ssd5 所有答案都在这里面 并且经过调试都是成功的 希望各位有需要的同学多多光临阿 包含个各种你想不到的答案阿
资源推荐
资源详情
资源评论














收起资源包目录































































共 44 条
- 1
资源评论

lmy891227
- 粉丝: 0
- 资源: 2

上传资源 快速赚钱
我的内容管理 收起
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助

会员权益专享
安全验证
文档复制为VIP权益,开通VIP直接复制
