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.

Problem Solving Through Programming In C Assignment Answers Week 2 2022

A banner of Problem Solving Through Programming In C With NPTEL written on top

Students, have you any doubt in Problem Solving Through Programming In C NPTEL Week 2 assignment? So, this article have covered the answers hints to the assignment. You can scroll down to explore these hints.

Problem Solving Through Programming In C NPTEL Assignment Answers Week 2

Q1. A function is

a. Block of statements to perform some specific task
b. It is a fundamental modular unit to perform some task
c. It has a name and can be used multiple times
d. All of the above

Answer: d. All of the above

For instant notification of any updates, Join us on telegram.


Q2. If an integer needs two bytes of storage, then the minimum value of a signed integer in C would be

a. -(216-1)

b. 0

c. -(215-1)

d. -215

Answer:- d. -215


Q3. Which of the following statements is correct?

i. Keywords are those words whose meaning is already defined by Compiler.

ii. Keywords cannot be used as variable names.

iii. There are 32 keywords in C

iv. C keywords are also called reserved words

a. (i) and (ii)

b. (ii) and (iii)

c. (i), (ii), and (iv)

d. All of the above

Answer: d. All of the above


Q4. What will be the output?

#include <stdio.h>
int main() {
int x = 1, y = 3;
int t=x;
x=y;
y=t;
printf("%d %d",x,y);
return 0;
}

a. 1 3

b. 3 1

c. 1 1

d. 3 3

Answer: b. 3 1


Q5. When executed the following code will print _______.

#include <stdio.h> 
int main() {
int sum=3+6/2+6*2;
printf("%d",sum);     
return 0;     
}

Answer: 18


Q6. Which of the following are not standard header files in C?

a. stdio.h

b. conio.h

c. string.h

d. All are standard header file

Answer: d. All are standard header file


Q7. What is the output of the following code?

#include <stdio.h>
#define fun(x) (x*x-x)
void main(){  
float i;  
i=37.0/fun(2);  
printf("%.2f",i);
}

Answer: 18.50


Q8. Which of the following is not a C variable?

a. Var123

b. Var_123

c. 123Var

d. X_123_Var

Answer: c. 123Var


Q9. What is the output of the following program?

#include <stdio.h> 
#define a 6 
int main() 
{
int a=3; 
a=a+1; 
printf("%d",a); 
return 0;
}

a. 6

b. 3

c. 4

d. Compilation error

Answer: d. Compilation error


Q10. The following C program swaps the value of two numbers without using any third variable. What are the correct operations that need to be inserted inside the blanks?

#include <stdio.h> 
int main()
{
int a=2, b=3;
printf("The values before swapping a = %d, b=%d", a, b); 
______; _______; _______;
printf("The values after swapping a=%d, b=%d", a, b); 
return 0;
}

a. a=a-b; b=a-b; a=a+b;

b. a=a%b; b=a+b; a=a/b;

c. a=a+b; b=a-b; a=a-b;

d. None of the above

Answer: c. a=a+b; b=a-b; a=a-b;


TELEGRAM FOR NOTIFICATIONClick Here
Follow on Google News (in one click)Click Here

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 1

Related Posts