11 Sep 100 C Programming MCQ (Multiple Choice Questions) with Answers
Show Answer
2) Which of the following is the correct extension of a C source file?
Show Answer
3) Which operator is used to get the memory address of a variable in C?
Show Answer
4) What is the correct syntax to output “Hello World” in C?
Show Answer
5) Which format specifier is used to print an integer in printf()?
Show Answer
6) What is the size of int data type in standard 32-bit C compiler?
Show Answer
7) Which keyword is used to declare a variable whose value cannot be changed?
Show Answer
8) What is the index of the first element in a C array?
Show Answer
9) Which header file is required to use printf() and scanf() functions?
Show Answer
10) What does the main() function return by default to indicate successful execution?
Show Answer
11) Which of the following is NOT a valid C variable name?
Show Answer
12) Which operator is used to dereference a pointer in C?
Show Answer
13) What function is used to dynamically allocate memory in C?
Show Answer
14) Which function is used to free dynamically allocated memory?
Show Answer
15) What will 10 % 3 evaluate to in C?
Show Answer
16) Which of the following is a conditional selection operator in C?
Show Answer
17) How do you write a single-line comment in modern C (C99 onwards)?
Show Answer
18) What is the output of sizeof(char) in C?
Show Answer
19) Which library function is used to copy one string to another?
Show Answer
20) What is the default return type of a function in C if not specified?
Show Answer
21) Which keyword is used to exit from a loop or switch block immediately?
Show Answer
22) Which statement skips the remaining code in the current iteration of a loop?
Show Answer
23) What character terminates a standard C string?
Show Answer
24) What is a pointer that points to no valid memory location called?
Show Answer
25) Which function is used to compare two strings in C?
Show Answer
26) Which header file is required for functions like malloc() and free()?
Show Answer
27) What is the format specifier for a single character in scanf()?
Show Answer
28) Which keyword is used to create a custom type name in C?
Show Answer
29) In a struct, how are members stored in memory?
Show Answer
30) In a union, how are members stored in memory?
Show Answer
31) What operator is used to access structure members using a structure pointer?
Show Answer
32) What is the format specifier used for printing floating-point numbers?
Show Answer
33) Which preprocessor directive is used to define symbolic constants in C?
Show Answer
34) What will happen if you access an array out of its defined bounds in C?
Show Answer
35) What is the scope of a variable declared inside a function block?
Show Answer
36) Which function is used to read a string with spaces from standard input?
Show Answer
37) What function is used to calculate the length of a string in C?
Show Answer
38) Which keyword is used to pass back a value from a function?
Show Answer
39) What is a generic pointer in C that can point to data of any type?
Show Answer
40) What is the output of printf(“%d”, 5 / 2); in integer arithmetic?
Show Answer
41) Which storage class retains a local variable’s value between function calls?
Show Answer
42) What is the default storage class for local variables in C?
Show Answer
43) Which keyword is used to declare a variable defined in another file?
Show Answer
44) What does the operator ++i do compared to i++?
Show Answer
45) Which of the following is a bitwise AND operator in C?
Show Answer
46) Which of the following is a logical OR operator in C?
Show Answer
47) What will malloc() return if memory allocation fails?
Show Answer
48) What function reallocates memory to a new size in C?
Show Answer
49) What is the primary difference between malloc() and calloc()?
Show Answer
50) Which mode is used in fopen() to open a file for writing, creating it if it doesn’t exist?
Show Answer
51) What does fopen() return if the file cannot be opened?
Show Answer
52) Which function is used to close an open file in C?
Show Answer
53) What constant represents the end of a file in C standard I/O?
Show Answer
54) Which header file contains math functions like sqrt() and pow()?
Show Answer
55) Which of these functions reads a single character from standard input?
Show Answer
56) What keyword is used to define an enumeration data type?
Show Answer
57) By default, what integer value is assigned to the first item in an enum?
Show Answer
58) What is the result of 5 == 5 in a C condition evaluation?
Show Answer
59) What value represents “false” in traditional C boolean evaluation?
Show Answer
60) Which keyword is used in switch-case to handle unmatched values?
Show Answer
61) What happens if a break statement is omitted at the end of a case in switch?
Show Answer
62) What is the bitwise XOR operator in C?
Show Answer
63) What is the bitwise NOT (complement) operator in C?
Show Answer
64) What does the left shift operator << do to an integer?
Show Answer
65) What does the right shift operator >> do to a positive integer?
Show Answer
66) What function appends one string to the end of another?
Show Answer
67) What is a recursion in C?
Show Answer
68) What is a pointer pointing to a memory location that has been freed called?
Show Answer
69) What is an uninitialized pointer called?
Show Answer
70) Which function reads formatted input from a file stream?
Show Answer
71) Which function writes formatted output to a file stream?
Show Answer
72) What is the purpose of fflush(stdin) or fflush(stdout)?
Show Answer
73) What is the maximum number of dimensions an array can have in C?
Show Answer
74) How do you declare a pointer to an integer in C?
Show Answer
75) What is the output of sizeof(“Hello”) in bytes (including null terminator)?
Show Answer
76) Which statement creates an array of 5 integers initialized to zero?
Show Answer
77) What is the format specifier for printing pointer address in hexadecimal format?
Show Answer
78) Which of these is a valid character constant in C?
Show Answer
79) What is the escape sequence for a new line in C?
Show Answer
80) What is the escape sequence for a tab space?
Show Answer
81) What operator is used to calculate the size of a data type or variable in bytes?
Show Answer
82) Which of the following storage classes requests the compiler to store the variable in CPU register?
Show Answer
83) What is the format specifier for unsigned int?
Show Answer
84) What format specifier is used for long int?
Show Answer
85) What function converts a string of digits into an integer?
Show Answer
86) What is the preprocessor directive used to include header files?
Show Answer
87) Which loop tests the exit condition at the bottom after executing the loop body once?
Show Answer
88) What is the output of !5 in C logical evaluation?
Show Answer
89) What is the output of !0 in C?
Show Answer
90) How is a function defined as receiving no arguments in C?
Show Answer
91) What is the precedence order of arithmetic operators *, /, +, -?
Show Answer
92) What keyword is used to specify that a variable can be modified unexpectedly by hardware/threads?
Show Answer
93) What function moves the file position pointer to a specific location?
Show Answer
94) What function returns the current file pointer position in a file stream?
Show Answer
95) What function resets the file position pointer back to the beginning of the file?
Show Answer
96) What standard macro in C denotes a null pointer constant?
Show Answer
97) What operator is used to access structure members using a structure variable directly?
Show Answer
98) Which statement is true regarding C array parameters in functions?
Show Answer
99) Which header file contains macro definitions like INT_MAX and INT_MIN?
Show Answer
100) What is the result of applying bitwise NOT (~) on 0 in 32-bit two’s complement integer representation?
Show Answer
No Comments