Sail E0 Webinar

MCQs

Total Questions : 86 | Page 2 of 9 pages
Question 11. What is the output of this C code?    int x = 5;    void main()    {        int x = 3;        printf("%d", x);        {            x = 4;        }        printf("%d", x);    }
  1.    Run time error
  2.    3   3
  3.    3   5
  4.    3   4
 Discuss Question
Answer: Option D. -> 3   4


None


Question 12. What is the scope of a function?
  1.    Whole source file in which it is defined
  2.    From the point of declaration to the end of the file in which it is defined
  3.    Any source file in a program
  4.    From the point of declaration to the end of the file being compiled
 Discuss Question
Answer: Option D. -> From the point of declaration to the end of the file being compiled


None.


Question 13. Which variable has the longest scope?    int b;    int main()    {        int c;        return 0;    }    int a;
  1.    a
  2.    b
  3.    c
  4.    Both (a) and (b)
 Discuss Question
Answer: Option B. -> b


None.


Question 14. What is the scope of an external variable?
  1.    Whole source file in which it is defined
  2.    From the point of declaration to the end of the file in which it is defined
  3.    Any source file in a program
  4.    From the point of declaration to the end of the file being compiled
 Discuss Question
Answer: Option D. -> From the point of declaration to the end of the file being compiled


None.


Question 15. Array sizes are optional during array declaration by using ______ keyword.
  1.    auto
  2.    static
  3.    extern
  4.    register
 Discuss Question
Answer: Option C. -> extern


None.


Question 16. What is the output of this C code?    void main()    {        int x = 3;        {            x = 4;            printf("%d", x);        }    }
  1.    4
  2.    3
  3.    0
  4.    Undefined
 Discuss Question
Answer: Option A. -> 4


None.


Question 17. What is the output of this C code?

    int x = 5;    void main()    {        int x = 3;        m();        printf("%d", x);    }    void m()    {        x = 8;        n();    }    void n()    {        printf("%d", x);    }

  1.    8   3
  2.    8   5
  3.    3   8
  4.    5   3
 Discuss Question
Answer: Option A. -> 8   3


None.


Question 18. What is the output of this C code?    static int x;    void main()    {        int x;        printf("x is %d", x);    }
  1.    0
  2.    Junk value
  3.    Run time error
  4.    Nothing
 Discuss Question
Answer: Option B. -> Junk value


None.


Question 19. What is the output of this C code?

    void main()    {        m();        m();    }    void m()    {        static int x = 5;        x++;        printf("%d", x);    }

  1.    6   7
  2.    6   6
  3.    5   5
  4.    5   6
 Discuss Question
Answer: Option A. -> 6   7


None.


Question 20. What is the output of this C code?    void main()    {        static double x;        int x;        printf("x is %d", x);    }
  1.    Nothing
  2.    0
  3.    Compile time error
  4.    Junk value
 Discuss Question
Answer: Option C. -> Compile time error


None.


Latest Videos

Latest Test Papers