Computer-Networks
February 8, 2024NTA UGC NET Dec 2023 Paper-2
February 8, 2024NTA UGC NET Dec 2023 Paper-2
|
Question 21
|
What is the output of the following program?
#include
# define SQR(x) (x*x)
int main () {
int a, b=3;
a = SQR(b+2);
printf(“%d”,a);
return 0;
}
#include
# define SQR(x) (x*x)
int main () {
int a, b=3;
a = SQR(b+2);
printf(“%d”,a);
return 0;
}
|
25
|
|
|
11
|
|
|
Garbage value
|
|
|
24
|
Question 21 Explanation:
1) 3 + 2 * 3 + 2
2) Perform multiplication: 3 + (2 * 3) + 2
3) Perform multiplication: 3 + 6 + 2
4) Perform addition: 11
2) Perform multiplication: 3 + (2 * 3) + 2
3) Perform multiplication: 3 + 6 + 2
4) Perform addition: 11
Correct Answer: B
Question 21 Explanation:
1) 3 + 2 * 3 + 2
2) Perform multiplication: 3 + (2 * 3) + 2
3) Perform multiplication: 3 + 6 + 2
4) Perform addition: 11
2) Perform multiplication: 3 + (2 * 3) + 2
3) Perform multiplication: 3 + 6 + 2
4) Perform addition: 11
