Operators
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int p = 4;
int q = p == 3 ? getchar(): 3;
printf("%d\n", q);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
Ascii value of character getchar function returns
- 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 = 5, q = 4;
p *= p + q;
printf("%d\n", p);
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
45
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int p = 2, q = 1;
p &&= q;
printf("%d\n", p);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Compilation Error
main.c: In function ‘main’:
main.c:5:13: error: expected expression before ‘=’ token
p &&= q;