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

Join Our WhatsApp Group Join Now
Join Us On Telegram Join Now

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

1. The precedence of arithmetic operators in C language is (from highest to lowest)

a) %, *, /, +, –
b) %, +, /, *, –
c) +, -, %, *, /
d) %, +, -, *, /

Answer :- For Answer Click Here 

2. What is the output of the following program?
include<stdio.h>
int main()
{
float i = -3.0;
int k = 1% 2:
printf(“%d”, k);
return 0;
}

a) -1
b) 1
c) o
d) Compilation error

Answer :- For Answer Click Here 

3.

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

a) -42
b) 24
c) 15
d) -34

Answer :- For Answer Click Here 

4. What is the output of the following C code?
include<stdio.h>
int main()
{
int h = 8:
int b= 4 * 6+3 * 4<h*5 ?4: 3;
printf(“%d n”, b);
return 0;
}

a) O
b) 3
c) 4
d) Compilation error

Answer :- 

5. What will be the output?
include < stdio.h>
int main ()

{
int a = 1, b = 2, c = 3;
if (c > b> a)
printi(“TRUE”);
else
printf(“FALSE”);
return 0;
}

a) TRUE
b) FALSE
c) Syntax Error
d) Compilation Error

Answer :- 

6. Find the output of the following C code
include<stdio.h>
int main()
{
int x=1;
if ((3>5) || (2!=3))
printf(“ITKGPi\n”);
else if (x&=0)
printf(“IITD\n”);
else
printf(“IITM\n”);
return 0;
}

a) IITKGP
b) IITD and IITM
c) IITKGP and IITM
d) IITM

Answer :- For Answer Click Here 

7.

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

a) TRUE
b) FALSE
c) Compilation Error
d) Compiler Dependent

Answer :- 

8. Which of the following statement is correct?

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
b) Operator associativity determines which operator is performed first in an expression with more than one operator with different associativity. Precedence is used when two operators of same precedence appear in an expression
c) Operator precedence and associativity are same.
d) None of the above

Answer :- 

9. Which of the following method are accepted for assignment?

a) 8=x=y=z
b) x=8=y=z
c) x=y=z=8
d) None

Answer :- 

10. What will be the output?
include<stdio.h>
int main()
{
int x;
x= 9<5+3 && 7;
printf(“%d”, x);
return 0;
}

a) O
b) 1
c) 7
d) Compilation error

Answer :- For Answer Click Here