Log In Register

Units


Typedefs - Questions and Answers

 

Practice these Typedefs 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 Typedefs for following purpose.


– Anyone who is wishing to increase their perfect knowledge of Typedefs of C Programming.
– Anyone who is preparing for aptitude test and increase his in depth aptitude knowledge C Programming specifically Typedefs.
– 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 Typedefs 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  Typedefs topic of C Programming:

 

1.

Which of the following is FALSE about typedef?

Answer: Option A

Explanation:

2.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     typedef struct p
  3.     {
  4.         int x, y;
  5.     }k = {1, 2};
  6.     int main()
  7.     {
  8.         p k1 = k;
  9.         printf("%d\n", k1.x);
  10.     }

Answer: Option C

Explanation:

3.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int *(*(x()))[2];
  3.     typedef int **(*ptrfoo)())[2];
  4.     int main()
  5.     {
  6.         ptrfoo ptr1;
  7.         ptr1 = x;
  8.         ptr1();
  9.         return 0;
  10.     }
  11.     int *(*(x()))[2]
  12.     {
  13.         int (*ary)[2] = malloc(sizeof * ary);
  14.         return &ary;
  15.     }

Answer: Option C

Explanation:

4.

What is the output of this C code?

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

Answer: Option A

Explanation:

5.

typedef which of the following may create problem in the program

Answer: Option D

Explanation:

6.

typedef int (*PFI)(char *, char *)creates

Answer: Option B

Explanation:

7.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     typedef struct p
  3.     {
  4.         int x, y;
  5.     };
  6.     int main()
  7.     {
  8.         p k1 = {1, 2};
  9.         printf("%d\n", k1.x);
  10.     }

Answer: Option D

Explanation:

8.

Which of the given option is the correct method for initialization?
    typedef char *string;

Answer: Option C

Explanation:

9.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     typedef struct p
  3.     {
  4.         int x, y;
  5.     }k;
  6.     int main()
  7.     {
  8.         struct p p = {1, 2};
  9.         k k1 = p;
  10.         printf("%d\n", k1.x);
  11.     }

Answer: Option C

Explanation:

10.

typedef declaration

Answer: Option A

Explanation:

11.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int (*(x()))[2];
  3.     typedef int (*(*ptr)())[2] ptrfoo;
  4.     int main()
  5.     {
  6.         ptrfoo ptr1;
  7.         ptr1 = x;
  8.         ptr1();
  9.         return 0;
  10.     }
  11.     int (*(x()))[2]
  12.     {
  13.         int (*ary)[2] = malloc(sizeof*ary);
  14.         return &ary;
  15.     }

Answer: Option D

Explanation:

12.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     typedef int integer;
  3.     int main()
  4.     {
  5.         int i = 10, *ptr;
  6.         float f = 20;
  7.         integer j = i;
  8.         ptr = &j;
  9.         printf("%d\n", *ptr);
  10.         return 0;
  11.     }

Answer: Option A

Explanation:

13.

What is the output of this C code?

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

Answer: Option D

Explanation:

14.

For the following expression to work, which option should be selected.
    string p = “HELLO”;

Answer: Option C

Explanation: