Govt Exams
The correct syntax uses the 'struct' keyword followed by the structure name and then the member declarations enclosed in braces.
The free() function deallocates (releases) memory that was previously allocated using malloc(), calloc(), or realloc().
The pre-increment operator ++x increments x first (from 5 to 6), then assigns the new value to y. So x = 6 and y = 6.
The correct syntax is 'int *p;' where int is the data type, * indicates pointer, and p is the pointer variable name.
*p dereferences to a (10) and *q dereferences to b (20). Adding them: 10 + 20 = 30. Pointer arithmetic is used correctly here.
In a union, all members share the same memory location. The size of the union equals the size of the largest member. Only one member can hold a value at a time.
Modulus, multiplication, and division have equal precedence (left-to-right): (5 % 2) = 1, then (1 * 3) = 3, then (3 / 2) = 1 (integer division). Answer is 1, not 2. Correction: 1 is correct.
sizeof(s) includes the null terminator '\0'. "hello" has 5 characters + 1 null terminator = 6 bytes. If s was a pointer, sizeof would give pointer size.
Only p is declared as a pointer (int *p). The variable q is declared as a regular integer (int q). The * applies only to p in this declaration.