What is an algorithm?
Group of answer choices
A sequence of unambiguous instructions for solving a problem
A method for creating infinite loops
A set of ambiguous rules
A random sequence of instructions
A sequence of unambiguous instructions for solving a problem
Which of the following is NOT a characteristic of an algorithm?
Group of answer choices
Ambiguity
Effectiveness
Definiteness
Finiteness
Ambiguity
Which step involves translating each step of an algorithm into code?
Group of answer choices
Algorithm analysis
Algorithm specification
Implementation of an algorithm
Problem definition
Implementation of an algorithm
What is pseudocode?**
Group of answer choices
A programming language with strict syntax rules
A high-level description of an algorithm without syntax restrictions
A formal mathematical proof
A type of algorithm used only for sorting
A high-level description of an algorithm without syntax restrictions
What is the primary purpose of program testing?
Group of answer choices
To find errors in the program
To document the program
To optimize the program’s runtime
To prove the program is completely correct
To find errors in the program
Which of the following is NOT a fundamental data structure?
Group of answer choices
Algorithm
Linked list
Stack
Array
Algorithm
What is the time complexity of an algorithm?
Group of answer choices
The amount of memory it uses
The relationship between input size and the number of steps required
The number of lines of code
The clarity of the pseudocode
The relationship between input size and the number of steps required
What is the purpose of the Sieve of Eratosthenes?
Group of answer choices
Sorting numbers
Solving graph problems
Generating a list of prime numbers
Finding the greatest common divisor
Generating a list of prime numbers
Which algorithm is used to find the greatest common divisor (GCD) of two numbers?
Group of answer choices
Insertion sort
Bubble sort
Euclid’s algorithm
Binary search
Euclid’s algorithm
What is the key difference between arrays and linked lists?
Group of answer choices
Arrays are always sorted, while linked lists are not
Arrays cannot store integers, while linked lists can
Arrays use contiguous memory, while linked lists use arbitrary memory locations
Arrays are dynamic, while linked lists are static
Arrays use contiguous memory, while linked lists use arbitrary memory locations
Which data structure follows the LIFO principle?
Group of answer choices
Stack
Graph
Queue
Priority queue
Stack
What is the main advantage of binary search over sequential search?
Group of answer choices
Binary search is faster for large, sorted datasets
Binary search works on unsorted data
Binary search requires more memory
Binary search works only on strings
Binary search is faster for large, sorted datasets
What is a graph in computer science?
Group of answer choices
A collection of points called vertices connected by edges
A type of sorting algorithm
A method for storing strings
A collection of vertices and edges
A collection of points called vertices connected by edges
What is a tree in the context of data structures?
Group of answer choices
A sorting algorithm
A linear data structure
A connected acyclic graph
A type of graph with cycles
A connected acyclic graph
Which of the following is NOT a property of a binary search tree?
Group of answer choices
The tree is ordered
Values in the left subtree are smaller than the parent
Values in the right subtree are smaller than the parent
Each node has at most two children
Values in the right subtree are smaller than the parent
What is the maximum number of edges in an undirected graph with n vertices?
Group of answer choices
2n
n-1
n(n-1)/2
n
n(n-1)/2
What is the height of a tree?
Group of answer choices
The number of vertices in the tree
The length of the shortest path from the root to a leaf
The length of the longest simple path from the root to a leaf*
The number of edges in the tree
The length of the longest simple path from the root to a leaf*
Which sorting algorithm is typically implemented using recursion?
Group of answer choices
Bubble sort
Merge sort
Insertion sort
Selection sort
Merge sort
What is the main purpose of documentation in software development?
Group of answer choices
To make the program run faster
To reduce memory usage
To improve maintainability and knowledge transfer*
To replace testing
To improve maintainability and knowledge transfer*
What is recursion in the context of algorithms?
Group of answer choices
A process where a function calls another function repeatedly
A technique that avoids using functions entirely
A method that exclusively uses loops to solve problems
A process where a function calls itself directly or indirectly
A process where a function calls itself directly or indirectly
Which of the following best describes the difference between iteration and recursion?
Group of answer choices
Recursion is always faster than iteration
Iteration uses repetition structures while recursion uses selection structures
Recursion consumes less memory than iteration
Iteration uses the stack while recursion does not
Iteration uses repetition structures while recursion uses selection structures
What is the primary reason for defining a base case in a recursive function?
Group of answer choices
To avoid infinite loops
To increase execution speed
To allow multiple functions to be called simultaneously
To reduce memory usage
To avoid infinite loops
In the context of recursion, what is tail recursion?
Group of answer choices
When the recursive call is the last operation performed in the function
When the function calls another function instead of itself
When the recursive call happens at the beginning of the function
When there are multiple recursive calls within the same function
When the recursive call is the last operation performed in the function
What is the output of the following recursive function when n=3? int fun(int n){ if(n==1) return 1;else return 1 + fun(n-1);}
Group of answer choices
1
2
4
3
3