Decision Making


  1. Which of the following cannot be checked in a switch - case statement?









  1. View Hint View Answer Discuss in Forum

    Float

    Correct Option: C

    Float


  1. Which of the following statement are correct about the program given below?
    #include <stdio.h>
    int main ( )
    {
    int x = 10, y = 20;
    if (x == 15) && if (y == 20)
    printf ("Have a nice day\n");
    return 0;
    }









  1. View Hint View Answer Discuss in Forum

    The correct form of if would be :
    if ((x == 15) && (y == 20))
    printf ( "Have a nice day\n");

    Correct Option: C

    The correct form of if would be :
    if ((x == 15) && (y == 20))
    printf ( "Have a nice day\n");



  1. Which of the following statement are correct about an if-else statement in a C program ?











  1. View Hint View Answer Discuss in Forum

    Nested if-else statements

    Correct Option: B

    Nested if-else statements are allowed.


  1. What will be the output of the following C code?
    #include <stdio.h>
    switch (name)
    {
    case 'n':
    case 'N':
    printf("Right...");
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    error: expected unqualified-id before 'switch'
    switch (ch)



  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    int n = 1;
    switch (n)
    {
    case n:
    printf("Case N ");
    default:
    printf("Default");
    }
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    Compilation Error

    In function 'int main()':
    error: 'a' cannot appear in a constant-expression
    case a: