# Cs 270 data structures complete course grantham

## CS 270 Data Structures Complete Course Grantham

###### CS 270 Data Structures Module 4 Midterm Exam

1.A ____ is a list in which each element contains a key, such that the key in the element at position k in the list is at least as large as the key in the element at position 2k + 1 (if it exists) and 2k + 2 (if it exists).

1. A) hemp
2. B) hash table
3. C) heap

2.A linked list is a collection of ____.

2. B) classes
3. C) nodes

3.The structured design approach is also known as ____.

1. A) top-down design
2. B) object design
3. C) bottom-up design

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 trees cannot be implemented the same way they are implemented on binary trees.

1. A) True
2. B) False

5.____ iterators are forward iterators that can also iterate backward over the elements.

1. A) Output
2. B) Bidirectional
3. C) Input

6.A list is ordered if its elements are ordered according to some criteria.

1. A) True
2. B) False

7.The analysis of algorithms enables programmers to decide which algorithm to use for a specific application.

1. A) True
2. B) False

8.The number of key comparisons in a sequential search depends on the value of the search item.

1. A) True
2. B) False

9.A precondition is a statement specifying the condition(s) that must be true before the function is called.

1. A) True
2. B) False

10.The header node is placed at the ____ of a list.

1. A) end
2. B) middle
3. C) beginning

11.The copy constructor automatically executes when, as a parameter, an object is passed by value.

1. A) True
2. B) False

12.When the destructor ____ the queue, it deallocates the memory occupied by the elements of the queue.

1. A) allocates
2. B) destroys
3. C) instantiates

13.The expression vecList.front() moves an element to the front of the vector.

1. A) True
2. B) False

14.We can traverse a singly linked list backward starting from the last node.

1. A) True
2. B) False

15.When you declare a derived class object, this object inherits the members of the base class, but the derived class object cannot directly access the ____.

1. A) base class constructors
2. B) private data members of the base class
3. C) data members in its own class

16.The expression vecCont.empty() empties the vector container of all elements.

1. A) True
2. B) False

17.The components of a class are called the ____ of the class.

1. A) objects
2. B) members
3. C) operators

18.In a doubly linked list, some of the operations require modification from how they were implemented for a regular linked list, because of the ____ pointer(s) in each node.

1. A) two
2. B) three
3. C) null

19.The syntax for accessing a class (struct) member using the operator -> is ____.

1. A) pointerVariableName&->classMemberName
2. B) pointerVariableName.classMemberName
3. C) pointerVariableName->classMemberName

20.If the list is stored in an array, we can traverse the list in either direction using an ____.

1. A) increment variable
2. B) index variable
3. C) interface variable

21.With the help of the ____, two values can be combined into a single unit and, therefore, can be treated as one unit.

1. A) class double
2. B) class tuple
3. C) class unit
4. D) class pair

22.The deque class is a type of container adapter.

1. A) True
2. B) False

23.The operation ____ reinitializes the stack to an empty state.

1. A) init
2. B) alloc
3. C) initializeStack

24.In the random probing method, the ith slot in the probe sequence is ____.

1. A) (h(X) % ri) + HTSize
2. B) (h(X) % HTSize) + ri
3. C) (h(X) + HTSize) % ri
4. D) (h(X) + ri) % HTSize

25.The binary search algorithm uses the ____ technique to search the list.

1. A) divide-and-divide
2. B) conquer-and-resign
3. C) divide-and-conquer

26.To define new classes, you create new ____ files.

1. A) friend
3. C) placeholder

27.To remove, or pop, an element from the stack ____.

1. A) increment stackTop by 1
2. B) decrement stackTop by 1
3. C) invert stackTop

28.Every call to a recursive function requires the system to allocate memory for the local variables and formal parameters

1. A) True
2. B) False

29.A technique in which one system models the behavior of another system is called ____.

1. A) referencing
2. B) simulation
3. C) bench testing

30.Because a queue is an important data structure, the Standard Template Library (STL) provides a class to implement queues in a program.

1. A) True
2. B) False

31.The derived class can redefine public member functions of a base class.

1. A) True
2. B) False

32.Containers are class templates.

1. A) True
2. B) False

33.Containers are essentially used ____.

1. A) to update objects that are part of a given set of elements
2. B) to manipulate data
3. C) to manage objects of a given type

34.In breadth first traversal, starting at the first vertex, the graph is traversed as little as possible.

1. A) True
2. B) False

35.If the list is stored in a linked list, we can traverse the list in only one direction starting at the first node because the links are only in one direction.

