Problem Solving Through Programming In C Week 2

Session: 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

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


Session: JAN-APR 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 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 Assignment 2 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 Assignment 2 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 Assignment 2 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 Assignment 2 Answers

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

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


Session: 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 Assignment 2 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 Assignment 2 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 Assignment 2 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 Assignment 2 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 Assignment 2 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 Assignment 2 Answers


Problem Solving Through Programming In C Assignment 2
The content uploaded on this website is for reference purposes only. Please do it yourself first.
Home
Account
Cart
Search