Variables


  1. What will be the output of the following C code?
    #include <stdio.h>
    double n = 10;
    int main()
    {
    int n = 6;
    printf("%d", n);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    6


  1. Global variables are ____________.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    External



  1. Which of the following is an external variable in the following C code?
     #include <stdio.h>
    int function(int p)
    {
    int q;
    return q;
    }
    int main()
    {
    int r;
    function(r);
    }
    int s;











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    s


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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Compilation Error

    main.c: In function ‘main’:
    main.c:4:22: error: ‘d’ undeclared (first use in this function)
    printf("%d", d++);
    ^
    main.c:4:22: note: each undeclared identifier is reported only once for each function it appears in



  1. Which part of the program address space is ptr stored in the following C code?
    #include <stdio.h>
    int *ptr = NULL;
    int main()
    {
    int n = 0;
    ptr = &n;
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Data segment