# Problem Solving Through Programming In C NPTEL Week 2 Solutions

This set of MCQ(multiple choice questions) focuses on the Problem Solving Through Programming In C NPTEL Week 2 Solutions.

NOTE: You can check your answer immediately by clicking show answer button. Problem Solving Through Programming In C NPTEL Week 2 assignment answers” contains 10 questions.

Now, start attempting the quiz.

### Problem Solving Through Programming In C NPTEL Week 2 assignment answers

Q1. Which of the following statements is correct?
I. Keywords are those words whose meanig 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

Q2. 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

Q3. If an integer needs two bytes of storage, then the minimum value of an unsigned integer in C would be

a) -(216 – 1)
b) 0
c) -(215 – 1)
d) -215

Q4. What is the output?

Q5. What is the output?

Problem Solving Through Programming In C NPTEL Week 2 assignment answers

Q6. Which of the following is a correct C Keyword?

a) breaker
b) go to
c) shorter
d) default

Q7. Integers can be of the following type in C?

a) short
b) int
c) long
d) All of the above

Answer: d) All of the above

Problem Solving Through Programming In C NPTEL Week 2 assignment answers

Q8. The operator % in C Language is called?

a) Percentage Operator
b) Quotient Operator
c) Modulus
d) Division

Problem Solving Through Programming In C NPTEL Week 2 assignment answers

Q9. What will be the correct value of â€˜xâ€™?
int x = 5.6634 + 4.867;

a) x=10
b) x=11
c) x=10.530400
d) Compilation error

Q10. What is a C Storage Class?

a) C Storage decides where to or which memory store the variable
b) C Storage Class decides what is the default value of a variable
c) C Storage Class decides what is the Scope and Life of a variable
d) All the above

Answer: b) C Storage Class decides what is the default value of a variable

Problem Solving Through Programming In C NPTEL Week 2 assignment answers

### Problem Solving Through Programming In C NPTEL Week 2 assignment answers

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

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

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?

a) 1 3
b) 3 1
c) 1 1
d) 3 3

Q5. When executed the following code will print __________.

Problem Solving Through Programming In C NPTEL Week 2 assignment answers

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

Q7. What is the output of the following code?

Problem Solving Through Programming In C NPTEL Week 2 assignment answers

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

a) Var123
b) Var_123
c) 123Var
d) X_123_Var

Problem Solving Through Programming In C NPTEL Week 2 assignment answers

Q9. What is the output of the following program?

a) 6
b) 3
c) 4
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?

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

Problem Solving Through Programming In C NPTEL Week 2 assignment answers

### Previous Course – Week 2 assignment answers

Q1. Which of the following statements is correct?

a) System software is dependent on application software
b) Application software is dependent on system software
c) Both are independent of each other
d) None of the above

Answer: b) Application software is dependent on system software

Q2. All keywords in C are in

a) Lower Case letters
b) Upper Case letters
c) CamelCase letters
d) None of the above

Q3. Which of the following is not a C variable name?

a) x123
b) x_123
c) 123x
d) _X123

Q4. Variable names beginning with underscore is not encouraged in C. Why?

a) It is not standardized
b) To avoid conflicts since assemblers and loaders use such names
c) To avoid conflicts since library routines use such names
d) To avoid conflicts with environment variables of an operating system

Answer: c) To avoid conflicts since library routines use such names

Q5. 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 the above statements are true

Answer: d) All the above statements are true

Problem Solving Through Programming In C NPTEL Week 2 solutions

Q6. In case of ordinary int variables:

a) The leftmost bit is reserved for sign
b) The rightmost bit is reserved for sign
c) No bit is reserved for sign
d) None of the above

Answer: a) The leftmost bit is reserved for sign

Q7. What is the value of x in this C code?

``````#include<stdio.h>
int main()
{
int x = 4 * 5 / 2 + 9;
return 0;
}``````

a) 1
b) 17
c) 19
d) 16

Problem Solving Through Programming In C NPTEL Week 2 solutions

Q8. What will be the output of the following C code?
[N.B:- .2f is used to print up to 2 decimal places of a floating-point number]

``````#include<stdio.h>
int main()
{
float a = 7.0;
printf("The output is %.2f", (13/5)*a + 10);
return 0;
}``````

a) 28.2
b) 21.00
c) 24.00
d) 21.2

Problem Solving Through Programming In C NPTEL Week 2 solutions

Q9. A syntax error occurs when

a) The rules of grammar of the language is violated
b) The statements in the program have no meaning
c) The program gives wrong or undesired output
d) Some illegal operation (e.g. divide by zero) is done

Answer: a) The rules of grammar of the language is violated

Q10. What is the value of b after execution of the following C code?

``````#include<stdio.h>
int main()
{
int a = 7, b = 10;
a = b;
b = a;
return 0;
}``````

Problem Solving Through Programming In C NPTEL Week 2 solutions

<< Prev – An Introduction to Programming Through C Week 1 Assignment Solutions

>> Next- An Introduction to Programming Through C Week 3 Assignment Solutions

Programming in Java NPTEL week 1 quiz answers

Nptel – Deep Learning assignment solutions

The above question set contains all the correct answers. But in any case, you find any typographical, grammatical or any other error in our site then kindly inform us. Donâ€™t forget to provide the appropriate URL along with error description. So that we can easily correct it.