- C Programming
C Programming Multiple Choice Questions (MCQs) and Answers
Master C Programming with Practice MCQs. Explore our curated collection of Multiple Choice Questions. Ideal for placement and interview preparation, our questions range from basic to advanced, ensuring comprehensive coverage of C Programming. Begin your placement preparation journey now!
Q1 Why is learning programming important in today's world?
For academic purposes only
To automate and solve complex problems
Only for software development
For entertainment purposes only
Report a Problem!
Q2 What is the main function of a compiler in programming?
To write code
To interpret code
To convert code into machine language
To debug code
Q3 Which of the following is true about interpreters?
They execute programs faster than compilers
They translate the entire program at once
They translate and execute code line by line
They are not used in modern programming
Q4 How does a compiler differ from an interpreter?
A compiler executes code, while an interpreter does not
A compiler debugs code, while an interpreter does not
A compiler translates the entire program at once, while an interpreter translates it line by line
A compiler is used only in C programming, while an interpreter is not
Q5 What is the primary purpose of writing a "Hello World" program when learning a new programming language?
To test if the language supports string operations
To learn complex programming concepts
To demonstrate basic syntax and output
To introduce advanced programming features
Q6 What will be the output of the following C program? #include <stdio.h> int main() { printf("Hello, World!"); return 0; }
Hello, World!
Syntax Error
Q7 Identify the error in this C program: #include <stdio.h> int main() { print("Hello, World!"); return 0; }
Missing #include statement
Incorrect function name
Syntax error in return statement
Q8 Which of the following is not a keyword in C?
Q9 What data type would you use to store a character in C?
Q10 Which of the following is a valid identifier in C?
none of these
Q11 What is the size of 'int' data type in C?
Depends on the system
Q12 What is the difference between 'float' and 'double' data types in C?
Syntax only
No difference
Q13 What will be the output of the following C code? int main() { char c = 'A'; printf("%d", c); return 0; }
None of these
Q14 Identify the error in this C code: int main() { int number = 100.5; printf("%d", number); return 0; }
Assigning float to int
Syntax error
Wrong printf format
Q15 Spot the error in this code snippet: #include <stdio.h> int main() { const int age; age = 30; printf("%d", age); return 0; }
Uninitialized constant
Missing return statement
Syntax error in printf statement
Q16 What is the purpose of the printf function in C?
To read input
To print output
To perform calculations
To control program flow
Q17 What does %d signify in the printf or scanf function?
Double data type
Decimal integer
Dynamic allocation
Directory path
Q18 What will be the output of the following C code? int main() { printf("%d", 500); return 0; }
Q19 What will the following C code output? int main() { int num; scanf("%d", &num); printf("%d", num); return 0; }
The inputted number
Q20 Pseudocode: READ number PRINT "The number is ", number What does this pseudocode do?
Reads and prints a number
Prints a fixed number
Generates a random number
Q21 Identify the error in this C code: int main() { int x; scanf("%d", x); printf("%d", x); return 0; }
Missing & in scanf
Wrong format specifier
Q22 Find the mistake in this code: int main() { float num; printf("Enter a number: "); scanf("%f", num); printf("You entered: %f", num); return 0; }
Incorrect format specifier in printf
Q23 Which operator is used for division in C?
Q24 What does the '==' operator check?
Greater than
Q25 What is the result of the logical expression (1 && 0)?
Q26 What does the '+' operator do in C?
Subtraction
Multiplication
Q27 Which operator has higher precedence, '+' or '*'?
Both are same
Q28 What does the '!' operator do in C?
Q29 What is the output of the expression 2<3?
Q30 What will be the output of the following C code? int main() { int a = 10, b = 5; printf("%d", a / b); return 0; }
IMAGES
VIDEO