Unit 1: Behaviour Analysis - Practice Quiz

CSE330 — Competitive Coding Approaches-Techniques 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 What does the limit of a function describe?

Introduction to limits and behaviour of logic Easy
A. Its behavior near a point
B. Its number of variables
C. Its largest possible output
D. Its value at every input

2 In algorithm analysis, what does asymptotic behavior mainly describe?

Introduction to limits and behaviour of logic Easy
A. The number of comments written
B. Performance for small inputs
C. Performance for large inputs
D. The programming language used

3 Which notation commonly represents an upper bound on an algorithm's growth rate?

Introduction to limits and behaviour of logic Easy
A. notation
B. notation
C. notation
D. notation

4 What happens to the importance of constant operations as input size grows?

Introduction to limits and behaviour of logic Easy
A. They remain the main factor
B. They become less important
C. They determine the input size
D. They become more important

5 What does worst-case analysis measure?

Understanding taxonomy in worst case Easy
A. The maximum resources required
B. The average resources required
C. The unused resources available
D. The minimum resources required

6 Which complexity class generally grows more slowly?

Understanding taxonomy in worst case Easy
A.
B.
C.
D.

7 What is the worst-case time complexity of accessing an element by index in an array?

Understanding taxonomy in worst case Easy
A.
B.
C.
D.

8 Which notation represents a tight asymptotic bound?

Understanding taxonomy in worst case Easy
A. notation
B. notation
C. notation
D. notation

9 What is the worst-case time complexity of a linear search in an unsorted array?

Understanding taxonomy in worst case Easy
A.
B.
C.
D.

10 What does the effectiveness of an algorithm mainly refer to?

Analysing the effectiveness and efficiency of algorithms Easy
A. Using the most variables
B. Having the shortest code
C. Using the newest hardware
D. Producing the correct result

11 What does the efficiency of an algorithm mainly measure?

Analysing the effectiveness and efficiency of algorithms Easy
A. Its resource usage
B. Its documentation style
C. Its variable names
D. Its output format

12 Two algorithms solve the same problem correctly. Which one is generally more efficient?

Analysing the effectiveness and efficiency of algorithms Easy
A. The one using fewer resources
B. The one containing more code
C. The one using more memory
D. The one using more steps

13 Why are algorithms analyzed before implementation?

Analysing the effectiveness and efficiency of algorithms Easy
A. To estimate resource requirements
B. To choose better variable names
C. To avoid writing any code
D. To remove all input values

14 Which factor is most important when comparing algorithm efficiency for large inputs?

Analysing the effectiveness and efficiency of algorithms Easy
A. The number of comments
B. The screen size
C. The file name
D. The growth rate

15 What does time complexity measure?

Measuring time and space complexity of algorithm Easy
A. The number of output lines
B. The size of the source file
C. The growth of running steps
D. The clock time on one machine

16 What does space complexity measure?

Measuring time and space complexity of algorithm Easy
A. The input's numerical value
B. The execution speed only
C. The memory used by an algorithm
D. The number of program functions

17 What is the time complexity of a loop that runs exactly times?

Measuring time and space complexity of algorithm Easy
A.
B.
C.
D.

18 What is the time complexity of two separate nested loops, each running times?

Measuring time and space complexity of algorithm Easy
A.
B.
C.
D.

19 What is an algorithmic trade-off?

Trade-off concept Easy
A. Using identical algorithms everywhere
B. Improving one resource while affecting another
C. Removing all resource requirements
D. Ignoring the algorithm's output

20 What does a time-space trade-off usually mean?

Trade-off concept Easy
A. Using memory to reduce running time
B. Using more time to reduce input
C. Using hardware to change correctness
D. Using less memory to remove output

21 For and , what does imply?

Introduction to limits and behaviour of logic Medium
A. eventually becomes equal to
B. grows asymptotically slower than
C. grows asymptotically faster than
D. and have identical growth

22 An algorithm repeatedly replaces by until . Which expression best describes the number of repetitions?

Introduction to limits and behaviour of logic Medium
A.
B.
C.
D.

23 Suppose and . What is ?

Introduction to limits and behaviour of logic Medium
A.
B.
C.
D.

24 A condition is evaluated as x != 0 && 100 / x > 5 using short-circuit logic. What happens when ?

Introduction to limits and behaviour of logic Medium
A. Both conditions are evaluated and the result is false
B. The expression causes division by zero before comparison
C. The second condition is skipped, avoiding division by zero
D. The second condition is evaluated before the first condition

25 Which statement correctly interprets a worst-case bound of for an algorithm?

Understanding taxonomy in worst case Medium
A. Its running time is eventually bounded above by a constant times
B. Its running time is exactly operations for every possible input
C. Its average running time must grow at the same rate as
D. Its running time is eventually bounded below by a constant times

26 Insertion sort is applied to an array of distinct values. Which input arrangement produces its worst-case running time?

Understanding taxonomy in worst case Medium
A. Values arranged with one inversion
B. Values arranged in cyclic order
C. Values arranged in descending order
D. Values arranged in ascending order

27 An algorithm has worst-case complexity and best-case complexity . Which claim is valid for all inputs of size ?

Understanding taxonomy in worst case Medium
A. The running time is always
B. The running time is
C. The running time is always
D. The running time is

28 Binary search is performed on a sorted array of elements. What is the maximum number of element comparisons under the standard midpoint implementation?

Understanding taxonomy in worst case Medium
A. comparisons
B. comparisons
C. comparisons
D. comparisons

29 Algorithm A takes operations, while Algorithm B takes operations. Ignoring machine effects, for which listed input size is Algorithm A more efficient?

Analysing the effectiveness and efficiency of algorithms Medium
A.
B.
C.
D.

30 Two sorting algorithms have the same time complexity, but Algorithm X performs fewer comparisons and uses the same memory as Algorithm Y. What is the most justified conclusion?

Analysing the effectiveness and efficiency of algorithms Medium
A. Algorithm Y must become faster for every sufficiently large input
B. Algorithm X may be faster while having the same asymptotic efficiency
C. Algorithm X must belong to a lower asymptotic complexity class
D. Algorithm Y is more effective because it performs more comparisons

31 An algorithm runs quickly but sometimes returns an incorrect result. How should it be evaluated?

Analysing the effectiveness and efficiency of algorithms Medium
A. It is effective but not fully efficient
B. It is both effective and efficient
C. It is neither measurable nor analysable
D. It is efficient but not fully effective

32 Algorithm P requires operations, while Algorithm Q requires operations. Which algorithm is generally more scalable for sufficiently large ?

Analysing the effectiveness and efficiency of algorithms Medium
A. Algorithm P, because it has a smaller exponent
B. Algorithm Q, because cubic growth is constant
C. Algorithm P, because exponential growth is slower
D. Algorithm Q, because polynomial growth is slower

33 What is the time complexity of the following loop?

for i = 1 to n:

for j = 1 to i:

perform_constant_work()

Measuring time and space complexity of algorithm Medium
A.
B.
C.
D.

34 An algorithm first executes a loop and then executes a separate loop. What is its total time complexity?

Measuring time and space complexity of algorithm Medium
A.
B.
C.
D.

35 A recursive function makes one call on input size and stores a constant amount of local data per call. What is its auxiliary space complexity if recursion reaches ?

Measuring time and space complexity of algorithm Medium
A.
B.
C.
D.

36 A loop starts with and updates after each iteration until . What is its time complexity?

Measuring time and space complexity of algorithm Medium
A.
B.
C.
D.

37 A recursive solution recalculates the same subproblems many times. Memoization is added. What trade-off is being made?

Trade-off concept Medium
A. Higher input size is accepted to improve correctness
B. Additional memory is used to reduce execution time
C. Lower accuracy is accepted to improve execution time
D. Additional execution time is used to reduce memory

38 A program replaces repeated linear searches in a list with lookups in a hash table. What is the primary expected trade-off?

Trade-off concept Medium
A. Faster worst-case lookup with no extra memory
B. Faster average lookup with greater memory usage
C. Slower average lookup with lower memory usage
D. Slower worst-case lookup with greater accuracy

39 A large file is compressed before being sent through a slow network. Under which condition is compression most likely to reduce the total completion time?

Trade-off concept Medium
A. Compression time is greater than the original transmission time
B. Compressed and original files require equal transmission time
C. Decompression requires more space than the original file
D. Compression time is less than the transmission time saved

40 A stable merge sort and an in-place heap sort both take time. Which requirement most strongly favors heap sort?

Trade-off concept Medium
A. Preserving the order of equal keys
B. Supporting sequential disk access
C. Optimizing nearly sorted input
D. Minimizing auxiliary memory usage

41 Let and be positive functions for sufficiently large . Which statement about the limit is correct?

Introduction to limits and behaviour of logic Hard
A. If the limit does not exist, the functions are incomparable
B. If , then
C. If , then
D. If , then

42 Suppose and . Which asymptotic conclusion is valid?

Introduction to limits and behaviour of logic Hard
A. although the ratio has no limit
B. and are asymptotically incomparable
C. because the multiplier exceeds one
D. because the sine term oscillates

43 For positive functions and , assume . Which conclusion follows directly?

Introduction to limits and behaviour of logic Hard
A. and therefore
B. but not
C. but not
D. and therefore

44 Let for sufficiently large . How does compare asymptotically with ?

Introduction to limits and behaviour of logic Hard
A. but
B. because the exponent averages to one
C. but
D. is neither nor

45 An algorithm's worst-case running time is known to satisfy and . What is the strongest justified classification?

Understanding taxonomy in worst case Hard
A.
B. must alternate between linearithmic and quadratic time
C. lies between the two bounds but need not match either
D.

46 A deterministic quicksort implementation always chooses the first array element as its pivot. Which statement correctly characterizes its worst case on arrays of distinct keys?

Understanding taxonomy in worst case Hard
A. It is because partitions can have sizes and
B. It is because each partition is linear
C. It is because each partition creates two recursive calls
D. It is because every level performs quadratic work

47 A dynamic program runs in time, where is a positive integer supplied in binary. Which interpretation is most accurate?

Understanding taxonomy in worst case Hard
A. It is strongly polynomial because the running time contains two parameters
B. It is logarithmic in because binary encoding uses bits
C. It is polynomial in the total bit length because is an input
D. It is pseudopolynomial and may be exponential in the encoding length of

48 For every input of size , an algorithm executes exactly one of two feasible branches. Their tight worst-case costs are and . What is the overall tight worst-case cost?

Understanding taxonomy in worst case Hard
A.
B.
C.
D.

49 Algorithm A uses primitive operations, while Algorithm B uses operations. Both are correct. What can be concluded about their practical running times for inputs up to a fixed limit ?

Analysing the effectiveness and efficiency of algorithms Hard
A. Their ordering requires a cost model or measurement over the target range
B. Their running times are equal when both process the same input
C. B is always faster because its leading constant is smaller
D. A is always faster because its asymptotic class is smaller

50 A procedure returns a correct answer whenever it terminates, but on some valid inputs it loops forever. Which property does it possess?

Analysing the effectiveness and efficiency of algorithms Hard
A. Partial correctness but not total correctness
B. Termination correctness but not functional correctness
C. Total correctness but not partial correctness
D. Asymptotic correctness but not semantic correctness

51 A Las Vegas randomized algorithm always returns the correct result and has expected running time , but it may repeatedly restart. Which claim is justified?

Analysing the effectiveness and efficiency of algorithms Hard
A. Every execution terminates within time
B. Its worst-case running time is by Markov's inequality
C. At least half of all executions take exactly time
D. Its average over internal randomness is without a deterministic bound

52 An algorithm reports all intersections among geometric objects in time. Why can this be more informative than a bound expressed only in ?

Analysing the effectiveness and efficiency of algorithms Hard
A. It separates preprocessing work from the unavoidable output cost
B. It guarantees is asymptotically smaller than
C. It eliminates the need to consider worst-case values of
D. It proves the algorithm uses constant time for every intersection

53 Consider a loop where, for each integer from through , an inner counter takes the values while it is less than . What is the total running time?

Measuring time and space complexity of algorithm Hard
A.
B.
C.
D.

54 What is the tight asymptotic solution of with constant base cases?

Measuring time and space complexity of algorithm Hard
A.
B.
C.
D.

55 A depth-first divide-and-conquer algorithm splits a problem into two halves. Each active call allocates an auxiliary array proportional to its subproblem size and keeps it until that call returns. What is the peak auxiliary space?

Measuring time and space complexity of algorithm Hard
A.
B.
C.
D.

56 A dynamic array triples its capacity whenever full. Copying an array of capacity costs . Starting empty, what is the total copying cost of the first append operations?

Measuring time and space complexity of algorithm Hard
A.
B.
C.
D.

57 A naive recursive solver for a problem with state repeatedly recomputes states and takes exponential time. There are reachable states, each requiring transition work. What trade-off does full memoization provide?

Trade-off concept Hard
A. time using additional space
B. time using additional space
C. time using additional space
D. time using additional space

58 Compared with storing all keys exactly in a hash set, which guarantee describes a standard Bloom filter with no deletions?

Trade-off concept Hard
A. It uses less space but permits false negatives
B. It uses less space but permits false positives
C. It uses equal space and supports exact membership
D. It uses more space and eliminates hash collisions

59 For exact subset sum on unrestricted integers, a meet-in-the-middle method stores all sums from each half. What time-space profile does it typically achieve?

Trade-off concept Hard
A. time and space
B. time and space
C. time and space
D. time and space

60 A data structure can precompute a table in time and space, after which each query costs . Without the table, each query costs and preprocessing is constant. For queries, when is precomputation asymptotically faster?

Trade-off concept Hard
A. When
B. When
C. When
D. When