BEU Programming for Problem Solving (PPS) Notes: Unit 1 – Introduction to Problem Solving
Course Code: 100111 Beu pps notes pdf
Semester: 1st
Applicable For: CSE, AI, ML, Data Science, IoT, Cyber Security, IT, EEE, ECE, EE
University: Bihar Engineering University (BEU), Patna
Syllabus Session: 2024–2025 & 2025-2026
Unit: 1.0 – Introduction to Programming (Total Hours: 6 hrs)
Welcome, future programmers! This is the first step in your journey to master problem-solving through code. Unit 1 of BEU’s Programming for Problem Solving (PPS) lays the essential foundation. It’s not just about writing code; it’s about learning how to think logically and structure your solutions before you even touch a keyboard.
Understanding this unit is crucial because everything you learn in subsequent units—from C syntax to complex data structures—builds upon these fundamental concepts. Let’s break it down into digestible parts.
Overview of Unit 1: Why Introduction to Programming Matters
Programming is the heart of Computer Science and Engineering. This unit lays the foundation for how computers solve real-world problems using step-by-step logic. From understanding how a computer stores and runs programs to writing your first algorithm and converting it to code — this unit sets the stage for all future development in C, Python, Java, and beyond.
1. Components of a Computer System (Beu pps notes pdf)
Before writing a single line of code, it’s important to understand where a program runs and how it’s processed. The core components of any computer system include:

a. Hardware Components:
- Input Unit: Devices like keyboard, mouse, or scanner that feed data and commands into the computer.
- Output Unit: Devices like monitors, printers, or speakers that present the results of processed data.
- Central Processing Unit (CPU): The “brain” of the computer. It has two main parts:
- Arithmetic Logic Unit (ALU): Performs all mathematical calculations (+, -, *, /) and logical comparisons (>, <, ==).
- Control Unit (CU): Directs the operation of all other components. It fetches instructions from memory, decodes them, and executes them.
- Memory Unit: This is where data and instructions are stored.
- Primary Memory (RAM): Fast, volatile memory used to hold the program and data currently being executed. It is erased when the computer is turned off.
- Secondary Memory (HDD/SSD): Permanent, non-volatile storage (like your hard drive) used to store programs and data long-term.

b. Software Components:
- Operating System (OS): Interface between hardware and user (Windows, Linux, etc.)
- Compilers: Convert source code into machine-readable code.
- Interpreters: Execute code line-by-line (used in Python, not C).
- Assemblers: Convert assembly language to machine language.
Important Concept:
When you write a program in C:
- It gets stored in the hard disk (as a
.c
file), - Loaded into RAM when running,
- Executed by the CPU after being compiled to machine code.
2. Understanding Algorithms
What is an Algorithm?
An algorithm is a finite, step-by-step, unambiguous sequence of instructions to solve a given problem. It’s like a recipe for a cook. A good algorithm must be:
- Clear and Unambiguous: Each step must be precise.
- Well-Defined Inputs: It can have zero or more inputs.
- Well-Defined Outputs: It must produce at least one output.
- Finiteness: It must terminate after a finite number of steps.
- Feasible: It must be simple enough to be done with a pencil and paper.
Example: Algorithm to make Maggi noodles.
- Start.
- Boil a cup of water in a pan.
- Add Maggi tastemaker to the water.
- Break the Maggi cake and add it to the pan.
- Cook for 2 minutes.
- Serve it in a bowl.
- Stop.
Example: Algorithm to find the largest of 3 numbers
- Start
- Read numbers A, B, C
- If A > B and A > C → A is the largest
- Else if B > A and B > C → B is the largest
- Else → C is the largest
- End
3. Flowchart Representation
A flowchart is a visual representation of an algorithm using diagrams and symbols. It helps beginners visualize the control flow of a program.
Basic Flowchart Symbols:
Symbol | Meaning |
---|---|
Oval | Start / End |
Rectangle | Process / Action |
Diamond | Decision |
Arrow | Flow Direction |
Example: Flowchart to Check Even or Odd

