Top

Typedef

11.

We want to declare x, y and z as pointers of type int. The alias name given is: intpt The correct way to do this using the keyword typedef is:

Answer: D

It shows the correct way to declare x, y and z as pointers of type int using the keyword typedef. The advantage of using typedef with pointers is that we can declare any number of pointers in a single statement.

Enter details here

12.

Which of the following keywords is used to define an alternate name for an already existing data type?

Answer: C

The keyword typedef is used to define an alternate name for an already existing data type. It is mostly used for used defined data types.

Enter details here

13.

The keyword typedef cannot be used to give alias names to pointers.

Answer: B

The statement given in the question is incorrect. The keyword typedef can be used to give an alias name to all data types as well as pointers.

Enter details here

14.

In the following code, the P2 is Integer Pointer or Integer?

typedef int *ptr;
ptr p1, p2;

 

Answer: B

No answer description available for this question.

Enter details here

15.

We want to create an alias name for an identifier of the type unsigned long. The alias name is: ul. The correct way to do this using the keyword typedef is ____________

Answer: A

The syntax of the keyword typedef is: keyword ;
Hence if we want to create an alias name (ul) for an identifier of type unsigned long, the correct way to do this would be: typedef unsigned long ul;

Enter details here

Answer: B

No answer description available for this question.
 

Enter details here

17.

What will be the output of the following C code?

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

 

Answer: D

No answer description available for this question.
 

Enter details here

18.

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

Answer: D

No answer description available for this question.
 

Enter details here

20.

One of the major difference between typedef and #define is that typedef interpretation is performed by the _________________ whereas #define interpretation is performed by the _____________

Answer: C

The major difference between typedef and #define is that the typedef interpretation is performed by the compiler whereas #define interpretation is performed by pre-processor.

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