Variables


  1. Comment on the output of the following C code.
    #include <stdio.h>
    int main()
    {
    int k;
    for (k = 0; k < 10; k++)
    int m = k;
    printf("%d", m);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    Syntax error in declaration of m


  1. What is the scope of a function?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    From the point of declaration to the end of the file being compiled



  1. What is the scope of an external variable?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    From the point of declaration to the end of the file being compiled


  1. What will be the output of the following C code?
    #include <stdio.h>
    int *ptr;
    int main()
    {
    if (ptr == NULL)
    printf("Right\n");
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Right



  1. What will be the output of the following C code?
    #include <stdio.h>
    int *p;
    int main()
    {
    if (p == 0)
    printf("Hey\n");
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Hey only if NULL value is 0