NPTEL Problem Solving Through Programming In C Week 9 Assignment Answers 2025
1. Which of the following are C pre-processor directive?
a) #ifdef
b) #define
c) #endif
d) all of the mentioned
Answer :- For Answers Click Here
2. What is the correct order of insertion sort (in ascending order) of the array arr[5]={8 3 5 9 4}?
a) {3 8 5 9 4} –> {3 5 8 9 4} –> {3 4 5 8 9}
b) {3 8 5 9 4} –> {3 5 8 9 4} –> {3 5 8 4 9} –> {3 5 4 8 9} –> {3 4 5 8 9}
c) {3 8 5 9 4} –> {3 4 8 5 9} –> {3 4 5 8 9} –> {3 4 5 8 9} –> {3 4 5 8 9}
d) {8 3 5 4 9} –> {8 3 4 5 9} –> {3 4 5 8 9}
Answer :-
3. Given an array arr = {12, 34, 47, 62, 85, 92, 95, 99,105} and key = 34; what are the mid values (corresponding array elements) generated in the first and second iterations of binary search?
a) 85 and 12
b) 85 and 34
c) 62 and 34
d) 62 and 47
Answer :-
4. Binary Search can be categorized into which of the following?
a) Brute Force technique
b) Divide and conquer
c) Greedy algorithm
d) Dynamic programming
Answer :-
5. Select the code snippet which performs unordered linear search iteratively?
d) None of the above
Answer :- For Answers Click Here
6. Consider the array A[]= {5,4,9,1,3} apply the insertion sort to sort the array . Consider the cost associated with each sort is 25 rupees, what is the total cost of the insertion sort for sorting the entire array?
a) 25
b) 50
c) 75
d) 100
Answer :-
7.
a) 0
b) 1
c) 01
d) None of the above
Answer :-
8.
a) 10 10
b) 10 50
c) 50 50
d) Compilation error
Answer :-
9. What is the worst case complexity of selection sort?
Answer :-
10. If the given input array is sorted or nearly sorted, which of the following algorithm gives the best performance?
a) Insertion sort
b) Selection sort
c) Bubble sort
d) Quick sort
Answer :- For Answers Click Here