Variables


  1. Which of the following is not a valid variable name declaration?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    #define PI 3.14 is a macro preprocessor, it is a textual substitution.


  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    int p = 200;
    int p = 17;
    printf("Hello Interview Mania! %d\n", p);
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Since p is already defined, redefining it results in an error.



  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    printf("Hello Interview Mania! %d \n", num);
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    It results in an error since num is used without declaring the variable num.


  1. Which is valid C expression?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    Space, comma and $ cannot be used in a variable name.



  1. Which of the following is true for variable names in C?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    According to the syntax for C variable name, it cannot start with a digit.