Problem Solving Through Programming In C Nptel Week 2 Assignment Answers

Are you looking for the Problem Solving Through Programming In C Week 2 Answers 2024? You’ve come to the right place! This resource offers comprehensive solutions to the Week 2 assignment questions, focusing on fundamental concepts in C programming.

Course Link: Click Here

Problem Solving Through Programming In C Week 2 Answers image
Problem Solving Through Programming In C Week 2 Answers

Problem Solving Through Programming In C Week 2 Answers (July-Dec 2024)


Q1.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) All of the above are true


Q2.If an integer requires two bytes of storage, what is the maximum value of an unsigned integer in C?

image 3

Answer: a)


For answers or latest updates join our telegram channel: Click here to join

These are Problem Solving Through Programming In C Week 2 Nptel Answers


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 are correct

Answer: d) All of the above are correct


Q4.What will be the output of the following code?

a) 10 5
b) 5 10
c) 0 15
d) Compilation error

Answer: a) 10 5


For answers or latest updates join our telegram channel: Click here to join

These are Problem Solving Through Programming In C Week 2 Nptel Answers


Q5.The following code will print
int main() {
int sum = 3+6/2+6*2;
printf(“%d”, sum);
return 0;
}

Answer: 18


Q6.What will be the output of the following code?

a) 25
b) 13
c) 11
d) Compilation error

Answer: c) 11


For answers or latest updates join our telegram channel: Click here to join

These are Problem Solving Through Programming In C Week 2 Nptel Answers


Q7.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:c) iostream.h


Q8.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) To display output on the screen


For answers or latest updates join our telegram channel: Click here to join

See also  Problem Solving Through Programming In C Week 7

These are Problem Solving Through Programming In C Week 2 Nptel Answers


Q9. 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) To exit a function and return a value


Q10. 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) Converting a variable from one data type to another


For answers or latest updates join our telegram channel: Click here to join

These are Problem Solving Through Programming In C Week 2 Nptel Answers


All weeks of Problem Solving Through Programming in C : Click Here

More Nptel Courses: https://progiez.com/nptel-assignment-answers


Problem Solving Through Programming In C Nptel Week 2 Assignment Answers (JULY-DEC 2023)

Course Name: Problem Solving Through Programming In C

Course Link: Click Here

These are Problem Solving Through Programming In C Assignment 2 Answers


Q1. Which of the following is not a C variable?
a) Count123
b) Count_123
c) Count@123
d) X_123_Count

Answer: c) Count@123


Q2. A function
a) is a block of statements to perform some specific task
b) is a fundamental modular unit to perform some task
c) has a name and can be used multiple times
d) All the above options are true

Answer: d) All the above options are true


Q3. The execution of any C program is
a) Sequential
b) Parallel
c) Multi-threading
d) None of these

Answer: a) Sequential


These are Problem Solving Through Programming In C Assignment 2 Answers


Q4. Syntax error occurs when
a) The rules of grammar of the programming 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 performed

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


Q5. If integer needs two bytes of storage, then the minimum value of a signed integer in C would be
a) -65535
b) 0
c) -32,767
d) -32,768

Answer: d) -32,768


Q6. What will be the output of the program given below?
a) 9
b) 0
c) 1001
d) Compilation Error

Answer: d) Compilation Error


These are Problem Solving Through Programming In C Assignment 2 Answers


Q7. What is the output?
a) 8.00
b) 4.00
c) 0.00
d) 16.00

Answer: d) 16.00


Q8. The following C program swaps the value of two numbers without using any third variable. What will be the correct option to fill up the blank?
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

See also  Problem Solving Through Programming In C Week 3

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


Q9. What will be the output?
a) 1 3
b) 3 1
c) 1 1
d) 3 3

Answer: b) 3 1


These are Problem Solving Through Programming In C Assignment 2 Answers


Q10. When executed the following code will print _______.

Answer: 18


These are Problem Solving Through Programming In C Assignment 2 Answers

More Weeks of Problem Solving Through Programming In C: Click here

More Nptel Courses: Click here


Problem Solving Through Programming In C Nptel Week 2 Assignment Answers (JAN-APR 2023)

Course Link: Click Here

These are Problem Solving Through Programming In C Assignment 2 Answers


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


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

Answer: b) 0


These are Problem Solving Through Programming In C Nptel Week 2 Assignment Answers


Q4. What is the output?

Answer: 5.00


Q5. What is the output?

Answer: 120.00


Q6. Which of the following is a correct C Keyword?
a) breaker
b) go to
c) shorter
d) default

Answer: d) default


These are Problem Solving Through Programming In C Nptel Week 2 Assignment Answers


Q7. Integers can be of the following type in C?
a) short
b) int
c) long
d) All the above

Answer: d) All the above


Q8. The operator % in C Language is called?
a) Percentage Operator
b) Quotient Operator
c) Modulus
d) Division

Answer: c) Modulus


These are 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

Answer: a) x=10


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: d) All the above.


These are Problem Solving Through Programming In C Nptel Week 2 Assignment Answers

More Weeks of Problem Solving Through Programming In C: Click Here

See also  Problem Solving Through Programming In C Week 6

More Nptel courses: https://progiez.com/nptel


Problem Solving Through Programming In C Nptel Week 2 Assignment Answers (JULY-DEC 2022)

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) -(2-16-1)
b) 0
c) -(215 –1)
d) -215

Answer: d) -215


These are Problem Solving Through Programming In C Nptel Week 2 Assignment Answers


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


These are Problem Solving Through Programming In C Nptel Week 2 Assignment Answers


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


These are 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

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


These are 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

Answer: c) 123Var


Q9. What is the output of the following program?

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

Answer: d) Compilation error


These are Problem Solving Through Programming In C Nptel Week 2 Assignment Answers


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;


These are Problem Solving Through Programming In C Nptel Week 2 Assignment Answers