Variables


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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    Compilation Error

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


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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    41



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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    14


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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    18 13



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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    14