Decision Making


  1. 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");
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    Inside if block executed...


  1. 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?");
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    How are u?



  1. 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 ");
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Hey Hello


  1. What will be the output of the following C code?
     #include <stdio.h>
    void main()
    {
    int p = 15;
    if (true);
    printf("Hey... Hellow...");
    }











  1. 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



  1. What will be the output of the following C code?
     #include <stdio.h>
    void main()
    {
    int p = 6;
    if (p < 2);
    printf("Hey...");

    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Hello