Top

Typedef

51.

In the following code what is 'P'?

typedef char *charp;
const charp P;

 

Answer: A

No answer description available for this question.

Enter details here

52.

What will be the output of the following C code?

#include
int main()
{
    typedef union a
    {
        int i;
        char ch[2];
    }hello;
    hello u;
    u.ch[0] = 3;
    u.ch[1] = 2;
    printf("%d, %d", u.ch[0], u.ch[1]);
    return 0;
}

 

Answer: B

In the code shown above, we have defined hello, which is the instance variable of a union (a) using typedef. On the execution of the code shown above, we obtain the output: 3, 2

Enter details here

53.

What is the output of this C code?

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

 

Answer: B

No answer description available for this question.
 

Enter details here

54.

What will be the output of following program ?

#include < stdio>
int main()
{
    typedef int AAA,BBB,CCC,DDD;
    AAA aaa=10;
    BBB bbb=20;
    CCC ccc=30;
    DDD ddd=40;
    printf("%d,%d,%d,%d",aaa,bbb,ccc,ddd);
    return 0;
}

 

Answer: C

No answer description available for this question.

Enter details here

55.

In a C program, following variables are defined:

float      x = 2.17;

double   y = 2.17;

long double z = 2.17;

Which of the following is correct way for printing these variables via printf.

Answer: A

No answer description available for this question.

Enter details here

56.

What will be the output of the program?

#include

int main()
{
    enum color{red, green, blue};
    typedef enum color mycolor;
    mycolor m = red;
    printf("%d", m);
    return 0;
}

 

Answer:

Enter details here

57.

What will be the output of the following C code?

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

 

Answer: B

No answer description available for this question.
 

Enter details here

Answer: D

No answer description available for this question.
 

Enter details here

59.

In the following code snippet can we declare a new typedef named ptr even though struct employee has not been completely declared while using typedef?

typedef struct employee *ptr;
struct employee
{
    char name[20];
    int age;
    ptr next;
}

 

Answer: A

No answer description available for this question.

Enter details here

Answer: C

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