Sail E0 Webinar

MCQs

Total Questions : 86 | Page 6 of 9 pages
Question 51. What is the output of this C code?
void foo();
int main()
{
void foo(int);
foo();
return 0;
}
void foo()
{
printf("2 ");
}
  1.    2
  2.    Compile time error
  3.    Depends on the compiler
  4.    Depends on the standard
 Discuss Question
Answer: Option B. -> Compile time error


None.


Question 52. 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 53. Which of following is not accepted in C?
  1.    static a = 10; //static as
  2.    static int func (int); //parameter as static
  3.    static static int a; //a static variable prefixed with static
  4.    All of the mentioned
 Discuss Question
Answer: Option C. -> static static int a; //a static variable prefixed with static


None.


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


None.


Question 55. What is the output of this C code?    void main()    {        static int x;        if (x++ < 2)        main();    }
  1.    Infinite calls to main
  2.    Run time error
  3.    Varies
  4.    main is called twice
 Discuss Question
Answer: Option D. -> main is called twice


None.


Question 56. Which of the following cannot be static in C?
  1.    Variables
  2.    Functions
  3.    Structures
  4.    None of the mentioned
 Discuss Question
Answer: Option D. -> None of the mentioned


None.


Question 57. The scope of an automatic variable is:
  1.    Within the block it appears
  2.    Within the blocks of the block it appears
  3.    Until the end of program
  4.    Both (a) and (b)
 Discuss Question
Answer: Option D. -> Both (a) and (b)


None.


Question 58. Automatic variables are allocated space in the form of a:
  1.    stack
  2.    queue
  3.    priority queue
  4.    random
 Discuss Question
Answer: Option A. -> stack


None.


Question 59. Which of the following is a storage specifier?
  1.    enum
  2.    union
  3.    auto
  4.    volatile
 Discuss Question
Answer: Option C. -> auto


None.


Question 60. Default storage class if not any is specified for a local variable, is auto:
  1.    true
  2.    false
  3.    Depends on the standard
  4.    None of the mentioned
 Discuss Question
Answer: Option A. -> true


None.


Latest Videos

Latest Test Papers