Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Filter by Categories
nmims post
Objective Type Set
Online MCQ Assignment
Question Solution
Solved Question
Uncategorized

1. What is the output of this C code?

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         struct student
  5.         {
  6.             int no;
  7.             char name[20];
  8.         };
  9.         struct student s;
  10.         no = 8;
  11.         printf("%d", no);
  12.     }

a) Nothing
b) Compile time error
c) Junk
d) 8

View Answer

Answer: b [Reason:] None.

2. Number of bytes in memory taken by the below structure is

  1.     #include <stdio.h>
  2.     struct test
  3.     {
  4.         int k;
  5.         char c;
  6.     };

a) Multiple of integer size
b) integer size+character size
c) Depends on the platform
d) Multiple of word size

View Answer

Answer: a [Reason:] None.

3. What is the output of this C code?

  1.     #include <stdio.h>
  2.     struct
  3.     {
  4.         int k;
  5.         char c;
  6.     };
  7.     int main()
  8.     {
  9.         struct p;
  10.         p.k = 10;
  11.         printf("%dn", p.k);
  12.     }

a) Compile time error
b) 10
c) Undefined behaviour
d) Segmentation fault

View Answer

Answer: a [Reason:] None.

4. What is the output of this C code?

  1.     #include <stdio.h>
  2.     struct
  3.     {
  4.         int k;
  5.         char c;
  6.     } p;
  7.     int p = 10;
  8.     int main()
  9.     {
  10.         p.k = 10;
  11.         printf("%d %dn", p.k, p);
  12.     }

a) Compile time error
b) 10 10
c) Depends on the standard
d) Depends on the compiler

View Answer

Answer: a [Reason:] None.

5. What is the output of this C code?

  1.     #include <stdio.h>
  2.     struct p
  3.     {
  4.         int k;
  5.         char c;
  6.     };
  7.     int p = 10;
  8.     int main()
  9.     {
  10.         struct p x;
  11.         x.k = 10;
  12.         printf("%d %dn", x.k, p);
  13.     }

a) Compile time error
b) 10 10
c) Depends on the standard
d) Depends on the compiler

View Answer

Answer: b [Reason:] None.

6. What is the output of this C code?

  1.     #include <stdio.h>
  2.     struct p
  3.     {
  4.         int k;
  5.         char c;
  6.         float f;
  7.     };
  8.     int p = 10;
  9.     int main()
  10.     {
  11.         struct p x = {1, 97};
  12.         printf("%f %dn", x.f, p);
  13.     }

a) Compile time error
b) 0.000000 10
c) Somegarbage value 10
d) 0 10

View Answer

Answer: b [Reason:] None.

7. What is the output of this C code(according to C99 standard)?

  1.     #include <stdio.h>
  2.     struct p
  3.     {
  4.         int k;
  5.         char c;
  6.         float f;
  7.     };
  8.     int main()
  9.     {
  10.         struct p x = {.c = 97, .f = 3, .k = 1};
  11.         printf("%fn", x.f);
  12.     }

a) 3.000000
b) Compile time error
c) Undefined behaviour
d) 1.000000

View Answer

Answer: a [Reason:] None.

8. What is the output of this C code(according to C99 standard)?

  1.  #include <stdio.h>
  2.     struct p
  3.     {
  4.         int k;
  5.         char c;
  6.         float f;
  7.     };
  8.     int main()
  9.     {
  10.         struct p x = {.c = 97, .k = 1, 3};
  11.         printf("%f n", x.f);
  12.     }

a) 3.000000
b) 0.000000
c) Compile time error
d) Undefined behaviour

View Answer

Answer: b [Reason:] None.

9. What is the output of this C code(according to C99 standard)?

  1.     #include <stdio.h>
  2.     struct p
  3.     {
  4.         int k;
  5.         char c;
  6.         float f;
  7.     };
  8.     int main()
  9.     {
  10.         struct p x = {.c = 97};
  11.         printf("%fn", x.f);
  12.     }

a) 0.000000
b) Somegarbagevalue
c) Compile time error
d) None of the mentioned

View Answer

Answer: a [Reason:] None.

.woocommerce-message { background-color: #98C391 !important; }