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

NPTEL Problem Solving Through Programming In C Week 3 Assignment Answers 2023

problem solving through programming in c

My fellow learners, do you search for assistance in unraveling the mysteries of problem-solving through programming in C in your NPTEL week 3 assignment?

Fear not, for in this composition, we offer this article, a spark of insight in the form of hints to the solutions to your quest in programming in C for problem resolution.

NPTEL Problem Solving Through Programming In C Week 3 Assignment Answers

Q1. What should be the value of ‘b’ such that the output of the program will be 20?

int main()
{ int a = 5, b = 2; 

printf("%d\n",a<<b); 
return 0;
}

Answer: b. 2

1100+ subscribers getting help from instant notifications, Join us on telegram.


Q2. Find the output of the following C code

#include <stdio.h> 
int main()
{
int x=1;
if ((3>5) || (2!=3))
  printf("IITKGP\n"); 
else if (x&=0) 
  printf("IITD\n"); 
else 
  printf("IITM\n");
return 0;
}

Answer: a. IITKGP


Q3. What will be the output of the following program?

#include<stdio.h> 
int main()
{
int i;
if(i=0,2,3) 
  printf("NPTEL "); 
  else 
    printf("Programming on C "); 
printf("%d\n", i);
}

Answer: b. NPTEL 0


Q4. Find the output of the following C code

#include<stdio.h> 
int main()
{ 
int a=10, b=3, c=2, d=4, result; 
 result=a+a*-b/c%d+c*d;
  printf("%d",result);
return 0; 
}

Answer: c. 15


Q5. Which of the following statement is correct?

Answer: a. Operator precedence determines which operator is performed first in an expression with more than one operator with different precedence. Associativity is used when two operators of same precedence appear in an expression


Q6. What is the output of the C program given below?

#include <stdio.h> 
int main()
{
int x = 0; 
if (x++) 
printf("true\n"); 
else if (x = 1) 
printf("false\n"); 
return 0;
}

Answer: b. false


Q7. What is the output of the following program?

#include<stdio.h> 
int main()
{
int a=10, b=3, c;
float d;
c=a%b;
d=a/b; 
printf("Value of c and d are %d and %f respectively", c, d); 
    return 0;
}

Answer: d. Value of c and d are 1 and 3.000000 respectively


Q8. What will be the output?

#include <stdio.h> 
int main()
{ 
int a = 100, b = 200, c = 300; 
if (c>b>a) 
 printf("TRUE");
else
 printf("FALSE");
 return 0;
}

Answer: b. FALSE


Q9. What will be the output?

#include <stdio.h> 
int main()
{ 
int x;
x=9<5+3 && 7; 
printf("%d",x); 
return 0;
}

Answer: a. 0


Q10. The precedence of arithmetic operators is (from highest to lowest)

Answer: a) %, *, /, +, –

Problem-Solving Through Programming In C Week 3 Programming Assignment Answers

Q1.

area = 3.14 * radius * radius;
  printf("Area of a circle = %0.2f\n",area);
}

Q2.

if(number<0.0)
     printf("Negative number.");
   else if(number==0.0)
     printf("The number is 0.");
   else
     printf("Positive number.");
     return 0;
}

Q3.

 if (number%2==0)
    printf("%d is even.", number);
  else
    printf("%d is odd.", number);
    return 0;
  }

Q4.

if (n1>n2 && n1>n3)
    printf("%d is the largest number.", n1);
  else if(n2>n1 && n2>n3)
     printf("%d is the largest number.", n2);
  else
     printf("%d is the largest number.", n3);
    return 0;
  }

Disclaimer: Let these responses serve as mere guides for the student’s enlightenment. No assurance of absolute accuracy can be guaranteed, for this platform does not purport to possess infallibility. Thus, it is imperative that diligent scholar undertake their own efforts in completing their academic obligations.


Also Available:

Problem Solving Through Programming In C NPTEL Assignment 2 Answers

Related Posts