NPTEL Problem solving through Programming In C Assignment 5 Answers

NPTEL Problem Solving Through Programming In C Assignment 5 Answers 2022:- – In this post, We have provided answers to NPTEL Problem Solving Through Programming In C Assignment 5 week 5. We provided answers here only for reference. we urge you to do your assignment with your own knowledge.

About Problem Solving Through Programming In C

This course is aimed at enabling the students to Formulate simple algorithms for arithmetic and logical problems, Translate the algorithms to programs (in C language), Test and execute the programs and  correct syntax and logical errors, and Implement conditional branching, iteration and recursion, Decompose a problem into functions and synthesize a complete program using the divide and conquer approach.

CRITERIA TO GET A CERTIFICATE

This course will have an unproctored programming exam also apart from the Proctored exam, please check the announcement section for the date and time. The programming exam will have a weightage of 25% towards the Final score.

Final score = Assignment score + Unproctored programming exam score + Proctored Exam score

Assignment score = 25% of the average of best 8 assignments out of the total 12 assignments given in the course. 

( All assignments in a particular week will be counted towards final scoring – quizzes and programming assignments). 

Unproctored programming exam score = 25% of the average scores obtained as part of Unproctored programming exam – out of 100

Proctored Exam score =50% of the proctored certification exam score out of 100

YOU WILL BE ELIGIBLE FOR A CERTIFICATE ONLY IF THE ASSIGNMENT SCORE >=10/25 AND UNPROCTORED PROGRAMMING EXAM SCORE >=10/25 AND PROCTORED EXAM SCORE >= 20/50. If any one of the 3 criteria is not met, you will not be eligible for the certificate even if the Final score >= 40/100.

NPTEL Problem Solving Through Programming In C Assignment 5 Answers 2022

1.

NPTEL Problem solving through Programming In C Assignment 5 Answers

a) 10 9 8 7 6 5 4 3 2 1
b) 1 2 3 4 5 6 7 8 9 10
c) No output
d) None of the above statements are correct

Answer:- c

2. Which of the following is not an infinite loop?

a) for(; πŸ˜‰
b) for(x=0; x<=10)
c) while(1)
d) while(0)

Answer:- d

Answers will be Uploaded Shortly and it will be Notified on Telegram, So JOIN NOW

NPTEL Problem solving through Programming In C Assignment 5 Answers

3. Consider the following and identify the false statement(s)?

i) do-while’ loop must be terminated by a semi colon.
ii) do-while’ loop is always an infinite loop.
iii) Even if the condition is false, the ‘do-while’ loop executes once.
iv) ‘do-while’ loop is an entry-controlled loop

Answer:- d

4. Compute the printed value of ‘m’ and ‘n’ of the C program given below

#include <stdio.h>
int main
{
int m=0, n = 0;
while (m<5, n <7)
{
m++;
n++;
printf(“%d, %dn”, m, n);
return 0;
}

a) 5,7
b) 5,5
c)7,7
d) 0, 0

Answer:- c

5.

NPTEL Problem solving through Programming In C Assignment 5 Answers

a) break
b) continue
c) switch
d) exit

Answer:- b

6.

NPTEL Problem solving through Programming In C Assignment 5 Answers

a) NPTEL
b) IIT/IISc
c) NPTELSWAWAMIIT/IISc
d) Compilation error

Answer:- c

πŸ‘‡For Week 06 Assignment AnswersπŸ‘‡

NPTEL Problem solving through Programming In C Assignment 5 Answers

7.

NPTEL Problem solving through Programming In C Assignment 5 Answers

a)  1,3
b)  1,3
      3,1
c)  1,3
     2,2
     3,1
d)  0,0

Answer:- c

8.

NPTEL Problem solving through Programming In C Assignment 5 Answers

a) 4 will print 1 times
b) 4 will print 3 times
c) 4 will print 4 times
d) No output

Answer:- b

9.

NPTEL Problem solving through Programming In C Assignment 5 Answers

a) The number is odd
b) The number is prime
c) The number is odd The number is prime
d) Syntax Error

Answer:- b

10.

NPTEL Problem solving through Programming In C Assignment 5 Answers

a) 0 1 2 3 4 5 6 7 8 9 11 12…..infinite times
b) 1 2 3 4 5 6 7 8 9 11 12….infinite times
c) Won’t print anything
d) Error

Answer:- c

