Exercise: Structures Unions Enums

Questions for: Structures Unions Enums

size of union is size of the longest element in the union
A:
Yes
B:
No
C:
D:
Answer: A
No answer description is available. Let's discuss.
If the following structure is written to a file using fwrite(), can fread() read it back successfully?
struct emp
{
    char *n;
    int age;
};
struct emp e={"ExamAdept", 15};
FILE *fp;
fwrite(&e, sizeof(e), 1, fp);
A:
Yes
B:
No
C:
D:
Answer: B
Since the structure contain a char pointer while writing the structure to the disk using fwrite() only the value stored in pointer n will get written. so fread() fails to read.
It is not possible to create an array of pointer to structures.
A:
True
B:
False
C:
D:
Answer: B
No answer description is available. Let's discuss.
The '->' operator can be used to access structures elements using a pointer to a structure variable only
A:
True
B:
False
C:
D:
Answer: A
No answer description is available. Let's discuss.
A structure can contain similar or dissimilar elements
A:
True
B:
False
C:
D:
Answer: A
No answer description is available. Let's discuss.
Ad Slot (Above Pagination)
Quiz