Midterm Exam Data Structure
Midterm Exam Data Structure
Direction: Read each statement carefully. Select the correct letter that best suits your answer by shading the
corresponding circle on the answer sheet provided.
1. Shows the steps as boxes of various kinds and their order by connecting the boxes with arrows.
a. Flowchart c. Input
b. Language d. Output
2. It is used to denote a particular way of organizing data for particular types of operation.
a. Pseudocode c. Algorithm
b. Data Structure d. Discrete Structure
3. These are basic data types provided by programming languages to represent simple values.
a. Primitive Pseudocode c. Algorithm
b. Primitive Data Structure d. Discrete Structure
4. This is a form of a variable to which a value can be assigned.
a. Pseudocode c. Abstract data type
b. Data Structure d. Data type
5. In data structure, which data elements are arranged sequentially?
a. Static Data Structure c. Dynamic Data Structure
b. Linear Data Structure d. Non-Linear Data Structure
6. Data structure in which data elements are not arranged sequentially, and we can’t traverse all the elements
in a single run only.
a. Static Data Structure c. Dynamic Data Structure
b. Linear Data Structure d. Non-Linear Data Structure
7. This is a type of data structure whose size or structure is fixed at compile time and does not change during
program execution.
a. Static Data Structure c. Dynamic Data Structure
b. Linear Data Structure d. Non-Linear Data Structure
8. This is a type of data structure whose size or structure is not fixed and can randomly be updated during the
program execution.
a. Static Data Structure c. Dynamic Data Structure
b. Linear Data Structure d. Non-Linear Data Structure
9. It originally referred to any computation performed via a set of rules.
a. Algorithm c. Data Structure
b. Pseudocode d. Program
10. A high-level description of a program written for machine reading.
a. Algorithm c. Data Structure
b. Pseudocode d. Program
11. This is a type of control structure in which steps in an algorithm are constructed in such a way that no
condition step is required.
a. Control flow structure c. Counter structure
b. Sequence structure d. Decision structure
12. It enables the program to execute a certain section of code depending on the state of variables or values
returned from methods.
a. If Statement c. Array
b. If/Else Statement d. LinkedList
13. It is a collection of items of the same variable type that are stored at contiguous memory locations.
a. Tree c. Array
b. Stack d. LinkedList
14. A linear data structure in which the elements are not stored at contiguous memory locations.
a. Stack c. Array
b. Tree d. LinkedList
15. In flowcharting, this indicates any type of internal operation inside the processor or memory.
a. Process c. Terminal
b. Decision d. Input/Output
16. Nodes in a linked list contain two things.
a. Direction and a pointer c. A pointer and a reference
b. Data and a pointer d. A pointer and a node
17. Linked list is generally considered as an example of _____ type of memory allocation.
a. Static c. Dynamic
b. Compile time d. None of these
18. What is the proper code for accessing the information of the second item in a linked list?
a. Head.next c. Head.next.next.next
b. Head.next.next d. None of the above
19. What operation is done on the representation of the linked list below?
a.Insertion at end c. insertion at any point
20. What should the default constructor of the LinkedList class perform?
a. Nothing, since the LinkedListNode class will take care of initialization
b. Initialize the first and last node (or head and tail) and set count to zero
c. Initialize the array to store the information in the linked list
d. All of the above
21. A linked list is different from an array because:
a. A linked list can handle more types of information than an array
c. An array cannot be sorted, but a linked list can
b. An array is fixed in size, but a linked list is dynamically sizable
d. None of the above
22. What is a node used for in a linked list?
a. To store the information and the link to the next item
c. To check for the end of the list
b. Not used in a linked list
d. All of the above
23. Giving the fixed size of an array is not important. Which class is more efficient at storing and retrieving
information?
a. A linked list because of the nodes
c. Neither is more efficient than the other
b. An array because of the reduced code and efficient storage allocation
d. None of the above
24. Which of these is NOT about the linked list?
a. A nonlinear collection of data elements
c. It uses more memory than arrays because of the storage used by their pointers
b. It can be used to implement several other common abstract data types (e.g., stacks, queues, trees)
d. Each record of a linked list is often called an “element” or “node”
25. The following statements are true about the linked list EXCEPT:
a. The size of memory can be allocated or de-allocated at runtime based on the operation
c. Linked list is a dynamic data structure in which elements are stored at a contiguous location
b. The insertion and deletion of elements are simpler than arrays
d. Adding a new node to a linked list involves adjusting the pointers of the existing nodes to maintain the
proper sequence
26. All of the following are types of Linked List EXCEPT:
a. Singly Linked List
c. Circular Linked List
b. Doubly Linked List
d. Modular Linked List
27. All statements are true about the Singly Linked List EXCEPT:
a. Linked list contains a first link element called head
c. Each link is linked with its next link using its head
b. Each link carries a data field and a link field called next
d. The last link carries a link as null to mark the end of the list
28. Which is NOT TRUE in the following statements?
a. In data searching, as data grows, the search will become faster
c. Data can be organized in a data structure in such a way that all items may not be required to search, and
the required data can be searched almost instantly
b. Processor speed in data structure falls limited if the data grows to billions of records
d. Memory usage of data structure operations should be as little as possible
29. Which is TRUE in the following statements?
a. The data to be read or displayed uses a parallelogram symbol
c. Pre-defined process is used to represent a group of statements that perform one processing task
b. Connector in flowchart is used for any logic comparison operation
d. Off-page connector indicates that the target is on the other page
30. 30. In hashing, what is the purpose of the hash function?
31. a. To resize the hash table.
32. b. To determine the load factor.
33. c. To calculate the average search time.
34. d. To map keys to indices in the hash table.
35. 31. If you have a queue with a maximum size of 5 and you attempt to enqueue an
element
36. onto a full queue, what will happen?
37. 30. In hashing, what is the purpose of the hash function?
38. a. To resize the hash table.
39. b. To determine the load factor.
40. c. To calculate the average search time.
41. d. To map keys to indices in the hash table.
42. 31. If you have a queue with a maximum size of 5 and you attempt to enqueue an
element
43. onto a full queue, what will happen?
44. 30. In hashing, what is the purpose of the hash function?
45. a. To resize the hash table.
46. b. To determine the load factor.
47. c. To calculate the average search time.
48. d. To map keys to indices in the hash table.
49. 31. If you have a queue with a maximum size of 5 and you attempt to enqueue an
element
50. onto a full queue, what will happen?
51. 30. In hashing, what is the purpose of the hash function?
52. a. To resize the hash table.
53. b. To determine the load factor.
54. c. To calculate the average search time.
55. d. To map keys to indices in the hash table.
56. 31. If you have a queue with a maximum size of 5 and you attempt to enqueue an
element
57. onto a full queue, what will happen?
58. 30. In hashing, what is the purpose of the hash function?
59. a. To resize the hash table.
60. b. To determine the load factor.
61. c. To calculate the average search time.
62. d. To map keys to indices in the hash table.
63. 31. If you have a queue with a maximum size of 5 and you attempt to enqueue an
element
64. onto a full queue, what will happen?
65. 30. In hashing, what is the purpose of the hash function?
66. a. To resize the hash table.
67. b. To determine the load factor.
68. c. To calculate the average search time.
69. d. To map keys to indices in the hash table.
70. 31. If you have a queue with a maximum size of 5 and you attempt to enqueue an
element
71. onto a full queue, what will happen?
72. 30. In hashing, what is the purpose of the hash function?
73. a. To resize the hash table.
74. b. To determine the load factor.
75. c. To calculate the average search time.
76. d. To map keys to indices in the hash table.
77. 31. If you have a queue with a maximum size of 5 and you attempt to enqueue an
element
78. onto a full queue, what will happen?
31. If you have a queue with a maximum size of 5 and you attempt to enqueue an element onto a full queue,
what will happen?
a. An error will occur, indicating queue overflow.
b. The element will be added to the queue.
c. The queue will remain unchanged
d. The front element will be automatically removed.
32. In the binary search algorithm, what is the purpose of the mid variable?
a. It represents the length of the array.
b. It is the target element to be found.
c. It is the middle index of the current search range.
d. It is the sum of the left and right indices.
33. Which of the following statements is TRUE in the context of function calls?
a. Stack helps ensure functions are called in alphabetical order.
b. Stack keeps track of the order of function calls and their local variables.
c. Stack prevents the execution of recursive functions.
d. Stack enforces a first-in, las-out order for function calls.
34. Which of the following statements is TRUE if you pop an element from an empty stack?
a. An error is thrown
b. The program crashes
c. Nothing happens
d. The top element is set to null
36. A linked list is a linear data structure where elements are stored in nodes connected by pointers.
37. In a singly linked list, each node contains a pointer to its previous and next nodes.
38. A doubly linked list allows traversal in both forward and backward directions.
39. The head of a linked list refers to the first node in the list.
40. Deleting the last node in a singly linked list requires traversing the entire list.
41. In a circular linked list, the last node points back to the head node.
42. Inserting an element at the beginning of a linked list takes O(1)O(1)O(1) time.
43. A linked list has a fixed size that must be defined at the time of creation.
44. Doubly linked lists require more memory per node than singly linked lists.
45. In a singly linked list, you can directly access any node using its index, similar to an array.
46. Traversing a linked list has a time complexity of O(n)O(n)O(n), where nnn is the number of nodes.
47. Circular linked lists are often used in real-time systems to maintain a buffer of data.
48. A tail pointer in a linked list refers to the second-to-last node.
49. Reversing a singly linked list can be achieved using an iterative or recursive approach.
50. In a doubly linked list, each node has two pointers: one for the next node and one for the previous node.
Answer Key
1. a. Flowchart
2. b. Data Structure
3. b. Primitive Data Structure
4. d. Data type
5. b. Linear Data Structure
6. d. Non-Linear Data Structure
7. a. Static Data Structure
8. c. Dynamic Data Structure
9. a. Algorithm
10. b. Pseudocode
11. b. Sequence structure
12. b. If/Else Statement
13. c. Array
14. d. LinkedList
15. a. Process
16. b. Data and a pointer
17. c. Dynamic
18. b. Head.next.next
19. a. Insertion at end
20. b. Initialize the first and last node (or head and tail) and set count to zero
21. b. An array is fixed in size, but a linked list is dynamically sizable
22. a. To store the information and the link to the next item
23. b. An array because of the reduced code and efficient storage allocation
24. a. A nonlinear collection of data elements
25. c. Linked list is a dynamic data structure in which elements are stored at a contiguous location
26. d. Modular Linked List
27. c. Each link is linked with its next link using its head
28. a. In data searching, as data grows, the search will become faster
29. c. Pre-defined process is used to represent a group of statements that perform one processing task
30. d. To map keys to indices in the hash table.
31. a. An error will occur, indicating queue overflow
32. c. It is the middle index of the current search range.
33. b. Stack keeps track of the order of function calls and their local variables
34. a. An error is thrown
35. c. Assign priorities to elements and process them accordingly
36. True
37. False
38. True
39. True
40. True
41. True
42. True
43. False
44. True
45. False
46. True
47. True
48. False
49. True
50. True