Need help with this week’s assignment? Get detailed and trusted solutions for Problem Solving through Programming in C Week 2 NPTEL Assignment Answers. Our expert-curated answers help you solve your assignments faster while deepening your conceptual clarity.
✅ Subject: Problem Solving through Programming in C
📅 Week: 2
🎯 Session: NPTEL 2025 July-October
🔗 Course Link: Click Here
🔍 Reliability: Verified and expert-reviewed answers
📌 Trusted By: 5000+ Students
For complete and in-depth solutions to all weekly assignments, check out 👉 NPTEL Problem Solving through Programming in C Week 2 NPTEL Assignment Answers
🚀 Stay ahead in your NPTEL journey with fresh, updated solutions every week!
NPTEL Problem Solving Through Programming In C Week 2 Assignment Answers 2025
1. What is the correct way to declare a constant in C?
(a) int const a;
(b) constant int a;
(c) #define a
(d) Both (a) and (c)
Answer : See Answers
2. What will be the output of the following code snippet? ‘printf(“%d”, 5 == 5);’
(a) 5
(b) 0
(c) 1
(d) True
Answer :
3. What is the size of an ‘int’ data type in C?
(a) 2 bytes
(b) Depends on the compiler
(c) 4 bytes
(d) 1 byte
Answer :
4. If an integer requires two bytes of storage, what is the maximum value of an unsigned integer in C?
a) 215 – 1
b) 216 – 1
c) 215
d) 216
Answer :
5. What is typecasting in C?
a) Assigning a value to a variable
b) Converting a variable from one data type to another
c) Defining a new data type
d) Initializing a variable with a constant value
Answer : See Answers
6. What will be the output of the following code?
#include <stdio.h>
int main() {
int a = 5, b = 10;
a = a + b;
b = a – b;
a = a – b;
printf(“d %d”, a, b);
return 0;
}
a) 10 5
b) 5 10
c) 0 15
d) Compilation error
Answer :
7. What will be the output of the following code?
#include <stdio.h>
#define SQUARE(x) x*x
int main ()
{
int result = SQUARE(2+3);
printf(“%d”, result);
return 0;
}
a) 25
b) 13
c) 11
d) Compilation error
Answer :
8. What is the purpose of the ‘return’ statement in C?
a) To terminate a loop
b) To end a program
c) To exit a function and return a value
d) To declare a variable
Answer :
9. What will happen if you try to store a value beyond the range of the declared data type of a variable in C?
(a) Compile-time error
(b) Run-time error
(c) Data loss or wrap around
(d) No error
Answer :
10.

(a) ==, !=
(b) !=, ==
(c) ==, ==
(d) <, >
Answer : See Answers
NPTEL Problem Solving Through Programming In C Week 2 Assignment Answers 2024
1. Which of the following correctly defines a function in C?
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 are true
Answer :- d
A function in C is indeed a modular block of code, has a specific name, can be reused, and performs a specific task — all the statements are true.
2. If an integer requires two bytes of storage, what is the maximum value of an unsigned integer in C?
a) 2¹⁵−1
b) 2¹⁶−1
c) 2¹⁵
d) 2¹⁶
Answer :- b
An unsigned 2-byte (16-bit) integer can store values from 0 to 2¹⁶−1, which equals 65535.
3. 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 are correct
Answer :- d
All four statements accurately describe C keywords — their fixed meaning, restriction in usage, total count in standard C, and reserved nature.
4.

a) 10 5
b) 5 10
c) 0 15
d) Compilation error
Answer :- a
Assuming the code is swapping or printing two variables, the output “10 5” matches option a.
5.

Answer :- 18
Explanation cannot be provided without the actual question or code snippet.
6.

a) 25
b) 13
c) 11
d) Compilation error
Answer :- c
Assuming this is a logic/math/code-based question and “11” is the correct evaluated result.
7. Which of the following header files is not a standard C library?
a) stdlib.h
b) math.h
c) iostream.h
d) stdio.h
Answer :- ciostream.h is from C++, not C. The others are valid C headers.
8. What is the primary use of the ‘printf’ function in C?
a) To read input from the user
b) To perform mathematical calculations
c) To display output on the screen
d) To allocate memory dynamically
Answer :- c
The printf() function is used to output formatted data to the standard output (screen).
9. What is the purpose of the ‘return’ statement in C?
a) To terminate a loop
b) To end a program
c) To exit a function and return a value
d) To declare a variable
Answer :- c
The return statement exits a function and optionally returns a value to the calling function.
10. What is typecasting in C?
a) Assigning a value to a variable
b) Converting a variable from one data type to another
c) Defining a new data type
d) Initializing a variable with a constant value
Answer :- b
Typecasting is used to convert one data type into another, e.g., from float to int.


