MCQOPTIONS
Saved Bookmarks
This section includes 55 Mcqs, each offering curated multiple-choice questions to sharpen your Typedef knowledge and support exam preparation. Choose a topic below to get started.
| 51. |
For the following expression to work, which option should be selected. string p = HELLO ; |
| A. | typedef char [] string; |
| B. | typedef char * string; |
| C. | Both (a) and (b) |
| D. | Such expression cannot be generated in C |
| Answer» C. Both (a) and (b) | |
| 52. |
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 |
| A. | Compile time error |
| B. | Varies |
| C. | hi |
| D. | h |
| Answer» B. Varies | |
| 53. |
The keyword typedef cannot be used to give alias names to pointers. |
| A. | True |
| B. | False |
| Answer» C. | |
| 54. |
typedef in C basically works as an alias. Which of the following is correct for typedef ? |
| A. | typedef can be used to alias compound data types such as struct and union. |
| B. | typedef can be used to alias both compound data types and pointer to these compound types. |
| C. | typedef can be used to alias a function pointer. |
| D. | All of the above. |
| Answer» E. | |
| 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. |
| A. | printf("%f %lf %Lf",x,y,z); |
| B. | printf( %f %f %f ,x,y,z); |
| C. | printf("%f ? ?f",x,y,z); |
| D. | printf("%f %lf %llf",x,y,z); |
| Answer» B. printf( %f %f %f ,x,y,z); | |