DSA Long Quiz Flashcards

1
Q

Which of the following is not true about Computational Problems?

They entail solving tasks through computation and efficient algorithms.

Usually, solutions to them are empowered by streamlined data structures, for minimizing time and memory usage.

Solutions to them require optimization in addressing real-world challenges. ,

All of the above

None of the above.

A

None of the above.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which of the following is true about Abstract Data Types?

ADTs can be understood as high-level descriptions of data structures, specifying the behavior and operations associated with them without delving into the specific implementation details.

ADTs are like sets of rules for using special containers in a way to make it easy to organize and interact with different things.

Using ADTs would mean using data and operations.

All of the above.

None of the above.

A

All of the above.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

These are values, components and properties of what is placed inside a container.

Data

Operations

Primitive Data Type

None of the above.

A

Data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

These are manipulations of data.

Data

Operations

Primitive Data Type

None of the above.

A

Operations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

These represent basic building blocks of a programming language.

Data

Operations

Primitive Data Type

None of the above.

A

Primitive Data Type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which of the following is not an example of a Primitive Data Type?

Integers

Floating-point numbers

Characters

All of the above.

None of the above.

A

None of the above.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which of the choices follow the correct sequence of ADT Stages?

Representation, Implementation, Specification

Specification, Implementation, Representation

Specification, Representation, Implementation

Implementation, Specification, Representation

A

Specification, Representation, Implementation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

This ADT Stage involves creating a mathematical abstraction of a data structure.

Representation

Specification

Implementation

None of the above.

A

Specification

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

This ADT Stage is where the way to organize and store data is decided.

Representation

Specification

Implementation

None of the above.

A

Representation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

This ADT Stage is where the actual code is written to realize the ADT.

Representation

Specification

Implementation

None of the above.

A

Implementation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

This is a common ADT Operation where the data structure is created and setup.

Initialization

Insertion

Deletion

Search

A

Initialization

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

This is a common ADT Operation that looks for a particular element in the data structure.

Initialization

Insertion

Deletion

Search

A

Search

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

This Persian mathematician, astronomer and geographer, is known as the “father of algebra” and from whom the term “algorithm” came from.

Abu Ja’far Muhammed Ibn Musa Al-Khwarimzi

Abu Muhammad Ibn Al-Khwarimzi

Abu Ja’Far Muhammed Ibn Musa Al-Khwarimzi

Abu Ja’Far Muhammad Ibn Musa Al-Khwarizmi

A

Abu Ja’Far Muhammad Ibn Musa Al-Khwarizmi

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which of the following is true about good algorithms?

Good algorithms describe the process precisely and concisely.

Properties of good algorithms include having an input and output, definiteness and infiniteness.

Good algorithms only use natural language to define instructions.

All of the above.

None of the above.

A

Good algorithms describe the process precisely and concisely.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

These algorithms refer to the process of repeatedly executing a set of instructions or a block of code.

Iterative Algorithms

Recursive Algorithms

Advanced Algorithms

None of the above.

A

Iterative Algorithms

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

These algorithms refer to applying a rule of formula to its own result, again and again.

Iterative Algorithms

Recursive Algorithms

Advanced Algorithms

None of the above.

A

Recursive Algorithms

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Which of the following is used by Iterative Algorithms?

For Loop

While Loop

Both of these.

None of these.

A

Both of these.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Recursive algorithms require which key concepts?

Base Case

Recursive Step

Both of these.

None of these.

A

Both of these.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

In the recursiveness of factorials, the Factorial Function’s Base Case is which of the following?

If the input is 0, return 0.

If the input is 1, return n.

If the input is 0 or 1, return n.

If the input is 0 or 1, return 1.

A

If the input is 0 or 1, return 1.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

In the recursiveness of Fibonacci sequences, its Base Case is which of the following?

If the input is 0, return 0.

If the input is 1, return n.

If the input is 0 or 1, return n.

If the input is 0 or 1, return 1.

A

If the input is 0 or 1, return n.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

In the recursiveness of the Tower of Hanoi Problem, its Base Case is which of the following?

If the number of n disks is 1, then return 1.

If the number of n disks is 0, then return 1.

If the number of n disks is 1, then return 0.

None of these.

A

If the number of n disks is 1, then return 1.

22
Q

Which of the following is not a correct comparison of Iterative and Recursive Algorithms?

Iteration uses loops to repeat a set of instructions, while recursion calls itself to repeat a set of instructions.

Iteration typically uses loops, while recursion utilizes function calls.

The termination condition for iterations are defined explicitly in the loop conditions, while recursion requires a base case to cancel the termination.

All of the above.

None of the above.

A

The termination condition for iterations are defined explicitly in the loop conditions, while recursion requires a base case to cancel the termination.

23
Q

Which of the following about Computational Complexity is true?

It is a fundamental concept in computer science that deals with analysis of algorithms and their efficiency.

It provides a way to understand and measure how the performance of an algorithm scales with the size of the input data.

The primary goal is to classify algorithms based on their efficiency and to predict how they will perform as the input size increases.

All of the above

None of the above.

A

All of the above

24
Q

Time and Space Complexity are the two main aspects of Computational Complexity.

True

False

A

True

25
Q

Time Complexity is a measure of the amount of time an algorithm takes to complete as a function of the size of its input.

True

False

A

True

26
Q

