1. Which of the following best describes an algorithm?
a) A flowchart b) A set of instructions to
solve a problem c) A C program d) A compiler
Answer: b
2. What is the first step in developing an algorithm? a) Testing b) Writing code c) Understanding the
problem d) Debugging
Answer: c
3. Which of the following is not a property of a good algorithm? a) Finiteness b) Input c) Ambiguity
d) Output
Answer: c
4. The step-by-step solution of a problem in an algorithm is executed in: a) Any random order b)
Reverse order c) A definite logical sequence d) Parallel order
Answer: c
5. In a flowchart, which shape is used to represent input/output operations? a) Rectangle b)
Diamond c) Parallelogram d) Circle
Answer: c
6. The diamond symbol in a flowchart represents: a) Start/Stop b) Input/Output c) Processing d)
Decision
Answer: d
7. Which of the following is an advantage of using flowcharts? a) Makes debugging harder b)
Provides a visual representation of a process c) Replaces coding completely d) Is used only in C
programming
Answer: b
8. A flowchart always starts and ends with which shape? a) Circle b) Oval/Ellipse c) Rectangle d)
Diamond
Answer: b
9. Tokens in C are: a) Keywords, identifiers, constants, operators, special symbols b) Only
keywords c) Functions d) Data types
Answer: a
10. Which of the following is not a valid identifier in C? a) total_marks b) _sum c) 2value d) marks2
Answer: c
11. In C, int, float, return are examples of: a) Identifiers b) Operators c) Keywords d) Constants
Answer: c
12. Which of the following symbols is used for a single-line comment in C (C99 standard)? a) /*
comment */ b) # comment c) // comment d) ** comment **
Answer: c
13. Which header file is required to use scanf() in C? a) stdlib.h b) stdio.h c) conio.h d) string.h
Answer: b
14. What does the & symbol in scanf("%d", &x;); indicate? a) Multiplication b) Address of variable c)
Data type d) None of the above
Answer: b
15. Which of the following correctly takes a float input from the user? a) scanf("%d", &f;); b)
scanf("%c", &f;); c) scanf("%f", &f;); d) scanf("%s", &f;);
Answer: c
16. If a user enters 10 20 for scanf("%d%d", &a;, &b;); then: a) a=10, b=20 b) a=20, b=10 c)
a=1020, b=0 d) Error
Answer: a
17. Which function is used to display output on the screen in C? a) print() b) write() c) display() d)
printf()
Answer: d
18. What will be the output of printf("%d", 5+2); a) 5 b) 2 c) 7 d) 52
Answer: c
19. To print a floating-point number with 2 decimal places, you use: a) printf("%f", x); b)
printf("%.2f", x); c) printf("%2f", x); d) printf("%f.2", x);
Answer: b
20. What is the return type of printf() in C? a) void b) int c) float d) char
Answer: b