Module 1 – Exam-Oriented Answers (Problem Solving Using C)
1. Explain the basic structure of a C program.
A C program has: (1) Preprocessor directives (header files), (2) Global declarations, (3)
main() function where execution starts, (4) Variable declarations, (5) Program statements,
(6) User-defined functions.
2. What is a variable? Explain rules to define a variable name.
A variable stores data in memory. Rules: must start with letter/underscore, no spaces, no
keywords, case‑sensitive, only letters/digits/underscore.
3. Characteristics of C programming.
Simple, fast, portable, structured, rich library, supports pointers, supports modular
programming.
4. What are identifiers? State rules.
Names given to variables, functions. Rules: no spaces, start with letter/underscore, only
letters/digits/underscore, case‑sensitive, no keywords.
5. Difference between variables and identifiers.
Identifier is any name in program. Variable is a type of identifier used to store data.
6. Use of scanf() with example.
scanf() reads user input. Example: scanf("%d", &a); stores integer in variable a.
7. Short note on data types.
C data types: Basic (int, float, char, double), Derived (arrays, functions, pointers),
User‑defined (struct, union, enum).
8. Format specifiers.
%d (int), %f (float), %c (char), %s (string). Used for input/output formatting.
9. Operators and types.
Operators perform operations. Types: Arithmetic, Relational, Logical, Assignment,
Increment/Decrement, Bitwise, Conditional.
10. Type casting with example.
Converting one data type to another. Example: (float)a/b; converts a to float.
11. Steps in compiling and executing a C program.
Write → Save → Compile → Fix errors → Run → Get output.
12. Types of data types with examples.
Basic: int a; float b; Derived: int arr[5]; User‑defined: struct student {…};
13. Program for sum, diff, product, quotient.
C program performing +, −, *, /.
14. Importance of header files.
They provide declarations for functions like printf(), scanf().
15. Difference between global and local variables.
Global: declared outside main, accessible everywhere. Local: declared inside function,
limited scope.
16. Types of constants.
Integer constants, Float constants, Character constants, String constants.
17. Program to calculate area of circle.
Use formula: area = 3.14 * r * r.
18. Structure of C program (with example).
Includes headers, main(), declarations, statements, functions.
20. Steps in compiling/executing C program.
Same as Q11.
22. Algorithm/flowchart/program for sum.
Algorithm → Flowchart → C code using +.
23. Algorithm/flowchart/program for average.
Read three numbers → sum → divide by 3.
24. Eligibility to vote program.
Check age >= 18 using if.
25. Area/perimeter of rectangle.
Area = l*b; Perimeter = 2(l+b).
26. Swap using temporary variable.
temp = a; a = b; b = temp;
27. Simple interest program.
SI = (P*R*T)/100.
28. Print name/roll/college program.
Use printf() to display details.
29. Remainder and quotient program.
Use / and % operators.
30. Define algorithm + advantages.
Algorithm = step‑by‑step solution. Advantages: clarity, easy debugging, structured.
31. Procedure to design algorithm.
Understand problem → Identify inputs/outputs → Write steps logically → Validate.
32. Flowchart and symbols.
Graphical representation of steps. Symbols: Oval (start/end), Parallelogram (input/output),
Rectangle (process), Diamond (decision).