Space Complexity measures the amount of memory an algorithm uses in relation to the size of its input.

True

False

A

True

27
Q

This analysis involves measuring and evaluating the performance of algorithms through experimentation.

Theoretical Analysis

Empirical Analysis

Data Analysis

Algorithm Analysis

A

Empirical Analysis

28
Q

This analysis involves using mathematical models to analyze the efficiency and performance of algorithms.

Theoretical Analysis

Empirical Analysis

Data Analysis

Algorithm Analysis

A

Theoretical Analysis

29
Q

Which of the following is a factor that affects empirical performance?

Programming language

Computer processor

Available memory

All of the above.

None of the above.

A

All of the above.

30
Q

The input size used in an algorithm is irrelevant in measuring its performance.

True

False

A

False

31
Q

This input case gives an upper bound performance guarantee to an algorithm.

Best Case

Worst Case

Average Case

No Case

A

Worst Case

32
Q

This input case gives the output in optimal time.

Best Case

Worst Case

Average Case

No Case

A

Best Case

33
Q

n the context of Big-O notions in algorithm analysis, the “O” stands for what?

Omega

Ordering

Order

Oneness

A

Order

34
Q

Big O notation is a way to describe the performance or complexity of an algorithm in terms of its input size.

True

False

A

True

35
Q

Among the following choices, which shows the best algorithm performance of runtime as per input size?

O(n)

O(log n)

O(n log n)

O(n!)

A

O(log n)

36
Q

Among the following choices, which shows the worst algorithm performance of runtime as per input size?

O(n)

O(log n)

O(n log n)

O(n!)

A

O(n!)

37
Q

Given the time function:
“T(n) = 3n + 1”
Which time complexity class would it belong to?

Constant

Linear

Logarithmic

Quadratic

A

Linear

38
Q

Given the time function:
“T(n) = 4n2 + log n + 2”
Which time complexity class would it belong to?

Constant

Linear

Logarithmic

Quadratic

A

Quadratic

39
Q

Given the time function:
“T(n) = 3 n log n + 2log n + 5”
Which time complexity class would it belong to?

Cubic

Superlinear

Logarithmic

Exponential

A

Superlinear

40
Q

In the analysis of the Factorial Function’s Iterative and Recursive Algorithms, which algorithm performed the best?

Iterative Algorithm

Recursive Algorithm

Both algorithms performed in the same time complexity class.

The analysis is inadequate to provide comparison.

A

Both algorithms performed in the same time complexity class.

41
Q

In the analysis of the Fibonacci sequence’s Iterative and Recursive Algorithms, which algorithm performed the worst?

Iterative Algorithm

Recursive Algorithm

Both algorithms performed in the same time complexity class.

The analysis is inadequate to provide comparison.

A

Recursive Algorithm

42
Q

In the analysis of the Tower of Hanoi Problem’s Iterative and Recursive Algorithms, which algorithm performed the best?

Iterative Algorithm

Recursive Algorithm

Both algorithms performed in the same time complexity class.

The analysis is inadequate to provide comparison.

A

Iterative Algorithm

43
Q

In the Fibonacci sequence’s recursive algorithm, which reason resulted to its time complexity of O(2n)?

Displaying the sum of two numbers.

The 0 and 1 as the base case values.

The branching factor of 2 for each level of recursion.

All of these were factors.

A

The branching factor of 2 for each level of recursion.

44
Q

This searching algorithm divides the sorted list in half repeatedly, discarding half of the remaining elements based on the comparison with the target value.

LRSearch (Left-to-Right)

RLSearch (Right-to-Left)

Binary Search

Linear Search

A

Binary Search

45
Q

Which searching algorithm has the best upper bound performance?

LRSearch (Left-to-Right)

RLSearch (Right-to-Left)

Binary Search

Linear Search

A

Binary Search

46
Q

This sorting algorithm divides the array into two halves, recursively sports each half and then combines the two sorted halves into a single sorted array.

Insertion Sort

Selection Sort

Merge Sort

QuickSort

A

Merge Sort

47
Q

Given the best input instance, which sorting algorithm performs the worst?

Insertion Sort

Selection Sort

Merge Sort

QuickSort

A

Selection Sort

48
Q

Given the worst input instance, which sorting algorithm performs the best?

Insertion Sort

Selection Sort

Bubble Sort

Heap Sort

A

Heap Sort

49
Q

Given the Recursive Algorithm of Fibonacci sequences, what is the total number of function calls for Fibo() when n = 5?

Algorithm:
1: define function Fibo(n):
2: if n=0 or n=1, return n
3: else return Fibo(n-1) + Fibo(n-2)
4: print(Fibo(5))

15

17

30

31

A

15

50
Q

Given the Recursive Algorithm of Factorial function, what is the total number of function calls for Factorial() when n = 5?

Algorithm:
1: define function Factorial(n):
2: if n=0 or n=1, return 1
3: else return n * Factorial(n-1)
4: print(Fibo(5))

4

5

12

13

A

5

51
Q

What’s the main difference between the recursive calls of the Fibonacci sequence and Factorial function’s algorithms?

Fibonacci Sequence

A

Recursively calls two recursive functions per level of recursion.

52
Q

What’s the main difference between the recursive calls of the Fibonacci sequence and Factorial function’s algorithms?

Factorial Function

A

Recursively calls one recursive functions per level of recursion.