250+ TOP MCQs on Basics of Structures and Answers

online C quiz on “Basics of Structures”. One shall practice these online quizzes to improve their C programming skills needed for various interviews (campus interviews, walkin interviews, company interviews), placements, entrance exams and other competitive exams. These questions can be attempted by anyone focusing on learning C Programming language. They can be a beginner, fresher, engineering graduate or an experienced IT professional. Our C quiz comes with detailed explanation of the answers which helps in better understanding of C concepts.

Here is a listing of online C quiz on “Basics of Structures” along with answers, explanations and/or solutions:

1. Which of the following are themselves a collection of different data types?
a) string
b) structures
c) char
d) all of the mentioned
Answer: b
Clarification: None.

2. User-defined data type can be derived by___________
a) struct
b) enum
c) typedef
d) all of the mentioned
Answer: d
Clarification: None.

3. Which operator connects the structure name to its member name?
a) –
b) <-
c) .
d) Both <- and .
Answer: c
Clarification: None.

4. Which of the following cannot be a structure member?
a) Another structure
b) Function
c) Array
d) None of the mentioned
Answer: b
Clarification: None.

5. Which of the following structure declaration will throw an error?
a)

b)

   struct temp{};
   struct temp s;
   main(){}

c)

   struct temp s;
   struct temp{};
   main(){}

d) None of the mentioned
Answer: d
Clarification: None.

6. What will be the output of the following C code?

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

a) Compile time error
b) Nothing
c) hello
d) Varies
Answer: a
Clarification: None.

7. What will be the output of the following C code?

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

a) Nothing
b) Compile time error
c) hello
d) Varies
Answer: b
Clarification: None.

8. What will be the output of the following C code?

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

a) Nothing
b) hello
c) Compile time error
d) Varies
Answer: c
Clarification: None.

9. What will be the output of the following C code?

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

a) Nothing
b) Compile time error
c) Junk
d) 8
Answer: d
Clarification: None.

10. Can the following C code be compiled successfully?

  1.     #include 
  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) Yes
b) No
c) Depends on the standard
d) Depends on the platform
Answer: c
Clarification: None.

Leave a Reply

Your email address will not be published. Required fields are marked *