Sail E0 Webinar

MCQs

Total Questions : 86 | Page 1 of 9 pages
Question 1. What is the output of this C code?    int *i;    int main()    {        if (i == NULL)            printf("true\n");        return 0;    }
  1.    true
  2.    true only if NULL value is 0
  3.    Compile time error
  4.    Nothing
 Discuss Question
Answer: Option A. -> true


None.


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


None.


Question 3. What is the output of this C code?    int *i;    int main()    {        if (i == 0)            printf("true\n");        return 0;    }
  1.    true
  2.    true only if NULL value is 0
  3.    Compile time error
  4.    Nothing
 Discuss Question
Answer: Option B. -> true only if NULL value is 0


None.


Question 4. 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 5. What is the output of this C code?    void main()    {        static int x;        printf("x is %d", x);    }
  1.    0
  2.    1
  3.    Junk value
  4.    Run time error
 Discuss Question
Answer: Option A. -> 0


None.


Question 6. What linkage does automatic variables have?
  1.    Internal linkage
  2.    External linkage
  3.    No linkage
  4.    None of the mentioned
 Discuss Question
Answer: Option C. -> No linkage


None.


Question 7. Automatic variables are variables that are?
  1.    Declared within the scope of a block, usually a function
  2.    Declared outside all functions
  3.    Declared with auto keyword
  4.    Declared within the keyword extern
 Discuss Question
Answer: Option A. -> Declared within the scope of a block, usually a function


None.


Question 8. Automatic variables:
  1.    Exist only within that scope in which it is declared
  2.    Cease to exist after the block is exited
  3.    Both (a) & (b)
  4.    Only 1
 Discuss Question
Answer: Option C. -> Both (a) & (b)


None.


Question 9. Automatic variables are allocated memory in?
  1.    heap
  2.    Data segment
  3.    Code segment
  4.    stack
 Discuss Question
Answer: Option D. -> stack


None.


Question 10. What is the output of this C code?    int main()    {        auto i = 10;        const auto int *p = &i;        printf("%d\n", i);    }
  1.    10
  2.    Compile time error
  3.    Depends on the standard
  4.    Depends on the compiler
 Discuss Question
Answer: Option A. -> 10


None.


Latest Videos

Latest Test Papers