1. A) True
2. B) False

36.Default arguments can be used with an overloaded operator.

1. A) True
2. B) False

37.In a shallow copy, two pointers of different data types point to the same memory.

1. A) True
2. B) False

38.In a ____, customers or jobs with higher priority are pushed to the front of the queue.

1. A) false queue
2. B) priority queue
3. C) free queue
4. D) double queue

39.The statement vecList.push_back(elem) deletes the element elem from the vector.

1. A) True
2. B) False

40.The use of a queue structure ensures that the items are processed in the order they are received.

1. A) True
2. B) False

###### CS 270 Data Structures Module 8 Final Exam
1. To speed up item insertion and deletion in a data set, use ____.
1. In a ____ queue, customers or jobs with higher priorities are pushed to the front of the queue.
1. The ____ operation on a queue returns the last element in the queue, but does not remove the element from the queue
1. Random access iterators are ____ iterators that can randomly process elements of a container.
1. The order of the nodes in a linked list is determined by the data value stored in each node.
1. Building a linked list forward places the new item to be added at the beginning of the linked list.
1. Assuming deq is a deque object, the expression deq.push_front(elem) deletes the first element from deq.
1.    complexity of the function seqSearch in an array list is O(n2).
1. A queuing system only consists of queues of objects waiting to be served.
1. The operation ____ is used to remove the top element from the stack.
1. Class objects cannot be passed as parameters to functions or returned as function values.
1. Indirect recursion requires the same careful analysis as direct recursion.
1. From the binary search algorithm, it follows that every iteration of the while loop cuts the size of the search list by half.
1. Using static arrays, depending on the number of servers specified by the user, a list of servers is created during program execution.
1. A sequential search assumes that the data is in a particular order.
1. In an array list the time complexity of the remove function is identical to the time complexity of the ____ function.
1. A convenient and fast way to implement an associative container data structure is to use a ____.
1. An ____ is an object that produces each element of a container, such as a linked list, one element at a time.
1. A linked list in which the last node points to the first node is called a reverse linked list.
1. A binary search can be performed only on ____.
1. A ____ is a set of elements of the same type in which the elements are added at one end.
1. In 1736, Euler represented the Kцnigsberg bridge problem as a graph, marking (as recorded) the birth of graph theory.
1. The general case in a recursive function is the case for which the solution is obtained directly.
1. Mergesort uses the divide-and-conquer technique to sort a list.
1. When an integer is subtracted from a pointer variable, the value of the pointer variable is decremented by the integer times half the size of the memory to which the pointer is pointing.
1. Assuming vecList is a vector container, the expression ____ deletes all elements from the container.
1. The function that overloads any of the operators (), [], ->, a class must be declared as a member of the class.
1. Open addressing can be implemented in several ways.
1. The statement ____ declares intList to be a vector and the component type to be int
1. Every call to a recursive function has its own code and its own set of ____ and local variables
1. The algorithm ____ is used to find the elements in one range of elements that do not appear in another range of elements.
1. The ____ in a binary tree is the number of branches on the path from the root to the node.
1. A B-tree can be ____ in three ways: inorder, preorder, and postorder.
1. ____ are systems in which queues of objects are waiting to be served by various servers
1. A class and its members can be described graphically using a notation known as Unified Modeling Language (UML) notation.
1. The term asymptotic means the study of the function f as n becomes larger and larger without bound.
1. To simplify operations such as insert and delete, you can define the class to implement the node of a linked list as a struct.
1. The destructor automatically executes when the class object goes out of ____.
1. The syntax for accessing a class (struct) member using the operator -> is ____.
1. The expression vecCont.empty() empties the vector container of all elements.
1. If we compare the push function of the stack with the insertFirst function for general lists, we see that the algorithms to implement these operations are similar.
1. If the data needs to be processed in a First In First Out (FIFO) manner, we typically use a(n) ____.
1. A(n) ____ is a data type that separates the logical properties from the implementation details.
1. In the second form of ____, the binary operation op is applied to the elements in the range.
1. The ____ algorithm tries to extend a partial solution toward completion
1. After inserting (or deleting) a node from an AVL tree, the resulting binary tree does not have to be an AVL tree.
1. Every customer has a customer number, arrival time, waiting time, transaction time, and departure time.
1. We need ____ pointers to build a linked list.Points Earned: 0.0/2.0
1. Because an AVL tree is a binary search tree, the search algorithm for an AVL tree is the same as the search algorithm for a binary search tree.
1. The ____ operation is used to add an element onto the stack.
0 replies