Variables


  1. What will be the output of the following C code?
    #include <stdio.h>
    void main()
    {
    int m = 12;
    float m = 12;
    printf("%d", m)
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    Since the variable m is defined both as integer and as float, it results in an error.


  1. Which of the following is not a pointer declaration?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Array declarations are pointer declarations.



  1. Which keyword is used to prevent any changes in the variable within a C program?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    const is a keyword constant in C program.


  1. Which of the following declaration is illegal?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    char[] s is a declaration in Java, but not in C.



  1. Which of the following format identifier can never be used for the variable var?
    #include <stdio.h>
    int main()
    {
    char *variable = "Advanced Training in C by interviewmania.com";
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    %c can be used to print the indexed position.
    %d can still be used to display its ASCII value.
    %s is recommended.
    %f cannot be used for the variable var.