Log In Register

Units


Self-referential Structures - Questions and Answers

 

Practice these Self-referential Structures  under C Programming walk-in interview Questions/ examination questions with best tricks and short cuts with solution. Student (candidate) who want to crack the walk in interview, competitive exams and want to find short cuts and tricks to solve questions on Self-referential Structures for following purpose.


– Anyone who is wishing to increase their perfect knowledge of Self-referential Structures of C Programming.
– Anyone who is preparing for aptitude test and increase his in depth aptitude knowledge C Programming specifically Self-referential Structures .
– Anyone who is preparing for interviews (competitive examinations, govt examinations and bank examinations, off-campus or on campus interviews, walk-in interview and company interviews) having questions on Self-referential Structures under C Programming.

– Anyone who is preparing for aptitude test or competitive exam or entrance exam.
– Anyone who is preparing for entrance examinations and other competitive examinations.
– All Experienced, Freshers and Students.

Here is list of Questions and Answers covering all key area of  Self-referential Structures topic of C Programming:

 

1.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     struct student
  3.     {
  4.         char *c;
  5.         struct student *point;
  6.     };
  7.     void main()
  8.     {
  9.         struct student s;
  10.         struct student m;
  11.         m.point = s;
  12.         (m.point)->c = "hey";
  13.         printf("%s", s.c);
  14.     }

Answer: Option C

Explanation:

2.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     typedef struct p *q;
  3.     int main()
  4.     {
  5.         struct p
  6.         {
  7.             int x;
  8.             char y;
  9.             q ptr;
  10.         };
  11.         struct p p = {1, 2, &p};
  12.         printf("%d\n", p.ptr->x);
  13.         return 0;
  14.     }

Answer: Option C

Explanation:

3.

Which of the following techinique is faster for travelling in binary trees?

Answer: Option C

Explanation:

4.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         typedef struct p *q;
  5.         struct p
  6.         {
  7.             int x;
  8.             char y;
  9.             q ptr;
  10.         };
  11.         struct p p = {1, 2, &p};
  12.         printf("%d\n", p.ptr->x);
  13.         return 0;
  14.     }

Answer: Option C

Explanation:

5.

Presence of loop in a linked list can be tested by the compiler by.

Answer: Option C

Explanation:

6.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     typedef struct p *q;
  3.     struct p
  4.     {
  5.         int x;
  6.         char y;
  7.         q ptr;
  8.     };
  9.     typedef struct p *q;
  10.     int main()
  11.     {
  12.         struct p p = {1, 2, &p};
  13.         printf("%d\n", p.ptr->x);
  14.         return 0;
  15.     }

Answer: Option D

Explanation:

7.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     struct student
  3.     {
  4.         char *c;
  5.         struct student *point;
  6.     };
  7.     void main()
  8.     {
  9.         struct student s;
  10.         printf("%d", sizeof(s));
  11.     }

Answer: Option B

Explanation:

8.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     struct student
  3.     {
  4.         char *c;
  5.         struct student point;
  6.     };
  7.     void main()
  8.     {
  9.         struct student s;
  10.         s.c = "hello";
  11.         printf("%s", s.c);
  12.     }

Answer: Option A

Explanation:

9.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     typedef struct p *q;
  3.     struct p
  4.     {
  5.         int x;
  6.         char y;
  7.         q ptr;
  8.     };
  9.     int main()
  10.     {
  11.         struct p p = {1, 2, &p};
  12.         printf("%d\n", p.ptr->ptr->x);
  13.         return 0;
  14.     }

Answer: Option A

Explanation:

10.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     struct student
  3.     {
  4.         char *c;
  5.         struct student *point;
  6.     };
  7.     void main()
  8.     {
  9.         struct student s;
  10.         struct student m;
  11.         s.c = m.c = "hi";
  12.         m.point = &s;
  13.         (m.point)->c = "hey";
  14.         printf("%s\t%s\t", s.c, m.c);
  15.     }

Answer: Option D

Explanation:

11.

Which of the following is not possible?

Answer: Option A

Explanation:

12.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     struct student
  3.     {
  4.         char *c;
  5.         struct student *point;
  6.     };
  7.     void main()
  8.     {
  9.         struct student s;
  10.         struct student *m = &s;
  11.         printf("%d", sizeof(student));
  12.     }

Answer: Option D

Explanation:

13.

The number of distinct nodes the following struct declaration can point to is.

  1.     struct node
  2.     {
  3.         struct node *left;
  4.         struct node *centre;
  5.         struct node *right;
  6.     };

Answer: Option D

Explanation:

14.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     struct p
  3.     {
  4.         int x;
  5.         char y;
  6.         struct p *ptr;
  7.     };
  8.     int main()
  9.     {
  10.         struct p p = {1, 2, &p};
  11.         printf("%d\n", p.ptr->x);
  12.         return 0;
  13.     }

Answer: Option B

Explanation: