Decision Making
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int n = 5;
if (n > 1)
printf("Inside if block executed...\n");
else if (n > 1)
printf("Inside else if block executed...\n");
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Inside if block executed...
- What will be the output of the following C code?
#include <stdio.h<
int n;
void main()
{
if (n)
printf("Hey");
else
printf("How are u?");
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
How are u?
- What will be the output of the following C code?
#include <stdio.h>
void main()
{
int n = 2;
if (n == 2)
printf("Hey ");
else
printf("How are u? ");
printf("Hello ");
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Hey Hello
- What will be the output of the following C code?
#include <stdio.h>
void main()
{
int p = 15;
if (true);
printf("Hey... Hellow...");
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
Compilation Error
main.c: In function ‘main’:
main.c:5:13: error: ‘true’ undeclared (first use in this function)
if (true);
^~~~
main.c:5:13: note: each undeclared identifier is reported only once for each function it appears in
- What will be the output of the following C code?
#include <stdio.h>
void main()
{
int p = 6;
if (p < 2);
printf("Hey...");
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Hello