C Programming – Unit 1 & Unit 2 Notes
Unit 1: Introduction to Computer System & C Basics
• Components of Computer System: Memory, Processor, I/O Devices, Storage, OS.
• System Software: Assembler, Compiler, Interpreter, Loader, Linker.
• Algorithms: Representation using Flowchart, Pseudocode. Example – factorial algorithm.
• C Basics: Structure of program, Errors (syntax vs logic), Compilation process.
• Components: Keywords, Identifiers, Constants, Operators.
• Standard I/O: printf, scanf.
• Data Types: int, float, double, char.
• Variables and Memory.
• Storage Classes: auto, register, static, extern.
Unit 2: Operators, Branching & Loops
• Expressions & Operators: Arithmetic, Relational, Logical, Bitwise, Assignment,
Increment/Decrement.
• Type Conversion: Implicit & Explicit.
• Operator Precedence & Associativity.
• Conditional Branching: if, if-else, nested if, switch.
• Iteration & Loops: while, do-while, for, nested loops.
• Control statements: break, continue, goto.
Important Example Programs
• Largest of 3 numbers.
• Factorial of a number.
• Fibonacci series.
• Prime number check.
• Reverse of a number / Sum of digits.
• Simple calculator using switch.
• Pattern printing (stars, numbers).
Exam Tips
• Write algorithm + flowchart if asked.
• For each program, use proper structure with comments.
• Trace code carefully when asked output questions.
• Partial code/logic still fetches marks.
25 Most Likely Exam Questions
1 Define Assembler, Compiler, Interpreter, Loader, and Linker.
2 Differentiate between Compiler and Interpreter.
3 Explain the phases of C program execution (source code to executable).
4 Write an algorithm and flowchart to find the factorial of a number.
5 Write a pseudocode to check if a number is prime.
6 Explain storage classes in C with examples.
7 Differentiate between Syntax error and Logical error with examples.
8 Explain standard input/output functions in C with syntax.
9 Explain different data types in C with sizes.
10 What are variables? How are they stored in memory?
11 Explain operator precedence in C with an example expression.
12 Differentiate between = and == operators with examples.
13 Write a program in C to find the largest of 3 numbers using if-else.
14 Write a program in C to display Fibonacci series.
15 Write a program in C to calculate factorial using a loop.
16 Write a program to check whether a number is prime.
17 Write a program in C to find sum of digits of a number.
18 Write a program in C to reverse a number.
19 Write a program in C to perform a simple calculator using switch.
20 Write a program to print a star pattern using nested loops.
21 Explain the use of break and continue with examples.
22 Differentiate between while and do-while loops with examples.
23 Write a program in C to find the average of n numbers using for loop.
24 Trace the output of a given C program (with loops/conditions).
25 Explain goto statement with an example.