Operators
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int p = 3, q = 2;
int R = (q++) ? q == 1 && p : 1;
printf("%d\n", R);
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
0
- Which of the following is an invalid assignment operator?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
p /= 12; or p |= 12; and p %= 12; all are valid assignment operator.
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int p = 6, num, k, R = 0;
scanf("%d", num);
for (k = 0; k < num; k++)
R += p;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
It will not print any output.
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int p = 3, q = 4;
p += q -= p;
printf("%d %d", p, q);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
4 1
- What will be the final value of c in the following s statement? (Initial value: s = 2)
s <<= 1;
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
s = 4;