Q. What is the output of C Program with switch statement or block?

Code:
int main()
{
    static int a=5;
    
    switch(a)
    {
        case 0: printf("ZERO ");break;
        case 5: printf("FIVE ");break;
        case 10: printf("DEER ");
    }

    printf("LION");
}
  • (A) ZERO FIVE DEER LION
  • (B) FIVE DEER LION
  • (C) FIVE LION
  • (D) Compiler error
πŸ’¬ Discuss
βœ… Correct Answer: (C) FIVE LION

Q. What is the output of C program with switch statement or block?

Code:
int main()
{
    char code='K';
    
    switch(code)
    {
        case 'A': printf("ANT ");break;
        case 'K': printf("KING "); break;
        default: printf("NOKING");
    }
    
    printf("PALACE");
}
  • (A) KING PALACE
  • (B) KING NOTHING PALACE
  • (C) ANT KING PALACE
  • (D) Compiler error for using Non Integers as CASE constants.
πŸ’¬ Discuss
βœ… Correct Answer: (A) KING PALACE

Q. What is the output of C Program with switch statement or block?

Code:
int main()
{
    char code='K';
    
    switch(code)
    {
        case "A": printf("ANT ");break;
        case "K": printf("KING "); break;
        default: printf("NOKING");
    }
    
    printf("PALACE");
}
  • (A) ANT KING PALACE
  • (B) KING PALACE
  • (C) PALACE
  • (D) Compiler error
πŸ’¬ Discuss
βœ… Correct Answer: (D) Compiler error

Q. What is the output of C Program with switch statement or block?

Code:
int main()
{
    char code='A';
    
    switch(code)
    {
        case 64+1: printf("ANT ");break;
        case 8*8+4: printf("KING "); break;
        default: printf("NOKING");
    }
    
    printf("PALACE");
}
  • (A) ANT KING PALACE
  • (B) KING PALACE
  • (C) ANT PALACE
  • (D) Compiler error for using expressions
πŸ’¬ Discuss
βœ… Correct Answer: (C) ANT PALACE

Q. What is the output of C Program with switch statement or block?

Code:
int main()
{
    char code=64;
    
    switch(code)
    {
        case 64: printf("SHIP ");break;
        case 8*8: printf("BOAT "); break;
        default: printf("PETROL");
    }
    
    printf("CHILLY");
}
  • (A) SHIP CHILLY
  • (B) BOAT CHILLY
  • (C) BOAT PETROL CHILLY
  • (D) Compiler error
πŸ’¬ Discuss
βœ… Correct Answer: (D) Compiler error

Q. What is the output of C Program with switch statement or block.?

Code:
int main()
{
    int k=64;
    
    switch(k)
    {
        case k<64: printf("SHIP ");break;
        case k>=64: printf("BOAT "); break;
        default: printf("PETROL");
    }
    
    printf("CHILLY");
}
  • (A) BOAT CHILLY
  • (B) BOAT PETROL CHILLY
  • (C) SHIP BOAT CHILLY
  • (D) Compiler error
πŸ’¬ Discuss
βœ… Correct Answer: (D) Compiler error

Q. Choose a correct statement about a C Switch Construct.

  • (A) default case is optional inside switch.
  • (B) break; causes the control to exit the switch immediately and avoid fall down to other CASE statements.
  • (C) You can not use duplicate CASE Constants inside a Switch construct.
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the above

Q. Choose correct statement about Functions in C Language.

  • (A) A Function is a group of c statements which can be reused any number of times.
  • (B) Every Function has a return type.
  • (C) Every Function may no may not return a value.
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the above

Q. Choose a correct statement about C Language Functions.

  • (A) A function name can not be same as a predefined C Keyword.
  • (B) A function name can start with an Underscore( _ ) or A to Z or a to z.
  • (C) Default return type of any function is an Integer.
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the above

Q. Choose a correct statement about C Function.?

Code:
main()
{
    printf("Hello");
}
  • (A) "main" is the name of default must and should Function.
  • (B) main() is same as int main()
  • (C) By default, return 0 is added as the last statement of a function without specific return type.
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the above