Operators
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int n = -7;
if (!0 == 1)
printf("Yes\n");
else
printf("No\n");
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Yes
- What will be the output of the following C code?
#include <stdio.h>
void main()
{
int num = 0;
if (num = 0)
{
printf("It's zero\n");
}
else
{
printf("It's not zero\n");
}
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
It's not zero
- What will be the output of the following C code?
#include <stdio.h>
void main()
{
char p = 'p';
int q = (p % 10)++;
printf("%d\n", q);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Compilation Error
main.c: In function ‘main’:
main.c:5:25: error: lvalue required as increment operand
int q = (p % 10)++;
- What will be the output of the following C code?
#include <stdio.h>
void main()
{
int n = 12;
int num = 2 == 3 && n++;
printf("%d %d", num, n);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
0 12
- What will be the output of the following C code?
#include <stdio.h>
void main()
{
int num1 = 7, num2 = -9, num3 = 3, num4;
num4 = ++num1 && ++num2 || ++num3;
printf("%d %d %d %d", num1, num2, num3, num4);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
8 -8 3 1