Top

Typedef

41.

What will be the output of the following C code?

#include 
    typedef struct p
    {
        int x, y;
    }k = {1, 2};
    int main()
    {
        p k1 = k;
        printf("%d\n", k1.x);
    }

 

Answer: A

No answer description available for this question.
 

Enter details here

42.

Which of the following is an example for non linear data type?

Answer: A

A data structure is said to be linear if its elements form a sequence or a linear list. For example array, linked list, queue, stack etc. Elements in a non linear data structure do not form a sequence. For example Trees, graphs etc.

Enter details here

43.

Is the following declaration acceptable?

typedef long no, *ptrtono;
no n;
ptrtono p;

 

Answer: A

No answer description available for this question.

Enter details here

44.

What will be the output of the following C code?

#include 
    typedef struct student
    {
        char *a;
    }stu;
    void main()
    {
        stu s;
        s.a = "hi";
        printf("%s", s.a);
    }s

 

Answer: A

No answer description available for this question.
 

Enter details here

45.

Which of the following is an example of static memory allocation?

Answer: D

No answer description available for this question.

Enter details here

Answer: C

No answer description available for this question.

Enter details here

48.

What will be the output of the following C code?

#include 
    int *(*(x()))[2];
    typedef int **(*ptrfoo)())[2];
    int main()
    {
        ptrfoo ptr1;
        ptr1 = x;
        ptr1();
        return 0;
    }
    int *(*(x()))[2]
    {
        int (*ary)[2] = malloc(sizeof * ary);
        return &ary;
    }

 

Answer: B

No answer description available for this question.
 

Enter details here

49.

What will be the output of the following C code?

#include 
    int (*(x()))[2];
    typedef int (*(*ptr)())[2] ptrfoo;
    int main()
    {
        ptrfoo ptr1;
        ptr1 = x;
        ptr1();
        return 0;
    }
    int (*(x()))[2]
    {
        int (*ary)[2] = malloc(sizeof*ary);
        return &ary;
    }

 

Answer: A

No answer description available for this question.
 

Enter details here

Answer: A

No answer description available for this question.
 

Enter details here

Loading…
Tags: Typedef Questions and Answers || Typedef MCQ Questions and Answers || Typedef GK Questions and Answers || Typedef GK MCQ Questions || Typedef Multiple Choice Questions and Answers || Typedef GK || GK on Typedef || C Programming Questions and Answers || C Programming MCQ Questions and Answers || C Programming GK Questions and Answers || GK on C Programming