Sail E0 Webinar

MCQs

Total Questions : 86 | Page 3 of 9 pages
Question 21. Which of the following is a correct format for declaration of function?
  1.    return-type function-name(argument type);
  2.    return-type function-name(argument type) {}
  3.    return-type (argument type)function-name;
  4.    Both (a) and (b)
 Discuss Question
Answer: Option A. -> return-type function-name(argument type);


None.


Question 22. Which of the following function declaration is illegal?
  1.    int 1bhk(int);
  2.    int 1bhk(int a);
  3.    int 2bhk(int*, int []);
  4.    All of the mentioned
 Discuss Question
Answer: Option D. -> All of the mentioned


None.


Question 23. Which function definition will run correctly?
  1.    int sum(int a, int b)   return (a + b);
  2.    int sum(int a, int b)    {return (a + b);}
  3.    int sum(a, b)     return (a + b);
  4.    Both (a) and (b)
 Discuss Question
Answer: Option B. -> int sum(int a, int b)    {return (a + b);}


None.


Question 24. Can we use a function as a parameter of another function? [ Eg: void wow(int func()) ]
  1.    Yes, and we can use the function value conveniently
  2.    Yes, but we call the function again to get the value, not as convenient as in using variable
  3.    No, C does not support it.
  4.    This case is compiler dependent
 Discuss Question
Answer: Option C. -> No, C does not support it.


None.


Question 25. The value obtained in the function is given back to main by using ________ keyword?
  1.    return
  2.    static
  3.    new
  4.    volatile
 Discuss Question
Answer: Option A. -> return


None.


Question 26. The output of the code below is    void main()    {

        int k = m();        printf("%d", k);    }

    void m()    {

        printf("hello");    }

  1.    hello 5
  2.    Error
  3.    Nothing
  4.    Junk value
 Discuss Question
Answer: Option A. -> hello 5


None.


Question 27. The output of the code below is    int *m()    {        int *p = 5;        return p;    }    void main()    {        int *k = m();        printf("%d", k);    }
  1.    5
  2.    Junk value
  3.    0
  4.    5
 Discuss Question
Answer: Option D. -> 5


None.


Question 28. The output of the code below is    int *m();    void main()    {        int k = m();        printf("%d", k);    }    int *m()    {        int a[2] = {5, 8};        return a;    }
  1.    5
  2.    8
  3.    Nothing
  4.    Varies
 Discuss Question
Answer: Option D. -> Varies


None.


Question 29. The output of the code below is    void m(int k)    {        printf("hi");    }    void m(double k)    {        printf("hello");    }    void main()    {        m(3);    }

  1.    hi
  2.    hello
  3.    Compile time error
  4.    Nothing
 Discuss Question
Answer: Option C. -> Compile time error


None.


Question 30. The output of the code below is    int *m();    void main()    {        int *k = m();        printf("hello ");        printf("%d", k[0]);    }    int *m()    {        int a[2] = {5, 8};        return a;    }
  1.    hello 5 8
  2.    hello 5
  3.    hello followed by garbage value
  4.    Compilation error
 Discuss Question
Answer: Option C. -> hello followed by garbage value


None.


Latest Videos

Latest Test Papers