Sign Up

Sign In

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Sorry, you do not have permission to ask a question, You must login to ask a question.

SIKSHAPATH Latest Articles

Problem Solving Through Programming In C NPTEL Assignment Answers Week 9 2022

Problem Solving Through Programming In C NPTEL Assignment Answers Week 9 2022

Dear student, are you looking for some help in problem solving through programming in C NPTEL week 9 assignment? So, here in this article, we have provided C assignment answer’s hint.

Problem Solving Through Programming In C NPTEL Assignment Answers Week 9

Q1. What is the best case complexity of ordered linear search and worst case complexity of selection sort respectively?

a. O(1), O(n²)

b. O(logn), O(1),


c. O(n), O(logn)

d. O(n²), O(nlogn)

Answer: a. O(1), O(n²)

1100+ Students are taking advantage of instant notification, Join us on telegram.


Q2. Which of the following is/are correct?

I.Binary search is applied when elements are sorted.

II.Linear search can be applied when elements are in random order.

III. Binary search can be categorized into divide and conquer rule.

a. I & II

b. Only I

c. I and III

d. I,II&III

Answer: d. I,II&III


Q3. What is the recurrence relation for the linear search recursive algorithm?

a. T(n-2)+c

b. 2T(n-1)+c

c. T(n-1)+c

d. T(n+1)+c

Answer: c. T(n-1)+c


Q4. Given an array arr = {20, 45, 77, 89, 91, 94, 98.100) and key = 45; what are the mid values (corresponding array elements) generated in the first and second iterations?

a. 91 and 98

b. 89 and 45

c. 89 and 77

d. 91 and 94

Answer: b. 89 and 45


Q5. Consider an array of elements A[7] (10,4,7,23,67,12,5), what will be the resultant array A after third pass of insertion sort.

a. 67,12,10,5,4,7,23

b. 4,7,10,23,67,12,5

c. 4,5,7,67,10,12,23

d. 10,7,4,67,23,12,5

Answer: b. 4,7,10,23,67,12,5


Q6. Select the code snippet which performs unordered linear search iteratively?

a. intunordered Linear Search (intarr[], int size, int data) {
 int index;
  for(inti=0; i<< size; i++)
{
 if(arr[i] = data)
{
index = i;
break;
}
}
return index;
}

b. intunordered Linear Search (intarr[], int size, int data) {
int index;
for(inti = 0; i<< size; i++)
{ 
  if(arr[i]= data)
 {
  break;
 }
}
return index;
}

c. intunordered LinearSearch (intarr[], int size, int data){
int index;
for(inti = 0; i<= size; i++)
{
 if(arr[i] = data)
{
index = i;
continue;
}
}
return index;
}

d. None of the above

Answer: Option A


Q7. Which of the following input will give worst case time complexity for selection sort to sort an array in ascending order?

I. 1,2,3, 4, 5, 6, 7, 8

II. 8,7,6, 5, 4, 3, 2, 1,

III. 8,7,5,6,3,2,1,4

a. I

b. II

c. II and III

d. I,II and III

Answer: b. II


Q8. 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: c. 75


Q9. A sorting technique is called stable if:

a. It takes O(nlog n)time

b. It maintains the relative order of occurrence of non-distinct elements

c. It uses divide and conquer paradigm

d. It takes O(n) space

Answer: b. It maintains the relative order of occurrence of non-distinct elements


Q10. The average case occurs in the Linear Search Algorithm when

a. The item to be searched is in some where middle of the Array

b. The item to be searched is not in the array

c. The item to be searched is in the last of the array

d. The item to be searched is either in the last or not in the array

Answer: a. The item to be searched is in some where middle of the Array


TELEGRAM FOR NOTIFICATIONClick Here
Follow on Google News (in one click)Click Here

Disclaimer: These answers are provided only for the purpose to help students to take references. This website does not claim any surety of 100% correct answers. So, this website urges you to complete your assignment yourself.


Also Available:

Problem Solving Through Programming In C NPTEL Assignment Answers Week 8

Related Posts

Leave a comment

You must login to add a new comment.

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
100% Free SEO Tools - Tool Kits PRO