C- Typedef Questions and Answers
Practice ModeShowing 10 of 23 questions
Q11
What happens when we use typedef with a structure without a tag?
Answer: Option B
Explanation: Creates type alias for anonymous structure
Q12
Which scope does typedef follow?
Answer: Option C
Explanation: typedef follows normal C scope rules
Q13
What is the difference between typedef and #define?
Answer: Option C
Explanation: typedef is interpreted by compiler, #define by preprocessor
Q14
Can typedef be used to create a new data type?
Answer: Option B
Explanation: No, typedef only creates aliases for existing types
Q15
How to use typedef with enum?
Answer: Option A
Explanation: Similar to structures, typedef can simplify enum usage
Q16
What is the output of: typedef int Integer; Integer x = 5; printf("%d", x);
Answer: Option B
Explanation: Integer is alias for int, so output is 5
Q17
Which is better for type checking: typedef or #define?
Answer: Option B
Explanation: typedef provides better type checking
Q18
Can we use typedef inside a function?
Answer: Option B
Explanation: Yes, typedef can have local scope
Q19
What does typedef unsigned int UINT; do?
Answer: Option B
Explanation: Creates UINT as alias for unsigned int
Q20
How to declare multiple typedefs in one statement?
Answer: Option B
Explanation: Multiple typedefs need separate statements