Dear student, are you looking for some help in problem solving through programming in C NPTEL week 10 assignment? So, here in this article, we have provided C language assignment answers hints.
NPTEL Problem Solving Through Programming In C Week 10 Assignment Answers
Q1. What is the output of the C program given below?
#include <stdio.h>
int main(){
char str[]="NPTEL";
char str2[ ] = {'P', 'R'. 'O'. 'G'. 'R'. 'A', 'M', 'M', 'T'. 'N'. 'G'};
int n1 = sizeof(str1)/sizeof(str1[0]):
int n2 = sizeof(str2)/sizeof(str2[0]):
printf("n1 = %d. n2 = %d", nl, n2);
return 0;
}
a. n1 = 9, n2 = 10
b. n1 = 6, n2 = 11
c. n1 = 7, n2 = 12
d. n1 = 6, n2 = 10
Answer: Option B
1100+ Students are taking advantage of instant notification, Join us on telegram.
Q2. Bisection method is used to find
a. Derivative of a function at a given point
b. Numerical integration of a function within a range
c. The root of a function
d. None of the above
Answer: Option C
Q3. In…………………………………….. the search starts at the beginning of the list and checks every element in the list.
a. Linear search
b. Binary search
c. Hash search
d. Binary tree search
Answer: Option A
Q4. What is the worst-case complexity of bubble sort?
a. O(N log N)
b. O(log N)
c. O(N)
d. O(N2)
Answer: Option D
Q5. What maximum number of comparisons can occur when a bubble sort is implemented? Assume there are n elements in the array.
a. (1/2) (n-1)
b. (1/2)n(n-1)
c. (1/4)n(n-1)
d. None of the above
Answer: Option B
Q6. What are the correct intermediate steps of the following data set when it is being sorted with the bubble sort? 7,4,1,8,2
a. 4.7.1.8.2 →4.1.7.2.8 →4.1.2.7.8 →1.4.2.7.8 →1.2.4.7,8
b. 4.7.1.8.2→ 4.1.7.8.2→ 4.1.7.2.8→ 1.4.7.2.8 →1.4.2.7,8→ 1.2.4.7,8
c. 4.7.1.8.2→ 1.4.7.8.2 →1.4.2,7,8→1,2,4,7,8
d. 4.7,1,8.2 →4.7.1.2.8→ 1.4.7.2.8→ 1.4.2.7.8 →1.2.4,7,8
Answer: Option A
Q7. Which of the following statement is correct for the 2 arrays with respect to A and B.
int *x[5];
int *(y[5]);
A. Array of pointers
B. Pointer to an array
a. x is A, y is B
b. x is A, y is A
c. x is B. y is A
d. y is B. y is B
Answer: Option A
Q8. Find the output of the following program
#include <stdio.h>
int main(){
int *ptr, a = 5;
ptr = &a;
*ptr =*ptr - 3;
printf("%d,%d", *ptr, a);
return 0;
}
Answer: 2,2
Q9. What is the solution of the equation given below using the Bisection Method up to four decimal places? (Consider the root lying on positive quadrant only and compute the root till five iterations only)
f(x) = xe2x-3x²-5
Answer: 1.0312
Q10. What will be the output?
#include <stdio.h>
int main(void){
int a[] = {10, 12, 6, 7, 2};
int i, *p:p=a+4;
for(i=0; i<5; i++)
printf("%d", p[-1]);
return 0;
}
a. 10 12 6 7 2
b. 10 12 6 7
c. 2 7 6 12
d. 2 7 6 12 10
Answer: Option D.
TELEGRAM FOR NOTIFICATION | Click Here |
Follow on Google News (in one click) | Click Here |
Disclaimer: These answers are provided only for the purpose of helping 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 9