C questions in placement tests and university exams are rarely about syntax alone. Most of what you will find here is output prediction, pointer arithmetic, arrays and strings, structures and unions, storage classes, recursion, and file handling. The explanations walk through memory behaviour step by step, which is usually where the confusion sits rather than in the code itself.
What is the output of the following code? #include <stdio.h> int main() { char c = 'A'; printf("%d", c); return 0; }
Answer: A
The %d format specifier prints the ASCII value of the character. 'A' has ASCII value 65.
Q.11Easy
Which of the following is the correct syntax to declare a pointer to an integer in C?
Answer: A
In C, a pointer to an integer is declared using 'int *ptr;' where '*' indicates pointer declaration.
Q.12Easy
What is the size of 'char' data type in C?
Answer: C
The 'char' data type in C occupies 1 byte of memory and can store a single character.
Q.13Easy
Which of the following variable names is valid in C?
Answer: C
Variable names in C must start with a letter or underscore, followed by alphanumeric characters or underscores. '_variable123' is valid, while '2variable' starts with digit, 'var-iable' has hyphen, and 'var iable' has space.
Q.14Easy
What is the default return type of the main() function in C?
Answer: B
The main() function implicitly returns int type, which indicates the program's exit status (0 for success, non-zero for failure).
Q.15Easy
Which escape sequence is used to print a newline character in C?
Answer: B
The escape sequence \n represents a newline character that moves the cursor to the next line.
Q.16Easy
What is the size of the 'int' data type in a 32-bit system according to C standard?
Answer: D
The size of 'int' is implementation-defined and depends on the compiler and platform, though it is typically 4 bytes on 32-bit systems.
Q.17Easy
Which of the following is NOT a valid C identifier?
Answer: B
Identifiers cannot start with a digit. They must start with a letter (a-z, A-Z) or underscore.
Q.18Easy
In C, what is the size of the 'char' data type?
Answer: B
By C standard, sizeof(char) is always 1 byte, regardless of platform.
Q.19Easy
What is the output of: char c = 65; printf("%c", c);
Answer: B
%c format specifier prints the character representation of ASCII value 65, which is 'A'.
Q.20Easy
Which header file is required to use the malloc() function?
Answer: B
malloc() and other dynamic memory allocation functions are declared in <stdlib.h>.