4. Pseudocode (Simple English Logic)
Pseudocode bridges the gap between algorithm and programming language. It uses plain English to describe logic before coding. Pseudocode is a high-level, informal description of an algorithm that uses the structural conventions of a programming language but is intended for human reading. It’s a mix of natural language and programming constructs. It’s often easier and faster to write than a flowchart.
Key Constructs in Pseudocode:
- Sequence: Steps are executed one after another.textCopyDownloadREAD A READ B SET sum = A + B PRINT sum
- Selection (IF-THEN-ELSE): For decision making.textCopyDownloadIF temperature > 30 THEN PRINT “It’s hot outside.” ELSE PRINT “The weather is pleasant.” ENDIF
- Iteration (WHILE, FOR): For loops.textCopyDownloadSET counter = 1 WHILE counter <= 5 DO PRINT counter counter = counter + 1 ENDWHILE
Example: Pseudocode to Print First N Natural Numbers
Input N
Set i = 1
While i <= N
Print i
i = i + 1
End While
End
You can later convert this pseudocode into a C program using loops.
Coming Up in Part 2:
- From Algorithm to Program: The Journey
- Variables, Data Types & Memory Locations
- Understanding Syntax vs Logical Errors
- Compiling C Code: From Source to Executable
This section deeply explains how an algorithm turns into a program, and dives into core programming concepts like variables, data types, memory locations, and errors.
5. From Algorithm to Program: The Complete Journey
Once you understand how to write an algorithm and represent it using flowcharts or pseudocode, the next step is to translate that logic into a computer program using a programming language like C.
But how does this translation happen?
Let’s break the journey into clear steps:
a. Step 1: Write the Source Code
The first thing a programmer does is write the source code. This is the human-readable form of the program written in a programming language (e.g., C, Python, Java).
In C, the source code file has an extension .c
.
Example:
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}
This is your source code.
b. Step 2: Compile the Source Code
Once the code is written, it needs to be converted into machine code (0s and 1s) so that the computer can understand and execute it.
This process is done using a compiler.
The compiler:
- Translates
.c
files into.obj
(object files), - Then links them into an executable file (e.g.,
.exe
in Windows or an out file in Linux).
c. Step 3: Generate Object Code and Executable
The compiler produces:
- Object code: Machine-level instructions but not complete
- Executable code: Fully working machine code
So, your flow is:
Source Code (.c
) → Object Code (.obj
) → Executable Code (.exe
)
d. Step 4: Store and Run the Program
When the program is executed:
- The OS loads the executable into RAM
- The CPU reads and executes instructions
- Output is displayed on the screen (if programmed)
6. Variables and Data Types in Programming
In programming, a variable is like a labeled box in memory used to store data. The data type of a variable defines what type of data it can store, how much memory it uses, and what operations can be performed on it.
Let’s understand in depth:
a. What is a Variable?
A variable:
- Has a name (identifier),
- Stores a value in a memory location,
- Has a data type.
Example in C:
int age = 20;
Here:
int
→ data typeage
→ variable name20
→ value stored
b. Memory Allocation
Each data type takes a specific amount of memory:
Data Type | Meaning | Size (approx) |
---|---|---|
int | Integer values | 4 bytes |
float | Decimal values | 4 bytes |
char | Single letter | 1 byte |
double | Long decimal | 8 bytes |
When you write int x = 5;
, the compiler reserves 4 bytes in RAM and labels it x
.
c. Rules for Naming Variables
- Must begin with a letter (A–Z or a–z) or underscore
_
- Cannot use special symbols like
@
,#
,%
, etc. - Cannot be a keyword like
int
,while
,return
- Should be meaningful (e.g.,
totalMarks
is better thant1
)
d. Examples of Declaring Variables
int age;
float height;
char grade;
double pi = 3.14159;
7. Syntax Errors vs Logical Errors
Programmers often encounter two major types of errors when writing code:
a. Syntax Errors
These are grammatical mistakes in your code, just like grammar errors in English.
They are caught during compilation.
Examples:
- Missing semicolon
- Using undeclared variable
- Incorrect brackets
Example Code with Syntax Error:
int main() {
printf("Hello World")
return 0;
}
Error: Missing semicolon after printf()
line.
b. Logical Errors
These errors occur when your program compiles and runs, but it doesn’t give the correct output due to flawed logic.
The program runs, but it’s wrong.
Example:
int a = 10, b = 5;
printf("Sum = %d", a - b);
The output will be 5, but you intended to add, not subtract. This is a logical error.
c. How to Identify and Fix Errors?
Error Type | Detected When? | Fixed By |
---|---|---|
Syntax Error | During compilation | Compiler error log |
Logical Error | During execution | Manual debugging |
Modern IDEs and tools like Code::Blocks, Visual Studio Code, or OnlineGDB help highlight both errors for easy debugging.
d. Best Practices to Avoid Errors
- Write code step by step and compile frequently.
- Use comments to explain logic.
- Practice writing flowcharts before coding.
- Dry run your code on paper to check logic.
Coming Up in Part 3:
- What is a Compiler, Linker, Loader (and how they work)?
- How Programs are Executed in Memory
- Recap Table: All Concepts of Unit 1
- Practice Questions and Mini Assignments
This part dives deeper into compilation stages, how programs are loaded and executed in memory, and gives a full recap of all concepts for better understanding and exam preparation.
8. Compilation Process: Compiler, Linker, and Loader Explained
When you write a C program, it does not directly run on the computer. Instead, it goes through a series of steps before you see the output.
Let’s understand the Compilation and Execution Process step by step:
Step 1: Writing the Source Code
- You write code in a
.c
file using a text editor or IDE. - Example:
int main() {
printf("Hello BEU!");
return 0;
}
Step 2: Compilation (Using Compiler)
- The compiler reads your
.c
file. - If there are no syntax errors, it converts it into object code (
.obj
or.o
file). - This code is in machine language, but it’s still incomplete.
Step 3: Linking (Using Linker)
- Programs often use functions from external libraries (like
printf()
from stdio.h). - The linker connects your object code with these library files.
- The result is a complete executable file (
.exe
ora.out
).
Step 4: Loading (Using Loader)
- When you run the program, the loader in the OS loads the executable into RAM.
- It assigns memory addresses to variables, functions, etc.
Step 5: Execution (By CPU)
- The CPU reads the loaded code from RAM.
- Executes it line by line, performs calculations, and displays output (if any).
Visual Summary:

