Variables


  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 not supported by C?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    It is legal 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.


  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. Will the following C code compile without any error?
    #include <stdio.h>
    int main()
    {
    int n;
    {
    int n;
    for (n = 0; n < 12; n++);
    }
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    There can be blocks inside the block. But within a block, variables have only block scope.