Cs270 module 4 midterm exam (data structures (grantham university)


Published on

Cs270 module 4 midterm exam (data structures (grantham university)

Published in: Technology, Education
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Cs270 module 4 midterm exam (data structures (grantham university)

  1. 1. The link to downloadCS270 Module 4 Midterm Exam (DataStructures (Grantham University)1.A ____ is a list in which each element contains a key, such that the key in theelement at position k in the list is at least as large as the key in the element atposition 2k + 1 (if it exists) and 2k + 2 (if it exists).A) hempB) hash tableC) heapPoints Earned: 2.5/2.52.A linked list is a collection of ____.A) addressesB) classesC) nodesPoints Earned: 0.0/2.53.The structured design approach is also known as ____.A) top-down designB) object designC) bottom-up designPoints Earned: 2.5/2.5
  2. 2. 4.Operations, such as finding the height, determining the number of nodes,checking whether the tree is empty, tree traversal, and so on, on AVL treescannot be implemented the same way they are implemented on binary trees.A) TrueB) FalsePoints Earned: 2.5/2.55.____ iterators are forward iterators that can also iterate backward over theelements.A) OutputB) BidirectionalC) InputPoints Earned: 2.5/2.56.A list is ordered if its elements are ordered according to some criteria.A) TrueB) FalsePoints Earned: 0.0/2.57.The analysis of algorithms enables programmers to decide which algorithm touse for a specific application.A) TrueB) FalsePoints Earned: 2.5/2.58.
  3. 3. The number of key comparisons in a sequential search depends on the valueof the search item.A) TrueB) FalsePoints Earned: 2.5/2.59.A precondition is a statement specifying the condition(s) that must be truebefore the function is called.A) TrueB) FalsePoints Earned: 2.5/2.510.The header node is placed at the ____ of a list.A) endB) middleC) beginningPoints Earned: 2.5/2.511.The copy constructor automatically executes when, as a parameter, an objectis passed by value.A) TrueB) FalsePoints Earned: 2.5/2.512.When the destructor ____ the queue, it deallocates the memory occupied bythe elements of the queue.A) allocates
  4. 4. B) destroysC) instantiatesPoints Earned: 2.5/2.513.The expression vecList.front() moves an element to the front of the vector.A) TrueB) FalsePoints Earned: 2.5/2.514.We can traverse a singly linked list backward starting from the last node.A) TrueB) FalsePoints Earned: 2.5/2.515.When you declare a derived class object, this object inherits the members ofthe base class, but the derived class object cannot directly access the ____.A) base class constructorsB) private data members of the base classC) data members in its own classPoints Earned: 2.5/2.516.The expression vecCont.empty() empties the vector container of all elements.A) TrueB) FalsePoints Earned: 2.5/2.5
  5. 5. 17.The components of a class are called the ____ of the class.A) objectsB) membersC) operatorsPoints Earned: 2.5/2.518.In a doubly linked list, some of the operations require modification from howthey were implemented for a regular linked list, because of the ____ pointer(s)in each node.A) twoB) threeC) nullPoints Earned: 2.5/2.519.The syntax for accessing a class (struct) member using the operator -> is____.A) pointerVariableName&->classMemberNameB) pointerVariableName.classMemberNameC) pointerVariableName->classMemberNamePoints Earned: 2.5/2.520.If the list is stored in an array, we can traverse the list in either direction usingan ____.A) increment variableB) index variableC) interface variable
  6. 6. Points Earned: 2.5/2.521.With the help of the ____, two values can be combined into a single unit and,therefore, can be treated as one unit.A) class doubleB) class tupleC) class unitD) class pairPoints Earned: 2.5/2.522.The deque class is a type of container adapter.A) TrueB) FalsePoints Earned: 2.5/2.523.The operation ____ reinitializes the stack to an empty state.A) initB) allocC) initializeStackPoints Earned: 2.5/2.524.In the random probing method, the ith slot in the probe sequence is ____.A) (h(X) % ri) + HTSizeB) (h(X) % HTSize) + riC) (h(X) + HTSize) % ri
  7. 7. D) (h(X) + ri) % HTSizePoints Earned: 2.5/2.525.The binary search algorithm uses the ____ technique to search the list.A) divide-and-divideB) conquer-and-resignC) divide-and-conquerPoints Earned: 2.5/2.526.To define new classes, you create new ____ files.A) friendB) headerC) placeholderPoints Earned: 2.5/2.527.To remove, or pop, an element from the stack ____.A) incrementstackTop by 1B) decrementstackTop by 1C) invertstackTopPoints Earned: 2.5/2.528.Every call to a recursive function requires the system to allocate memory forthe local variables and formal parametersA) TrueB) False
  8. 8. Points Earned: 2.5/2.529.A technique in which one system models the behavior of another system iscalled ____.A) referencingB) simulationC) bench testingPoints Earned: 2.5/2.530.Because a queue is an important data structure, the Standard TemplateLibrary (STL) provides a class to implement queues in a program.A) TrueB) FalsePoints Earned: 2.5/2.531.The derived class can redefine public member functions of a base class.A) TrueB) FalsePoints Earned: 0.0/2.532.Containers are class templates.A) TrueB) FalsePoints Earned: 2.5/2.533.Containers are essentially used ____.
  9. 9. A) to update objects that are part of a given set of elementsB) to manipulate dataC) to manage objects of a given typePoints Earned: 2.5/2.534.In breadth first traversal, starting at the first vertex, the graph is traversed aslittle as possible.A) TrueB) FalsePoints Earned: 2.5/2.535.If the list is stored in a linked list, we can traverse the list in only one directionstarting at the first node because the links are only in one direction.A) TrueB) FalsePoints Earned: 2.5/2.536.Default arguments can be used with an overloaded operator.A) TrueB) FalsePoints Earned: 2.5/2.537.In a shallow copy, two pointers of different data types point to the samememory.A) TrueB) False
  10. 10. Points Earned: 2.5/2.538.In a ____, customers or jobs with higher priority are pushed to the front of thequeue.A) false queueB) priority queueC) free queueD) double queuePoints Earned: 2.5/2.539.The statement vecList.push_back(elem) deletes the element elem from thevector.A) TrueB) FalsePoints Earned: 2.5/2.540.The use of a queue structure ensures that the items are processed in theorder they are received.A) TrueB) FalsePoints Earned: 2.5/2.5