25EN1114 Dayananda Sagar University • Computer Science & Engineering (Semester 2)

C Programming for Problem Solving (CPPS)

💡 DSU Exam Strategy & Guidance

Covers: (1) Flowcharts, Algorithms, and C Operator Precedence (Prefix/Postfix ++/-- expressions); (2) Conditional Branching & Loops (Electricity billing with surcharge, Selection sort algorithm & pass-by-pass tracing, 1D/2D arrays); (3) String & Character Handling built-in functions (strcpy, strcat, strlen, strcmp, strchr, isdigit, toupper); (4) Functions, Call-by-Value vs Call-by-Reference, Recursion, Pointers swapping; (5) Nested Structures vs Unions; (6) Dynamic Memory Allocation (malloc, calloc, realloc, free) & File I/O (file creation, writing characters).

High-Yield Passing Strategy: Master the Selection Sort trace on arbitrary arrays, Electricity Billing slab program with surcharge, Dynamic memory functions table, and Nested Structures for student records.
Most Repeated Question Topics:
Algorithm & Flowchart (Largest of 3 Numbers)Prefix/Postfix Operator Expression EvaluationElectricity Billing Slab Program (with 15% Surcharge)Selection Sort Step-by-Step Array TraceBuilt-in String & Character Handling FunctionsCall-by-Value vs Call-by-Reference & Pointer SwapRecursion Call Stack TracingNested Structures vs Unions DifferencesDynamic Memory: malloc(), calloc(), realloc(), free()File I/O Program (Create & Write to File)

🔥 Most Predictable Exam Questions (4)

Guaranteed Every Year 8 Marks Module 2: Control Structures

Q1. Write an algorithm, draw a flowchart, and develop a complete C program to compute electricity bill charges based on slab rates: 0-100 units @ Rs 1.50/unit, 101-200 units @ Rs 2.00/unit, >200 units @ Rs 3.00/unit, with a minimum charge of Rs 100 and a 15% surcharge if the bill exceeds Rs 400.

Key Points: Show step-by-step slab calculation using if-else if ladder: units <= 100 => bill = units*1.5; units <= 200 => bill = 100*1.5 + (units-100)*2.0; units > 200 => bill = 100*1.5 + 100*2.0 + (units-200)*3.0. Check bill < 100 => bill = 100; check bill > 400 => bill += bill * 0.15.

Guaranteed Every Year 8 Marks Module 3: Arrays & Sorting

Q2. Demonstrate the step-by-step trace of Selection Sort algorithm on the array [64, 25, 12, 22, 11] in ascending order, displaying intermediate array state after each pass.

Key Points: Initial: [64, 25, 12, 22, 11]. Pass 1 (min 11): Swap 64 & 11 => [11, 25, 12, 22, 64]. Pass 2 (min 12): Swap 25 & 12 => [11, 12, 25, 22, 64]. Pass 3 (min 22): Swap 25 & 22 => [11, 12, 22, 25, 64]. Pass 4 (min 25): No swap => [11, 12, 22, 25, 64]. Array sorted in 4 passes.

95% Probability 8 Marks Module 5: Dynamic Memory & Pointers

Q3. Explain Dynamic Memory Allocation in C. Compare malloc(), calloc(), realloc(), and free() with their syntax, return types, and memory layout diagrams.

Key Points: malloc(size): allocates contiguous bytes with garbage values. calloc(n, size): allocates and initializes memory to zero. realloc(ptr, new_size): resizes previously allocated block. free(ptr): deallocates heap block. Return type for allocation functions is (void*).

90% Probability 8 Marks Module 4: Structures & Unions

Q4. Develop a C program using nested structures to store student information (Name, Roll No, Date of Birth {dd, mm, yyyy}, and Marks in 3 subjects). Compute total marks, average, and print grade.

Key Points: Define struct Date { int dd, mm, yyyy; }; struct Student { char name[50]; int rollNo; struct Date dob; float marks[3], total, avg; }; Implement main() with scanf, loop calculation, and printf.

🎓 Open Source Courses & Video Playlists (4)

Harvard University

Harvard CS50x: C Programming & Memory Architecture

Watch Course ↗
YouTube (Jenny’s Lectures)

Jenny’s Lectures: C Programming Full Course

Watch Course ↗
IIT Kharagpur / NPTEL

NPTEL: Problem Solving through Programming in C

Watch Course ↗
freeCodeCamp

freeCodeCamp: C Programming for Beginners

Watch Course ↗

📄 Previous Year Question Papers (2)

END_SEM • 2026 ⏱️ 2h 30m 🎯 80 Marks

End Semester Exam May 2026 (Max Marks: 80, Duration: 2h 30m)

View PDF ↗
MID1 • 2026 ⏱️ 75 Mins 🎯 40 Marks

Mid Semester Exam (CIA-1) March 2026 (Max Marks: 40, Duration: 75m)

View PDF ↗

Turn 25EN1114 Notes into AI Flashcards

Upload your C Programming for Problem Solving (CPPS) lecture slides to generate spaced repetition study cards in seconds.

Start Free →