📄 ssd5-multiple--choicequiz1.txt
字号:
1.
Which of the following expressions evaluates to true in C++ if and only if the index variable i is in bounds for an array of size 10?
(a) 0 <= i < 10
(b) 0 < 10
(c) 0 <= i && i < 10
(d) 0 <= i && i <= 10
Correct answer is (c)
Your score on this question is: 10.00
Feedback:
See section 1.3.1 of the course notes.
--------------------------------------------------------------------------------
2.
C++ is said to be an object-oriented language because of its support for
(a) pointers
(b) attendant algorithms
(c) C-style comments
(d) classes, inheritance, and polymorphism
Correct answer is (d)
Your score on this question is: 10.00
Feedback:
See section 1.1.1, subsection "Key Features," in the course notes.
--------------------------------------------------------------------------------
3.
All of the following characters are allowed to be part of a valid C++ identifier except
(a) X
(b) - (hyphen)
(c) _ (underscore)
(d) 3
Correct answer is (b)
Your score on this question is: 10.00
Feedback:
See section 1.1.2 of the course notes.
--------------------------------------------------------------------------------
4.
Lines at a store, file cabinets, and bookcases are real-world entities that most resemble _____ in computer science.
(a) functional programming languages
(b) object-oriented programming languages
(c) algorithms
(d) data structures
Correct answer is (d)
Your score on this question is: 10.00
Feedback:
See section 1.2.1, subsection "Data Structures," in the course notes.
--------------------------------------------------------------------------------
5.
Which of the following is not a predefined stream object in C++?
(a) cerr
(b) cfile
(c) cout
(d) cin
Correct answer is (b)
Your score on this question is: 10.00
Feedback:
See Appendix A.4, page A-9, in the course notes.
--------------------------------------------------------------------------------
6.
Regarding C++ standard I/O, the _____ operator writes to a stream and the _____ operator reads from a stream.
(a) >>, <<
(b) <<, >>
(c) <, >
(d) >, <
Correct answer is (b)
Your score on this question is: 10.00
Feedback:
See section 1.3.3, subsection "Using the Standard Streams," in the course notes.
--------------------------------------------------------------------------------
7.
One reason for using an assert statement such as
assert( 0 <= i && i < 10 );
within code is to
(a) send a warning message but continue execution when the condition is violated
(b) instruct the compiler to set i to any value in the indicated range
(c) terminate execution and send an error message whenever the condition is violated
(d) provide a comment for the user
Correct answer is (c)
Your score on this question is: 10.00
Feedback:
See section 1.3.4 of the course notes.
--------------------------------------------------------------------------------
8.
In C++, preprocessor directives begin with which of the following symbols?
(a) #
(b) -
(c) ?
(d) %
Correct answer is (a)
Your score on this question is: 10.00
Feedback:
See section 1.3.4, subsection "Text Substitution," in the course notes.
--------------------------------------------------------------------------------
9.
Assume that Thing is a user-defined class, and consider the following code fragment, where B is an instance of Thing.
Thing A = B;
Which of the following is a class member that is used in this code fragment?
(a) The default constructor
(b) The destructor
(c) The copy constructor
(d) The assignment operator
Correct answer is (c)
Your score on this question is: 10.00
Feedback:
See section 1.3.2 of the course notes.
--------------------------------------------------------------------------------
10.
In a C++ class, access to data members and function members are typically
(a) public and private, respectively
(b) private and public, respectively
(c) both private
(d) both public
Correct answer is (b)
Your score on this question is: 10.00
Feedback:
See section 1.3.2 of the course notes.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -