practice questions

.docx

School

Dominica State College *

*We aren’t endorsed by this school

Course

125

Subject

Computer Science

Date

May 9, 2024

Type

docx

Pages

12

Uploaded by ProfWhale4328 on coursehero.com

Section 1: Multiple Choice (40 marks) Choose the most appropriate answer for each question. Which of the following data structures follows the Last-In-First-Out (LIFO) principle? a) Stack b) Queue c) Linked list d) Tree Which data structure allows elements to be accessed directly using an index? a) Stack b) Queue c) Array d) Linked list Which data structure represents a hierarchical structure with nodes and edges? a) Stack b) Queue c) Tree d) Linked list Which traversal visits the left subtree, then the root, and finally the right subtree? a) Preorder traversal b) Inorder traversal
c) Postorder traversal d) Level order traversal Which sorting algorithm repeatedly swaps adjacent elements if they are in the wrong order? a) Bubble sort b) Selection sort c) Insertion sort d) Merge sort Which search algorithm requires the data to be sorted and uses a divide-and-conquer approach? a) Linear search b) Binary search c) Depth-first search d) Breadth-first search Which data structure guarantees that the elements are stored in a sorted order? a) Stack b) Queue c) Binary search tree d) Linked list Which algorithm finds a minimum spanning tree in a weighted graph? a) Dijkstra's algorithm b) Prim's algorithm c) Kruskal's algorithm
d) Bellman-Ford algorithm Which algorithm solves optimization problems by making locally optimal choices at each stage? a) Depth-first search b) Breadth-first search c) Greedy algorithm d) Divide and conquer algorithm Which data structure is used to represent and evaluate arithmetic expressions? a) Stack b) Queue c) Tree d) Linked list Which data structure is based on the Last-In-First-Out (LIFO) principle and supports push and pop operations? a) Queue b) Array c) Linked list d) Stack Which data structure allows efficient insertion and deletion operations at both ends? a) Stack b) Queue c) Linked list d) Array
Which tree traversal visits the root, then the left subtree, and finally the right subtree? a) Inorder traversal b) Preorder traversal c) Postorder traversal d) Level order traversal Which sorting algorithm repeatedly selects the minimum element and places it in the correct position? a) Bubble sort b) Selection sort c) Insertion sort d) Quick sort Which search algorithm does not require the data to be sorted and sequentially checks each element until a match is found? a) Linear search b) Binary search c) Depth-first search d) Breadth-first search Which data structure is efficient for inserting elements at the beginning or end, but inefficient for arbitrary element access? a) Stack b) Queue c) Linked list
d) Array Which algorithm divides a problem into smaller subproblems, solves them recursively, and combines the solutions to the subproblems? a) Greedy algorithm b) Divide and conquer algorithm c) Depth-first search algorithm d) Breadth-first search algorithm Which data structure stores elements in a sorted manner and allows efficient search, insertion, and deletion operations? a) Stack b) Queue c) Binary search tree d) Linked list Which sorting algorithm works by repeatedly swapping adjacent elements if they are in the wrong order? a) Bubble sort b) Selection sort c) Insertion sort d) Merge sort Which traversal visits the left subtree, then the right subtree, and finally the root? a) Inorder traversal b) Preorder traversal
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help