1. Which library function is used to read a single character from stdin and returns it as an int? A) getc() B) getchar_unlocked() C) getchar() D) fgets() Answer: C 2. Which function from <stdio.h> writes formatted output to a string (not to stdout)? A) printf() B) puts() C) fprintf() D) sprintf() Answer: D 3. To
1. What does the declaration int *a[5]; define? A) An array of 5 pointers to int B) A pointer to an array of 5 int C) An array of 5 pointers to int (same as A) D) A pointer to pointer to int Answer: C) An array of 5 pointers to int (same as A)
Q1. Which memory allocation type occurs automatically when a function is called? A) Static memory allocation B) Automatic memory allocation C) Dynamic memory allocation D) Register memory allocation Answer: B) Automatic memory allocation Q2. Which of the following is responsible for allocating memory at compile time? A) Static memory allocation B) Dynamic memory allocation C)
1. In C, a constant that represents a single character is known as a A) String constant B) Character constant C) Integer constant D) Symbolic constant Answer: B 2. Which of the following is a valid integer constant in C? A) 07AB B) 0x C) 0x2A D) 2H Answer: C 3. The constant ‘A’ in
1. Which of the following best describes the purpose of typedef in C? A) To allocate memory dynamically B) To create an alias for an existing data type C) To define a constant variable D) To include a header file Answer: B 2. Which of the following is the correct syntax for creating a new
Q1) Which bitwise operator in C performs a bit-by-bit logical AND between two integers? A) Bitwise OR (|) B) Bitwise XOR (^) C) Bitwise NOT (~) D) Bitwise AND (&) Answer: D) Bitwise AND (&) Q2) What does the ~ operator do in C when applied to an unsigned integer? A) Shifts bits left by
1. Which of the following functions in C is used to read a single character from the standard input device? A) gets() B) getchar() C) scanf() D) readchar() Answer: B 2. What is the correct format specifier to print a floating-point number in exponential form? A) %f B) %lf C) %e D) %g Answer: C
1. Which of the following correctly states the C type used to store a single-precision IEEE-754 floating-point number? A) double B) float C) long double D) int Answer: B 2. In C, the literal 3.14 has what type by default? A) float B) double C) long double D) long long Answer: B 3. Which suffix
1. Consider: int a = 5; int b = ++a + a++;. What is the behavior according to the C standard? A) b == 12 and defined B) b == 11 and defined C) Undefined behavior (modifying a more than once without sequencing) D) b == 10 and defined Answer: C 2. Which expression yields
1. Which of the following is a declaration that also defines a variable in C? A) extern int x; B) int x; C) extern int x; /* in another file */ D) int; Answer: B 2. What is the value of a global variable with static storage that is not explicitly initialized? A) Indeterminate B)