For More NPTEL Answers:- CLICK HERE

Join Our Telegram:- CLICK HERE

NPTEL Problem Solving Through Programming In C Assignment 5 Answers 2021

Q1.In C language three-way transfer of control is possible using 

  • a) Ternary operator 
  • b) Unary operator 
  • c) Logical operator 
  • d) None

Ans:- a) Ternary operator

Q2. In C programming β€œcontinue” statement is used to 

  • a) continue to the next line of code 
  • b) debug 
  • c) stop the current iteration and begin the next iteration from the beginning 
  • d) None of the above

Ans:- For answers Click Here

Q3. What Will be the output of the following c program?

#include <stdio.h>
int main()
{
int a = 0, i = 0, b;
  for (i = 0; i< 5; i+=0.5)
  {
    a++;
    continue;
  }
printf("%d",a);
return 0;
}

a) 5 

b) 10 

c) No output 

d) Compilation error

Ans:- c) No output 

NPTEL ALL WEEK ASSIGNMENT ANSWERS:-

Q4. How many times the ‘Hello’ will be printed in the below C code?

#include <stdio.h> 
int main()
{
int k = 0;
  for (;; k++)
  {
      printf("Hello");
      if(k%10==0)
        break;
   }
return 0;
}

a) 1 time 

b) 10 times 

c) 11 times 

d) Compilation error

Ans:- a) 1 time

Q5. What will be the value of ‘i’ after the execution of the program below

#include <stdio.h>
int main()
{
int i=1, j;
  for(j=0; j<=10; j+=i)
  {
      i=i+j;
  }
return 0;
}
  • a) 10 
  • b) 11 
  • c) 12 
  • d) 13

Ans:- Error

Q6. How many times the word “Hello” will be printed on the execution of the following C code?

#include <stdio.h>
int main()
{ 
int k,j;
  for (k-0;k<=10; k+=2)
  {
  for(j=1; j!=k; j=j+1)
  {
      printf("Hello \n");
      break;
      }
  }
return 0;
}
  • a) 10 
  • b) 5 
  • c) 6 
  • d) Infinite

Ans:- c) 6 

Q7. What will be the output?

#include <stdio.h>
int main()
{ 
int x=1;
   do
   {
       continue;
printf("%d",x);
       x++;
       break;
   }
     while(x<=10);
    printf("n\After loop x=%d",x);
    printf("\n");
 return 0;
}

 a) After loop x=1 

b) 1
        After loop x=2 

c) No output 

d) 1 2 3 4 5 6 7 8 9 10

Ans:- c) No output 

Q8. What will be the output?

#include <stdio.h>
int main()
{
  float k = 0;
  for (k=0.5; k<3; k++)
    printf("I love C\n");
  return 0;
}

a) Error 

b) I love C — will be printed 6 times 

c) I love C — will be printed 3 times 

d) I love C –will be printed 5 times

Ans:- c) I love C — will be printed 3 times 

Q9. What is the output of the following code?

#include <stdio.h> {
int main()
{
int i=0;
 do
 {
 printf("while vs do-while\n");
 } 
  while(i==0);
printf("Out of loop");
 return 0;
}

a) β€˜while vs do-while’ once 

b) β€˜Out of loop’ infinite times 

c) Both β€˜while vs do-while’ and β€˜Out of loop’ once 

d) β€˜while vs do-while’ infinite times

Ans:- d) β€˜while vs do-while’ infinite times

NPTEL ALL WEEK ASSIGNMENT ANSWERS:-

Q10. The Following program takes ‘n’ as a positive integer input.

What is the purpose of the program?

#include <stdio.h>
int main()
{
int n, i;
  unsigned long long result = 1;
printf("Enter an integer: ");
scanf("%d",&n);

for(i=1;i<=n; ++i)
  {
result*= i;
  }
printf("The output of the program is %llu", result);
  return 0;
}

a) n multiplied n times 

b) factorial of n 

c) display factors of n 

d) display Fibonacci series upto n

Ans:- For Answer Click Here

NPTEL Problem solving through Programming In C Assignment 5 Answers:- We do not claim 100% surety of answers, these answers are based on our sole knowledge, and by posting these answers we are just trying to help students, so we urge do your assignment on your own.

JOIN US ON YOUTUBE

Also Read:-

2 thoughts on “NPTEL Problem solving through Programming In C Assignment 5 Answers”

Leave a Comment