9. Program Execution in Memory
When a program runs, it occupies various parts of memory.
Memory Segments:
Segment | Purpose |
---|---|
Code Segment | Stores the compiled machine code |
Data Segment | Stores global/static variables |
Stack Segment | Stores function calls, local variables |
Heap Segment | For dynamic memory (like malloc() ) |
What Happens to a Variable?
When you declare:
int marks = 80;
The compiler:
- Reserves 4 bytes in RAM.
- Assigns a memory address (like
0x7ffe
). - Stores the value
80
at that address.
You can even access this memory using pointers (explained in Unit 4).
10. Recap: Key Concepts from Unit 1
Concept | Summary |
---|---|
Computer System | Hardware (CPU, RAM, Disk) + Software (OS, Compilers) |
Algorithm | Logical step-by-step solution |
Flowchart | Diagrammatic representation of logic |
Pseudocode | English-like logic for program |
Source Code | Human-readable C code |
Compilation Process | Source → Object → Executable |
Variables | Named memory locations |
Data Types | Define kind and size of data |
Syntax Errors | Compile-time grammar issues |
Logical Errors | Wrong logic, runtime issues |
Execution | CPU runs machine code from RAM |
11. Practice Questions (Theory + Coding)
Here are some questions you should try before moving to Unit 2:
Theory Questions:
- What are the components of a computer system?
- Define algorithm. Give one example.
- Draw a flowchart to find the largest of three numbers.
- Differentiate between syntax and logical errors.
- Explain how a C program is compiled and executed.
Coding Practice:
- Write pseudocode and C code to check whether a number is even or odd.
- Create a flowchart to calculate the sum of N natural numbers.
- Write a C program to print “BEU B.Tech 2024”.
Coming Up in Final Part (Part 4):
- Short notes and definitions (for viva + quick revision)
- Unit 1 MCQs (for internal/semester exam)
- Free PDF Download
- How Unit 1 connects to future units (loops, arrays, functions)
This part includes short notes for quick revision, MCQs for practice, a PDF download section, and a preview of next units.
12. Short Notes & Definitions for Quick Revision
To make your revision faster, here are the key concepts explained in 1–2 lines:
Term | Definition |
---|---|
Algorithm | A step-by-step logical process to solve a specific problem. |
Flowchart | A graphical representation of the algorithm using standardized symbols. |
Pseudocode | A human-readable, English-like way of representing programming logic. |
Source Code | The actual program written in a high-level language like C. |
Object Code | The compiled version of source code, still incomplete for execution. |
Executable Code | Final machine code file created after linking with libraries. |
Variable | A named memory location used to store data during program execution. |
Data Type | Specifies the kind of data a variable can hold (int, float, char, etc.). |
Syntax Error | Programming rule violation that prevents compilation. |
Logical Error | A mistake in logic; program runs but produces incorrect output. |
Compiler | A tool that converts source code into object code. |
Linker | Combines object code with libraries to generate an executable. |
Loader | Loads the executable into memory so the CPU can run it. |
13. Multiple Choice Questions (MCQs) – Unit 1
These MCQs will help you prepare for BEU internals and semester exams.
- Which of the following is responsible for converting source code into object code?
a) Interpreter
b) Linker
c) Compiler
d) Loader
Answer: c) Compiler - What is a syntax error?
a) An error during program execution
b) A logical mistake
c) A grammatical mistake in code
d) None of the above
Answer: c) A grammatical mistake in code - What does a flowchart use to represent a decision-making step?
a) Rectangle
b) Circle
c) Diamond
d) Triangle
Answer: c) Diamond - Which of the following is not a data type in C?
a) int
b) float
c) string
d) char
Answer: c) string - The variable
int age = 20;
reserves how much memory (approximately)?
a) 2 bytes
b) 4 bytes
c) 8 bytes
d) 1 byte
Answer: b) 4 bytes
14. Download Section
To make learning easier, here are free downloadable resources:
Download PDF:
- Unit 1 Complete Notes – BEU Programming for Problem Solving (PDF)
- Includes definitions, diagrams, examples, MCQs, and flowcharts
Download Practice Pack:
- BEU Programming Unit 1 – Flowcharts + Pseudocode PDF
- 10 solved problems in flowchart + pseudocode form
Note: If links are not yet live, they will be updated soon on www.PrabhakarGuru.com
15. Why Unit 1 Is Important for Future Topics
Unit 1 sets the logical and technical base for the rest of the semester:
Future Unit | How Unit 1 Helps |
---|---|
Unit 2 – Operators and Loops | You’ll use variables, syntax rules, and flowcharts learned here to write loops. |
Unit 3 – Arrays and Strings | Declaring and accessing variables directly relates to array structure. |
Unit 4 – Functions and Recursion | Logical structure and flow of algorithms guide recursive function writing. |
Unit 5 – File Handling | Variables and memory concepts connect to file data structures. |
Unit 6 – Algorithms | The logic-building in Unit 1 directly transfers to writing sorting/searching code. |
Final Thoughts
Unit 1 – “Introduction to Programming” – is more than just a set of definitions. It introduces the thinking patterns and foundational skills you’ll use throughout your B.Tech journey. Whether you’re aiming to become a software developer, a data scientist, or an AI engineer — understanding how programming works at the core will always be your first step.
Make sure to:
- Understand each concept before memorizing
- Practice by drawing your own flowcharts and writing pseudocode
- Start small C programs even if they’re basic