If you are a 1st year B.Tech student studying under Maulana Abul Kalam Azad University of Technology (MAKAUT), Unit 1 of Programming for Problem Solving (PPS-II / BS-CS201 / ES-CS201) forms the fundamental bedrock of your engineering degree. Whether you are aiming to ace your CA1 / CA2 class tests, maximize your End-Semester Online CA (ECA) score, or target an O-grade (90+) in the 70-mark End-Semester theory examination, mastering C operators and decision control structures is essential.

In this guide, we break down the entire MAKAUT Unit 1 syllabus into actionable concepts, memory layouts, operator precedence rules, and fully tested code examples straight from university past paper trends.

NOTE

This guide is strictly aligned with the updated MAKAUT credit curriculum regulations. All code snippets are verified against GCC (C99/C11 standards) commonly used in college labs across West Bengal.

---

1. The C Compilation Pipeline Explained

In MAKAUT semester viva-voce and Group A short questions (2 Marks), examiners frequently ask: *"What happens under the hood when a C program compiles?"*

When you write a program main.c and compile it via GCC (gcc main.c -o main), the code passes through 4 distinct phases:

c

The 4 Stages:

  1. Preprocessing (`.c` to `.i`):
  2. Expands macros (#define).
  3. Replaces header includes (#include <stdio.h>) with actual header declarations.
  4. Strips all comments (// and /* ... */).
  5. Compilation (`.i` to `.s`):
  6. Translates expanded C code into target assembly language (.s).
  7. Performs syntax checking, type validation, and register allocation optimization.
  8. Assembly (`.s` to `.o` / `.obj`):
  9. Converts assembly mnemonic instructions into binary machine code object files.
  10. Linking (`.o` to Binary Executable):
  11. Links your object code with external standard library binaries (e.g., printf implementation from libc).
  12. Resolves symbol addresses to produce the final executable binary.
NOTE

To inspect intermediate preprocessor output in GCC for debugging, run: gcc -E main.c -o main.i.

---

2. Data Types, Storage Sizes & Format Specifiers

C is a statically typed language. Every variable must have an explicit data type that dictates how many bytes are allocated in RAM and how bits are interpreted.

Data TypeKeywordSize (32/64-bit GCC)Numeric RangeFormat Specifier
Characterchar1 Byte (8 bits)-128 to 127%c
Unsigned Charunsigned char1 Byte0 to 255%c
Integerint4 Bytes (32 bits)-2,147,483,648 to 2,147,483,647%d or %i
Short Intshort2 Bytes (16 bits)-32,768 to 32,767%hd
Floatfloat4 Bytes1.2 × 10^{-38} to 3.4 × 10^{38} (6 decimal places)%f
Doubledouble8 Bytes2.3 × 10^{-308} to 1.7 × 10^{308} (15 decimal places)%lf
Pointervoid*4 Bytes (32-bit) / 8 Bytes (64-bit)Hexadecimal RAM Address%p

---

3. C Operators & Precedence Master Table

In MAKAUT Group A questions, expression evaluation problems (e.g., res = 5 + 3 * 2 % 4 / 2) carry guaranteed 2 marks. To solve them without mistakes, you must memorize operator priority and associativity direction.

Complete Operator Precedence Table

PriorityCategoryOperatorsAssociativity
1 (Highest)Postfix() [] -> . ++ (post) -- (post)Left to Right
2Unary+ - ! ~ ++ (pre) -- (pre) (type) * & sizeofRight to Left
3Multiplicative* / %Left to Right
4Additive+ -Left to Right
5Bitwise Shift<< >>Left to Right
6Relational< <= > >=Left to Right
7Equality== !=Left to Right
8Bitwise AND&Left to Right
9Bitwise XOR^Left to Right
10Bitwise OR``Left to Right
11Logical AND&&Left to Right
12Logical OR``Left to Right
13Ternary?:Right to Left
14Assignment= += -= *= /= %= &= ^= `= <<= >>=`Right to Left
15 (Lowest)Comma,Left to Right

---

4. Decision Making Control Structures

Decision control statements dictate which code branch executes depending on boolean evaluations (1 for true, 0 for false).

1. The if-else Ladder

Evaluates conditions sequentially from top to bottom. Once a condition succeeds, its block executes and the remaining ladder is skipped.

2. The Dangling else Problem

When nested if statements lack explicit curly braces { }, an else automatically binds to the closest un-matched preceding `if`.

c

---

5. The switch-case Statement Rules

A switch statement provides multi-way branching based on integral equality matching.

Mandatory Rules for MAKAUT Exams:

  1. Integral Expression Only: The condition inside switch(expr) must evaluate to int, char, or enum. float or double are invalid.
  2. Constant Case Labels: case 10: or case 'A': are valid. Variable labels like case x: cause compile errors.
  3. Fallthrough Behavior: Omitting break; causes execution to fall through into all lower case blocks regardless of condition match.

---

6. Solved MAKAUT Exam Programs

Here are core Unit 1 programs frequently asked in MAKAUT semester papers (Programs 1 to 41 from unit_1_basics_operators_control_flow).

Program 1: Swapping 2 Variables (Without 3rd Variable)

*Exam Context: Group B (5 Marks)*

c

---

Program 2: Leap Year Verification with Nested Logic

*Exam Context: Group B (5 Marks)*

c

---

Program 3: Roots of a Quadratic Equation (ax^2 + bx + c = 0)

*Exam Context: Group C (15 Marks)*

c

---

Program 4: Official MAKAUT Grading System Implementation

*Exam Context: Group B (5 Marks)*

c

---

Program 5: Electricity Bill Generator (Slab Based)

*Exam Context: Group B / Group C (10 Marks)*

c

---

7. Exam Day Checklist for Unit 1

  1. Always verify header files (<stdio.h>, <math.h>). When using <math.h> in Linux/GCC labs, compile with -lm flag: gcc program.c -lm.
  2. Draw clean flowcharts for quadratic equations and switch statements in Group C questions.
  3. Clearly mention format specifiers (%d, %f, %lf, %c) when writing code answers on exam answer sheets.