📄 multiple-choice quiz 5.txt
字号:
View Assessment Result: Multiple-Choice Quiz 5
Your performance was as follows:
1.
Consider the following C++ program segment, which uses the STL.
stack<int,vector<int> > S;
Execution of the statement results in creation of which of the following?
(a) A stack of integer vectors
(b) A vector of integer stacks
(c) A vector of integers
(d) A stack of integers
Correct answer is (d)
Your score on this question is: 10.00
Feedback:
See section 2.4.2 of the course notes.
--------------------------------------------------------------------------------
2.
Which of the following is a method (are methods) available in the class queue in the C++ Standard Template Library?
push
pop
enqueue
(a) None
(b) III only
(c) I and II only
(d) I, II, and III
Correct answer is (c)
Your score on this question is: 10.00
Feedback:
See Chapter 7, page 249, in the course textbook.
--------------------------------------------------------------------------------
3.
In order to use the adapter queue from the C++ Standard Template Library, which of the following preprocessor directives is (are) typically required?
#include <queue>
#include <deque>
(a) II only
(b) None
(c) I and II
(d) I only
Correct answer is (d)
Your score on this question is: 10.00
Feedback:
See section 2.4.2 in the course notes.
--------------------------------------------------------------------------------
4.
Which of the following is (are) typically managed using a stack?
Implementation of function calls in a procedural programming language
Evaluating arithmetic expressions, taking precedence rules into account
Handling jobs sent to a printer, and ensuring that the first jobs to be submitted are printed first
(a) I and II only
(b) II only
(c) I and III only
(d) I, II, and III
Correct answer is (a)
Your score on this question is: 10.00
Feedback:
See Chapter 7, pages 235–236, in the course textbook.
--------------------------------------------------------------------------------
5.
Which of the following data structures uses a "Last-in, First-out" policy for element insertion and removal?
(a) Queue
(b) Hash table
(c) Tree
(d) Stack
Correct answer is (d)
Your score on this question is: 10.00
Feedback:
See section 2.5.1, subsection "Stacks Introduced," in the course notes.
--------------------------------------------------------------------------------
6.
Consider the following sequence of operations applied to an empty queue:
Insert element with value 3
Insert element with value 8
Remove element
Insert element with value 1
Remove element
Insert element with value 7
The next element removed from this queue will have which of the following values?
(a) 8
(b) 3
(c) 1
(d) 7
Correct answer is (c)
Your score on this question is: 10.00
Feedback:
See section 2.4.1 in the course notes.
--------------------------------------------------------------------------------
7.
One thing that the STL vector and the STL list have in common is that both are
(a) sequential containers
(b) inherited from the superclass Container
(c) based on arrays of elements
(d) random access containers
Correct answer is (a)
Your score on this question is: 10.00
Feedback:
See section 2.2.2 of the course notes.
--------------------------------------------------------------------------------
8.
In the C++ standard template library (STL), which of the following is a property of const iterators for the list container?
(a) Const iterators can be incremented, but never decremented.
(b) They provide write-only access to a linked list.
(c) They provide read-only access to a linked list.
(d) They cannot be used to traverse a linked list.
Correct answer is (c)
Your score on this question is: 10.00
Feedback:
See section 2.2.3 of the course notes.
--------------------------------------------------------------------------------
9.
To access an element in a singly linked list, a program must
(a) add the element's index to the memory address of the first element in the list
(b) compute a hash value for the element
(c) traverse all nodes in the list prior to that element
(d) allocate memory for temporary nodes
Correct answer is (c)
Your score on this question is: 10.00
Feedback:
See section 2.3.1 in the course notes.
--------------------------------------------------------------------------------
10.
Which of the following pointers is (are) stored by nodes in a doubly-linked list?
A pointer to the next node
A pointer to the previous node
(a) II only
(b) None
(c) I only
(d) I and II
Correct answer is (d)
Your score on this question is: 10.00
Feedback:
See section 2.3.1, subsection "Linking Elements Together," in the course notes.
--------------------------------------------------------------------------------
Go to top of assessment.
Total score: 100.00
? Copyright 2004 iCarnegie, Inc. All rights reserved.
--------------------------------------------------------------------------------
Your performance was as follows:
You took 9 minutes on this assessment from Sat Dec 9 11:06:47 UTC+0800 2006 to Sat Dec 9 11:15:19 UTC+0800 2006.
Total score: 90.00
1.
Consider the following C++ program segment, which uses the STL.
stack<int,vector<int> > S;
Execution of the statement results in creation of which of the following?
(a) A stack of integer vectors
(b) A vector of integers
(c) A stack of integers
(d) A vector of integer stacks
Correct answer is (c)
Your score on this question is: 10.00
Feedback:
See section 2.4.2 of the course notes.
--------------------------------------------------------------------------------
2.
The queue adapter interface in the C++ Standard Template Library contains which of the following member functions?
push
pop_back
(a) I only
(b) None
(c) I and II
(d) II only
Correct answer is (a)
Your score on this question is: 10.00
Feedback:
See section 2.4.2 in the course notes.
--------------------------------------------------------------------------------
3.
In order to use the adapter queue from the C++ Standard Template Library, which of the following preprocessor directives is (are) typically required?
#include <queue>
#include <deque>
(a) II only
(b) None
(c) I only
(d) I and II
Correct answer is (c)
Your score on this question is: 0.00
Feedback:
See section 2.4.2 in the course notes.
--------------------------------------------------------------------------------
4.
Which of the following data structures uses a "Last-in, First-out" policy for element insertion and removal?
(a) Hash table
(b) Stack
(c) Queue
(d) Tree
Correct answer is (b)
Your score on this question is: 10.00
Feedback:
See section 2.5.1, subsection "Stacks Introduced," in the course notes.
--------------------------------------------------------------------------------
5.
Which of the following is (are) typically managed using a stack?
Implementation of function calls in a procedural programming language
Evaluating arithmetic expressions, taking precedence rules into account
Handling jobs sent to a printer, and ensuring that the first jobs to be submitted are printed first
(a) I, II, and III
(b) I and III only
(c) I and II only
(d) II only
Correct answer is (c)
Your score on this question is: 10.00
Feedback:
See Chapter 7, pages 235–236, in the course textbook.
--------------------------------------------------------------------------------
6.
Which of the following linear data structures use a first-in, first-out element insertion and removal policy?
Stacks
Queues
(a) None
(b) I only
(c) I and II
(d) II only
Correct answer is (d)
Your score on this question is: 10.00
Feedback:
See sections 2.4.1 and 2.5.1 in the course notes.
--------------------------------------------------------------------------------
7.
In the C++ standard template library (STL), which of the following is a property of const iterators for the list container?
(a) They provide read-only access to a linked list.
(b) They cannot be used to traverse a linked list.
(c) Const iterators can be incremented, but never decremented.
(d) They provide write-only access to a linked list.
Correct answer is (a)
Your score on this question is: 10.00
Feedback:
See section 2.2.3 of the course notes.
--------------------------------------------------------------------------------
8.
Consider the following code fragment, where L is a linked list of integers.
for( it = L.begin(); it != L.end(); ++it )
*it += 10;
Execution of this fragment has the effect of
(a) adding 10 to each list element
(b) inserting a new element 10 after each list element
(c) appending 10 to the list
(d) stepping through the lists in increments of 10
Correct answer is (a)
Your score on this question is: 10.00
Feedback:
See section 2.2.3 of the course notes.
--------------------------------------------------------------------------------
9.
Which of the following statements is (are) true about the locations of a linked list's nodes in memory?
Nodes must appear at a fixed distance from one another in memory.
The order of elements in a list must match the order of the list's nodes in memory.
(a) None
(b) I and II
(c) II only
(d) I only
Correct answer is (a)
Your score on this question is: 10.00
Feedback:
See section 2.3.1, subsection "A Non-Contiguous List," in the course notes.
--------------------------------------------------------------------------------
10.
To access an element in a singly linked list, a program must
(a) compute a hash value for the element
(b) add the element's index to the memory address of the first element in the list
(c) allocate memory for temporary nodes
(d) traverse all nodes in the list prior to that element
Correct answer is (d)
Your score on this question is: 10.00
Feedback:
See section 2.3.1 in the course notes.
--------------------------------------------------------------------------------
Go to top of assessment.
Total score: 90.00
? Copyright 2004 iCarnegie, Inc. All rights reserved.
--------------------------------------------------------------------------------
Your performance was as follows:
You took 9 minutes on this assessment from Sat Nov 10 10:50:23 UTC+0800 2007 to Sat Nov 10 10:59:15 UTC+0800 2007.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -