# Problem Solving Through Programming In C Assignment Answers Week 3 2022

Students, are you looking for help in problem solving through programming in C NPTEL week 3 assignment answers? So, here in this article, we have provided problem solving through programming in C week 3 assignment answer’s hint.

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

Q1. Find the output of the following C program

``````#include<stdio.h>
int main()
{
int a, z, x=10, y=12;
z=x*y++;
a= x*y;
printf("%d,%d", z, a);
return 0;
}``````

a. 120, 120
b. 120, 130
c. 130, 120
d. 130, 130

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

``````#include<stdio.h>
int main()
{
int p=2;
int m=10;
int k;
k=!((p<2)&&(m>2));
printf("\n%d", k);
return 0;
}``````

a. 1

b. 0

c. -1

d. 2

Q3. Find the output of the following C code.

``````#include<stdio.h>
#include<math.h>
int main()
{
int a=5, b=2, c=6;
float x1, x2;
if(b*b>4*a*c)
{
x1=-b+sqrt(b*b-4*a*c)/2*a:
x2=-b-sqrt(b*b-4*a*c)/2*a:
printf("\n x1=%f, x2=%f",x1,x2);
}
else
printf("\n Roots are imaginary");
return 0;
}``````

What is the output of the above program?

a. x1=4, x2=3

b. x1=-5, x2=-4

c. x1=2.5, x2=4.2

d. Roots are imaginary

Q4. Find the output of the following code.

``````#include<stdio.h>
int main()
{
int p=6, q=4, r=10;
if(p>q)
{
if(p>r)
printf("%d", p);
else
printf("%d", r);
}
else{
if(r>q)
printf("%d", r+q);else
printf("%d", q);}return 0;}``````

a. 6

b. 4

c. 10

d. 14

Q5. Which of the following statements are correct?

I. The else’ block is executed when condition inside if statement is false.

II. One if statement can have multiple else’ statement.

a. Only I

b. Only II

c. Both I and II

d. None of the above is correct

Q6. C modulo division operator ‘%’ can be applied on

a. only float variables

b. only int variables

c. int and float combination

d. any data types in C

Q7. The output of the following program will be

``````#include<stdio.h>
int main(){
if(0)
printf(" C programming\n");
if(0.5)
printf("Java \n");
if(-0.5)
printf("Python \n");
return 0;
}``````

a. C programming

b. Java

Python

c. C programming

d.  Compilation error

Python

Q8. What will be the output?

``````#include<stdio.h>
int main(){
int p=2;
int k;
k=p>10?2:10;
printf("%d",k);
return 0;
}``````

a. 2

b. 8

c. 10

d. 12

Q9. What will be the output?

``````#include<stdio.h>
int main(){
int s=20;
if(s=19)
printf("Right\n");
else printf("Wrong\n");
return 0;
}``````

a. Right

b. Wrong

c. 0

d. No output

Q10. What will be the output of the program?

``````#include<stdio.h>
int main(){
int a=2, b=3, c=5, d=8, ans;
ans=a-b+c*a/d%b;
printf("The answer will be %d", ans);
return 0;
}``````

a. The answer will be 15

b. The answer will be 0

c. The answer will be 1

d. Compilation error

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:

Problem Solving Through Programming In C NPTEL Assignment Answers Week 2

Problem Solving Through Programming In C NPTEL Assignment Answers Week 4