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.

You must login to ask a question.

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

NPTEL Problem Solving Through Programming In C Week 5 Assignment Answers

Q1. Continue statement used

a. To continue to the next line of code
b. To debug
c. To stop the current iteration and begin the next iteration from the beginning
d. None of the above statements are correct

Answer: c. To stop the current iteration and begin the next iteration from the beginning


Q2. What will be the output?

#include<stdio.h>
int main()
{
if((0&&1)||(1&&-1))
printf("Condition is true."); else printf("Condition is false.");
return 0;
}

a. Condition is true
b. Condition is false
c. Compilation Error
d. No output possible

Answer: a. Condition is true


Q3. Compute the printed value of i of the C program given below

#include<stdio.h>
int main()
{
int i=0,j=0;
 while(i<4,j<5)
  {
  i++;
  j++;
  }
   printf("%d,%d\n",i,j);
return 0;
}

a. 4,5
b. 4,4
c. 5,5
d. 0,0

Answer: c. 5,5


Q4. What will be the output?

#include<stdio.h>
int main()
{
switch(printf("IIT"))
{
default:
   printf(" Guwahati");
case 1: printf(" Delhi");
        break;
case 2: printf(" Kharagpur");
        break;
case 3: printf(" Madras");
        break;
 }
   return 0;
}

a. IIT Delhi
b. IIT Kharagpur
c. IIT Madras
d. IIT Guwahati

Answer: c. IIT Madras


Q5. Find the output of the following C program

#include<stdio.h>
int main()
{
int i=0;
 if(i==0)
  {
  i=i+1;
  break;
  }
   printf("%d",i);
return 0;
}

a. 0
b. 1
c. No output
d. Compiler error

Answer: d. Compiler error


Q6. What will be printed when the following code is executed?

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

a. 0 1 2 … 9
b. 0 1 2 … 10
c. 1 2 3 … 9
d. 1 2 3 … 10

Answer: d. 1 2 3 … 10


Q7. What is the output of the below C program?

#include<stdio.h>
int main()
{
short int k=1,j=1;
while(k<=4||j<=3)
{
k=k+2;
j+=1;
}
printf("%d,%d",k,j);
return 0;
}

a. 5,4
b. 7,4
c. 5,6
d. 6,4

Answer: b. 7,4


Q8. What will be the output?

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

a. 0 1 2 3 4 5 6 7 8 9 10 11 12 ….. Infinite times
b. 1 2 3 4 5 6 7 8 9 10 11 12 ….. Infinite times
c. Nothing will be printed
d. Compilation Error

Answer: c. Nothing will be printed


Q9. What will be the output?

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

a. After loop x=1
b. 1

After loop x=2
c. 1 2

After loop x=3
d. After loop x=3

Answer: d. After loop x=3


Q10. What will be the output?

#include<stdio.h>
int main()
{
int X;
  x=4>8?5!=1<5==0?1:2:3;
   printf("%d",x);
return 0;
}

a. 1
b. 2
c. 3
d. Error

Answer: c. 3


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:

NPTEL Problem Solving Through Programming In C Week 6 Assignment Answers

An Introduction To Programming Through C++ NPTEL Assignment 5 Answers

NPTEL The Joy Of Computing Using Python Week 5 Assignment Answers

Related Posts