Govt. Exams
Entrance Exams
sizeof(int) returns the size of integer in bytes as an integer value. On most modern systems, this is 4 bytes, and printf with %d will print this numeric value.
The correct syntax for declaring a pointer to an integer is 'int *ptr;' where the asterisk (*) indicates it is a pointer variable.
The stdio.h header file contains declarations for standard input/output functions like printf(). Option A is C++, Option C is C++, and Option D is for memory allocation functions.
The == operator compares values. Since a and b both have value 5, the condition is true and "Equal" is printed.
getchar() reads a single character from standard input (stdin) and returns its ASCII value.
Integer division truncates the decimal part. 5/2 = 2 (not 2.5) because both operands are integers.
Both syntaxes are correct. C allows initializing 2D arrays with or without explicit braces for each row.
The #define directive replaces MAX with 10 during preprocessing. So x = 10 and output is 10. (Note: semicolon after MAX is not needed but doesn't affect the output)
strlen() counts characters excluding the null terminator. "Hello" has 5 characters, so strlen(s) returns 5.
An empty structure in C has a size of 1 byte. This is to ensure each structure instance has a unique address in memory.