Week-2-July-2023 Solution
Week-2-July-2023 Solution
Solution: (c) Only alphanumeric characters and few special characters like ‘_’ are allowed in
variable name is C. The special character @ is not allowed.
2. 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
a) Sequential
b) Parallel
c) Multi-threading
d) None of these
a) -65535
b) 0
𝑐) -32,767
d) -32,768
Solution: (d) The first bit is used to indicate whether it is signed or unsigned integer. So it
will be −215 i.e. -32,768
Problem Solving through Programming in C
a) 9
b) 0
c) 1001
d) Compilation Error
a) 8.00
b) 4.00
c) 0.00
d) 16.00
Solution: (d) The pre-processing replaces fun(2) with (2*2). Thus fun(2)=4, so,
i=64.0/4=16.00
8. 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?
#include <stdio.h>
Problem Solving through Programming in C
int main()
{
int a=2, b=3;
printf("The values before swapping a = %d, b=%d", a, b);
____________________________________
a) 1 3
b) 3 1
c) 1 1
d) 3 3
Solution: (b) 3 1
Here the program is swapping the values of the variables x and y. A temporary variable t is
used for the swapping purpose.
10. When executed the following code will print _______.
#include <stdio.h>
int main() {
int sum = 3 + 6 / 2 + 6 * 2;
printf("%d", sum);
return 0;
}