Sail E0 Webinar

MCQs

Total Questions : 73 | Page 5 of 8 pages
Question 41. What is the output of this C code?    int main()    {        int x = -2;        if (!0 == 1)            printf("yes\n");        else            printf("no\n");    }
  1.    Yes
  2.    No
  3.    Run time error
  4.    Undefined
 Discuss Question
Answer: Option A. -> Yes


None.


Question 42. What is the difference between the following 2 codes?//Program 1    int main()    {        int d, a = 1, b = 2;        d =  a++ + ++b;        printf("%d %d %d", d, a, b);    } //Program 2    int main()    {        int d, a = 1, b = 2;        d =  a++ + ++b;        printf("%d %d %d", d, a, b);    }
  1.    No difference as space doesn't make any difference, values of a, b, d are same in both the case
  2.    No difference as space doesn't make any difference, values of a, b, d are different
  3.    Program 1 has syntax error, program 2 is not
  4.    Program 2 has syntax error, program 1 is not
 Discuss Question
Answer: Option A. -> No difference as space doesn't make any difference, values of a, b, d are same in both the case


None.


Question 43. What is the output of this C code?    int main()    {        int a = 1, b = 1, c;        c = a++ + b;        printf("%d, %d", a, b);    }
  1.    a = 1, b = 1
  2.    a = 2, b = 1
  3.    a = 1, b = 2
  4.    a = 2, b = 2
 Discuss Question
Answer: Option B. -> a = 2, b = 1


None.


Question 44. What is the output of this C code?    int main()    {        int y = 0;        if (1 |(y = 1))            printf("y is %d\n", y);        else            printf("%d\n", y);     }
  1.    1
  2.    0
  3.    Run time error
  4.    Undefined
 Discuss Question
Answer: Option A. -> 1


None.


Question 45. What is the output of this C code?    int main()    {        int y = 1;        if (y & (y = 2))            printf("true %d\n");        else            printf("false %d\n");     }
  1.    true 2
  2.    false 2
  3.    Either option a or option b
  4.    true 1
 Discuss Question
Answer: Option C. -> Either option a or option b


None.


Question 46. What is the output of this C code?    int main()    {        int a = 1, b = 1, d = 1;        printf("%d, %d, %d", ++a + ++a+a++, a++ + ++b, ++d + d++ + a++);    }
  1.    15, 4, 5
  2.    9, 6, 9
  3.    9, 3, 5
  4.    6, 4, 6
 Discuss Question
Answer: Option A. -> 15, 4, 5


None.


Question 47. For which of the following, "PI++; code will fail?
  1.    #define PI 3.14
  2.    char *PI = A";
  3.    float PI = 3.14;
  4.    Both (A) and (B)
 Discuss Question
Answer: Option A. -> #define PI 3.14


None.


Question 48. What is the output of this C code?    int main()    {        int i = 2;        int j = ++i + i;        printf("%d\n", j);    }
  1.    6
  2.    5
  3.    4
  4.    Compile time error
 Discuss Question
Answer: Option A. -> 6


None.


Question 49. What is the output of this C code?    int main()    {        int i = 0;        int j = i++ + i;        printf("%d\n", j);    }
  1.    0
  2.    1
  3.    2
  4.    Compile time error
 Discuss Question
Answer: Option A. -> 0


None.


Question 50.

What is the output of this C code?    int main()    {        int a = 10, b = 10;        if (a = 5)        b--;        printf("%d, %d", a, b--);    }

  1.    a = 10, b = 9
  2.    a = 10, b = 8
  3.    a = 5, b = 9
  4.    a = 5, b = 8
 Discuss Question
Answer: Option C. -> a = 5, b = 9


None.


Latest Videos

Latest Test Papers