Decision Making
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int p = 0;
if (p == 1)
if (p == 0)
printf("Inside if block executed...\n");
else
printf("Inside else if block executed...\n");
else
printf("Inside else block executed...\n");
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Inside else block executed...
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int n = 0;
if (n == 1)
if (n >= 0)
printf("True...\n");
else
printf("False...\n");
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
It will print nothing.
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int n = 5;
if (n == 5)
printf("True, ");
else if (n = 20)
printf("False, ");
printf("%d\n", n);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
True, 5
- The C statement “”if (p == 3 || q == 4) {}”” can be re-written as ___________.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
None of these
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int n = 1;
if (n++)
printf("True\n");
else if (n == 2)
printf("False\n");
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
True