Problem Solving Through Programming in C Nptel Assignment Answers 2022 Week 10 | NPTEL Week 10 Quiz Assignment | NPTEL Assignment Solutions

NPTEL Problem Solving Through Programming in C Week 10 Quiz Assignment | NPTEL Swayam Assignment Answers


problem solving through programming in c nptel assignment answers 2022 week 10



Join Us On Telegram

     ðŸ‘‡ðŸ‘‡ðŸ‘‡ðŸ‘‡ðŸ‘‡ðŸ‘‡ðŸ‘‡ðŸ‘‡

telegram


Join Us On Youtube

     ðŸ‘‡ðŸ‘‡ðŸ‘‡ðŸ‘‡ðŸ‘‡ðŸ‘‡ðŸ‘‡ðŸ‘‡
youtube



MCQs (multiple choice questions) Nptel Week 10 Quiz Answers:


Q.1: What is the output of C program given below ?

#include <stdio.h>
int main()
{
    char str1[]="NPTEL";
    char str2[]={'P','R','O','G','R','A','M','M','I','N','G'};
    int n1=sizeof(str1)/sizeof(str1[0]);
    int n2=sizeof(str2)/sizeof(str2[0]);
    printf("n1=%d, n2=%d",n1,n2);
    return 0;
}


Options are:

(a) n1 = 9, n2 = 10
(b) n1 = 6, n2 = 11
(c) n1 = 7, n2 = 12
(d) n1 = 6, n2 = 10


Answer is: (b) n1 = 6, n2 = 11



Q.2: The bisection method is used to find. Options are:

(a) Derivative of a function at a given point
(b) Numerical integration of a function within a range
(c) The root of the function
(d) None of the above

Answer is: (c) The root of the function



Q.3: In __________ , the search starts at the beginning of the list and checks every element in the list. Options are:

(a) Linear search
(b) Binary search
(c) Hash search
(d) Binary tree search

Answer is: (a) Linear search


Q.4: What is the worst-case complexity of bubble sort? Options are:

(a) O(N logN)
(b) O(logN)
(c) O(N)
(d) O(N^2)

Answer is: (d) O(N^2)



Q.5: What is the max number of comparisons that can take place when a bubble sort is implemented? Assume there are n elements in the array? Options are:

(a) (1/2)(n-1)
(b) (1/2)n(n-1)
(c) (1/4)n(n-1)
(d) None of the above

Answer is: (b) (1/2)n(n-1)



Q.6: 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 

Options are:

(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 is: (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



Q.7: 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

Options are:

(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 is: (a) x is A, y is B



Q.8: 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 is: 2,2



Q.9: What is the solution of the equation given below by using bisection method upto four decimal places .(Consider the root lying on positive quadrant only and compute the root till five iteration only)
                                                   f(x)=xe^2x-3x^2-5


Answer is: 1.0312


Q.10: 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[-i]);
    }
    return 0;
}


Options are:

(a) 10 12 6 7 2
(b) 10 12 6 7
(c) 2 7 6 12
(d) 2 7 6 12 10


Answer is: (d) 2 7 6 12 10



If you are facing any queries regarding this assignment solutions, then please drop comment in comment section.

Post a Comment

0 Comments