⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 5.txt

📁 icarnegie SSD5 Mutli-choice4-7
💻 TXT
📖 第 1 页 / 共 2 页
字号:

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) 3
 (b) 7
 (c) 8
 (d) 1  

 Correct answer is  (d)  

 Your score on this question is: 0.00  

 Feedback: 
   
See section 2.4.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 write-only access to a linked list.
 (b) They provide read-only access to a linked list.
 (c) Const iterators can be incremented, but never decremented.
 (d) They cannot be used to traverse a linked list.  

 Correct answer is  (b)  

 Your score on this question is: 0.00  

 Feedback: 
   See section 2.2.3 of the course notes.  
 

--------------------------------------------------------------------------------

 8. 
 In STL, nodes of a linked list can be accessed using which of the following? 

STL iterators 
Subscripts
 
 

  (a) I and II
 (b) I only
 (c) None
 (d) II only  

 Correct answer is  (b)  

 Your score on this question is: 0.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) I and II
 (b) None
 (c) I only
 (d) II only  

 Correct answer is  (b)  

 Your score on this question is: 10.00  

 Feedback: 
   
See section 2.3.1, subsection "A Non-Contiguous List," in the course notes.
 
 

--------------------------------------------------------------------------------

 10. 
 Which of the following operations is (are) typically more efficient in a linked list than in a vector? 

Removal of the first element 
Random element access
 
 

  (a) II only
 (b) I only
 (c) None
 (d) I and II  

 Correct answer is  (b)  

 Your score on this question is: 10.00  

 Feedback: 
   
See section 2.3.1, subsection "A Non-Contiguous List," in the course notes. 
 
 

--------------------------------------------------------------------------------

 Go to top of assessment.  

 Total score: 50.00 

 ? Copyright 2004 iCarnegie, Inc. All rights reserved.  
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 vector of integer stacks
 (b) A stack of integers
 (c) A stack of integer vectors
 (d) A vector of integers  

 Correct answer is  (b)  

 Your score on this question is: 10.00  

 Feedback: 
   See section 2.4.2 of the course notes.  
 

--------------------------------------------------------------------------------

 2. 
 An STL adapter provides
 
 

  (a) a network-socket interface to an STL container
 (b) a pointer to an instance of an STL container
 (c) a new programming interface for an existing STL container
 (d) a wrapper that allows an STL container to be used by the Java programming language  

 Correct answer is  (c)  

 Your score on this question is: 0.00  

 Feedback: 
   
See section 2.4.2 in the course notes.
 
 

--------------------------------------------------------------------------------

 3. 
 In C++, calling the method empty for the STL adapter queue returns
 
 

  (a) an empty queue
 (b) true if the queue contains no elements
 (c) all elements in the queue
 (d) the front of the queue if the queue is not empty  

 Correct answer is  (b)  

 Your score on this question is: 10.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) Tree
 (b) Stack
 (c) Hash table
 (d) Queue  

 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 and II only
 (b) I and III only
 (c) I, II, and III
 (d) II only  

 Correct answer is  (a)  

 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) I only
 (b) None
 (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. 
 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) appending 10 to the list
 (b) inserting a new element 10 after each list element
 (c) adding 10 to each list element
 (d) stepping through the lists in increments of 10  

 Correct answer is  (c)  

 Your score on this question is: 0.00  

 Feedback: 
   See section 2.2.3 of the course notes.  
 

--------------------------------------------------------------------------------

 8. 
 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) random access containers
 (d) based on arrays of elements  

 Correct answer is  (a)  

 Your score on this question is: 10.00  

 Feedback: 
   See section 2.2.2 of the course notes.  
 

--------------------------------------------------------------------------------

 9. 
 A singly linked list is a linked list in which 
 
 

  (a) a single use of the operator new allocates memory for the list
 (b) each node contains a pointer to only one other node
 (c) elements must contain unique values
 (d) elements can contain duplicate values  

 Correct answer is  (b)  

 Your score on this question is: 10.00  

 Feedback: 
   
See section 2.3.1, subsection "Linking Elements Together," in the course notes. 
 
 

--------------------------------------------------------------------------------

 10. 
 Which of the following operations is (are) typically more efficient in a linked list than in a vector? 

Removal of the first element 
Random element access
 
 

  (a) None
 (b) I and II
 (c) II only
 (d) I only  

 Correct answer is  (d)  

 Your score on this question is: 10.00  

 Feedback: 
   
See section 2.3.1, subsection "A Non-Contiguous List," in the course notes. 
 
 

--------------------------------------------------------------------------------

 Go to top of assessment.  

 Total score: 80.00 

 ? Copyright 2004 iCarnegie, Inc. All rights reserved.  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -