Algorithms & Programming Concepts
Algorithms & Programming Concepts
Sample Questions:
4. Write a simple algorithm to check if a given number is prime or not, using Repetitive Flow.
5. Write the limitations of the Binary Search algorithm. Also state the best, average and worst case
complexity of the Binary Search algorithm.
6. Define the following problems: 1. P problems 2. NP problems 3. NP-Complete problems
7. Find the value of A and show the order of computation, A = 8 + 7 *20 / 4 ^ 2 - (2 + 3).
8. What is the difference between External and Internal Sorting?
3. Generally, divide and conquer algorithm divides the main problem into:
1] One sub-problem
2] Multiple sub-problems
3] Two sub-problems
4] None of the above
5. This sorting is applied in situations where the data elements to be sorted are small and can fit
into the processor's main memory and no extra space is required.
1] External
2] Internal
3] Ordered
4] Unordered
9. The logical operator, which returns true when both the conditions or boolean expressions are
true, is
1] AND
2] OR
3] NOT
4] EXOR
11. The factors that may be considered when analysing an algorithm are:
1] Readability
2] Usability
3] Effort of the programmer
4] Number of output display function
2] Costly
3] Difficult to modify
4] Regular updates
4] Constants
20. In ________ flow, the execution of inner loop depends on execution of outer loop.
1] Recursive
2] Conditional
3] Nested
4] Repetitive
21. Whenever certain steps must be executed based on a precondition, the condition must be used
________ the set of steps.
1] After
2] Before
3] Between
4] To modify
22. In case of dynamic programming, the optimal solution of the problem varies upon number of
_______.
1] Sub-problems, tables
2] Problems, choices
3] Sub-problems, choices
4] Problems, tables
23. All the steps may not be executed in the sequence in _______.
1] Sequential flow
2] Conditional flow
3] Random flow
4] Iterative flow
24. Algorithm must get terminated or stopped after performing finite number of steps and each step
must be executed finite number of times. This feature of an algorithm is termed as _____.
1] Finiteness
2] Infiniteness
3] Decision
4] Repetition
26. The complexity of binary search in best case is ________ for ‘n’ items list.
1] O(log2 n)
2] O(1)
3] O(n)
4] O(n2)
SYMBIOSIS CENTRE FOR DISTANCE LEARNING (SCDL)
Subject: Algorithms & Programming Concepts
27. The steps following a condition are executed only if the result of condition is ____.
1] Infinite
2] Negative
3] Positive
4] Not known
28. For every time the _______ starts from beginning and can repeat independently of previous or
next execution.
1] Inner loop, outer loop
2] Outer loop, inner loop
3] Program, algorithm
4] Loop, complexity
29. For judging the efficiency of an algorithm, the number of comparisons is of more importance at
times.
30. Any algorithm can have two cases of complexity.
31. The implementation of parallel execution is not dependent on underlying operating system.
32. We need to use parallel execution whenever two sets of instructions can be handled
dependently.
33. Fork and join can be used to perform actions that can be performed in parallel but need not be
combined later to proceed.
34. Divide and Conquer algorithm divides the main problem into multiple sub-problems or parts
that are the same as the original problem but in smaller sizes.
35. In Greedy algorithm, if the set is not feasible, the elements are rejected.
36. In Bubble sort, the total number of iterations is one greater than the total number of elements.
37. Parallel execution method is used to optimise memory utilisation.
38. Dynamic programming is powerful enough for designing algorithms related to optimization
problems.
39. 1] Worst Case big Oh 1] Describes an upper bound for all input
2] Worst Case small Oh (Theta) 2] Describes asymptotic bounds for worst case input
3] Worst Case Omega 3] Describes a lower bound for worst case input,
which will be greater than the best case.
4] Average Case Omega 4] Similar to best case
5] Similar to worst case
6] Describes a lower bound for all input