You are on page 1of 6

SYMBIOSIS CENTRE FOR DISTANCE LEARNING (SCDL)

Subject: Algorithms & Programming Concepts

Sample Questions:

Section I: Subjective Questions


1. State the properties of a good algorithm.

2. Why is it important to write language-neutral algorithms?

3. Write a short note on Greedy algorithms.

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?

Section II: Objective Questions

Multiple Choice Single Response

1. It is the technique of arranging the elements/records in a particular order or sequence.


1] Searching
2] Sorting
3] Linking
4] Optimisation

2. This helps the programmer to find errors:


1] Operator
2] Loop
3] Pseudocode
4] Debugging

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

4. The steps required to solve the problem must be arranged


1] Sequentially
2] Logically
3] Bottom to top
4] None of the above
SYMBIOSIS CENTRE FOR DISTANCE LEARNING (SCDL)
Subject: Algorithms & Programming Concepts

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

6. This keyword is used to jump to a specific step in an algorithm.


1] go to
2] for
3] return
4] None of the above

7. This can be used to indicate the steps included inside a block.


1] Comparison
2] Indentation
3] Repetition
4] Execution

8. Which of the following functions is performed by ‘>’ operator?


1] Less than or equal to
2] Greater than or equal to
3] Strictly greater than
4] None of the above

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

10. What is Binary search?


1] Process of traversing the entire list from beginning to end
2] Process of searching for the specified item in a sorted list
3] Both
4] None of the above

Multiple Choice Multiple Response

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

12. Limitations of flowchart:


1] Complex
SYMBIOSIS CENTRE FOR DISTANCE LEARNING (SCDL)
Subject: Algorithms & Programming Concepts

2] Costly
3] Difficult to modify
4] Regular updates

13. Stages in Dynamic Programming are


1] Substructure
2] Table-structure
3] Computation
4] Resolution of the problem

14. This flow must have an exit condition:


1] Recursive flow
2] Sequential flow
3] Repetitive flow
4] Nested flow

15. Problems can be


1] Repeatable
2] Unsolvable
3] NP-Complete
4] NP

16. These are the main tools used to represent an algorithm:


1] Flow chart
2] Pseudocode
3] The actual code
4] Repetition

17. The disadvantages of Quick Sort are:


1] Unbalanced partition due to the choice of the pivot element can lead to a very slow sort
2] It is unstable in nature
3] It is able to process large lists fast
4] No additional storage is required

18. Choose the incorrect statements:


1] Internal sorting is used if the number of items to be sorted is very large
2] External sorting needs auxiliary storage
3] Bubble sort works recursively to select an element and place it in the correct position in the
sequence
4] Selection sort works repeatedly by swapping elements in the adjacent places that are not in
order, till the entire list is in a particular order.

Fill in the Blanks

19. _______ have some predefined meanings associated with them.


1] Variables
2] Data structure
3] Keywords
SYMBIOSIS CENTRE FOR DISTANCE LEARNING (SCDL)
Subject: Algorithms & Programming Concepts

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

25. The number of arithmetic operations is counted at the _______ level.


1] Bit
2] Priority
3] Comparison
4] Logical

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

State True or False

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.

Match the Following

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

40. 1] Rectangle shaped symbol 1] Used to represent processing of data


2] Parallelogram shaped symbol 2] Used to represent the input/output operations
3] Rhombus shaped box 3] Used for the decision / conditions
4] Round shaped symbol 4] Used as a connector
5] Used to represent start/stop
6] Used to represent subroutines
SYMBIOSIS CENTRE FOR DISTANCE LEARNING (SCDL)
Subject: Algorithms & Programming Concepts

41. 1] O(1) 1] Complexity of sequential search


2] O(log2n) 2] Average case complexity of bubble sorting
3] O(n) 3] Average case complexity of quicksort
4] O(n2) 4] Average case complexity of merge sort
5] Best case complexity of binary search
6] Worst case complexity of binary search

42. 1] Parallel Execution 1] Withdraw money from the back account


2] Recursive Flow 2] Find factorial of a positive number
3] Nested Flow 3] Given number is prime number or not
4] Sequential Flow 4] Addition of given three numbers
5] Not optimised the memory utilisation
6] Check given year is a leap year or not