Top

Typedef

31.

Array is preferred over linked list for the implementation of ________

Answer: C

When we try to implement binary search using linked list, the traversal steps per element increases in order to find the middle element. Thus, this process is slow and inefficient. This process is much faster using an array, hence it is preferable to use an array for the implementation of binary search.

Enter details here

32.

What will be the output of the following C code?

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

 

Answer: A

No answer description available for this question.
 

Enter details here

Answer: B

No answer description available for this question.
 

Enter details here

34.

What will be the output of the following C code?

#include 
    typedef int integer;
    int main()
    {
        int i = 10, *ptr;
        float f = 20;
        integer j = i;
        ptr = &j;
        printf("%d\n", *ptr);
        return 0;
    }

 

Answer: D

No answer description available for this question.
 

Enter details here

35.

What will be the output of the program?

#include

typedef struct error {int warning, err, exception;} ERROR;
int main()
{
    ERROR e;
    e.err=1;
    printf("%d\n", e.err);
    return 0;
}

 

Answer: B

No answer description available for this question.

Enter details here

36.

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

Answer: B

No answer description available for this question.
 

Enter details here

37.

Consider this statement: typedef enum good {a, b, c} hello; Which of the following statements is incorrect about hello?

Answer: A

The keyword typedef is used to give an alternate name to an existing data type. Hence hello is the new name for enum good.

Enter details here

38.

typedef which of the following may create problem in the program?

Answer: D

No answer description available for this question.
 

Enter details here

Answer: B

No answer description available for this question.

Enter details here

40.

What will be the output of the following C code?

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

 

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