SYLLABUS NOTES
SECTION A
Q1) Block diagram of Computer, Associated peripherals?
Ans) A computer system consists of different components that work together to process data and
produce useful information. The main parts are Input Unit, Central Processing Unit (CPU),
Memory Unit, and Output Unit. These components are connected through a system that allows
the computer to receive data, process it, store it, and produce results.2. Sources of Law
Components of a Computer System
1. Input Unit
The input unit receives data and instructions from the user and converts them into a form that the
computer can process.
Examples of Input Devices:
• Keyboard
• Mouse
• Scanner
• Microphone
• Webcam
2. Central Processing Unit (CPU)
The CPU is known as the brain of the computer because it performs calculations and controls
all operations.
It has two main parts:
• Arithmetic Logic Unit (ALU): Performs mathematical calculations and logical
operations.
• Control Unit (CU): Directs and coordinates the activities of all components of the
computer.
3. Memory Unit
The memory unit stores data, instructions, and results. It is divided into two main types:
• Primary Memory: RAM and ROM used for temporary storage.
• Secondary Memory: Hard disk, SSD, pen drive, etc., used for permanent storage.
4. Output Unit
The output unit displays or produces the processed information for the user.
Examples of Output Devices:
• Monitor
• Printer
• Speaker
• Projector
Associated Peripherals
Peripherals are external devices connected to the computer to expand its functionality. They help
in input, output, and storage of data.
Input Peripherals
• Keyboard
• Mouse
• Scanner
• Webcam
Output Peripherals
• Monitor
• Printer
• Speaker
• Plotter
Storage Peripherals
• External Hard Drive
• USB Flash Drive
• Memory Card
Q2) Memories – RAM, ROM, Secondary Storage Devices.
Ans) Memory in a computer refers to the components used to store data, instructions, and
information. It allows the computer to store programs and process information efficiently.
Computer memory is mainly divided into Primary Memory and Secondary Storage Devices.
1. RAM (Random Access Memory)
Random Access Memory (RAM) is the main working memory of the computer. It temporarily
stores data and instructions that are currently being used by the CPU.
Features of RAM
• It is temporary (volatile) memory, meaning the data is lost when the computer is switched
off.
• It allows fast reading and writing of data.
• It helps the computer run programs and perform tasks quickly.
Examples of Use
• Running software applications
• Editing documents
• Processing calculations
2. ROM (Read Only Memory)
Read Only Memory (ROM) is a type of memory that stores permanent instructions required for
starting and operating the computer.
Features of ROM
• It is non-volatile memory, meaning the data remains even when the computer is turned
off.
• It stores important programs such as the booting instructions of the computer.
• Data in ROM cannot be easily modified.
Types of ROM
• PROM (Programmable ROM)
• EPROM (Erasable Programmable ROM)
• EEPROM (Electrically Erasable Programmable ROM)
3. Secondary Storage Devices
Secondary storage devices are used to store large amounts of data permanently. Unlike RAM,
they retain data even when the computer is turned off.
Features
• Permanent storage of data
• Large storage capacity
• Slower than primary memory but more economical
Examples of Secondary Storage Devices
• Hard Disk Drive (HDD)
• Solid State Drive (SSD)
• USB Flash Drive (Pen Drive)
• CD / DVD
• Memory Cards
Difference Between RAM, ROM, and Secondary Storage
Feature RAM ROM Secondary Storage
Type Primary Memory Primary Memory Secondary Memory
Nature Volatile Non-volatile Non-volatile
Temporary storage for running Stores permanent Long-term storage of
Function
programs instructions data
Speed Very fast Fast Slower than RAM
Q3) Classification of Computers and Languages.
Ans) Computers can be classified based on their working principle, size, and purpose. Programming
languages are used to communicate with computers and give instructions for performing tasks.
1. Classification of Computers
a) Based on Working Principle
1. Analog Computers
Analog computers process continuous data such as temperature, speed, and pressure. They are
mainly used in scientific and engineering applications.
Examples:
• Weather forecasting systems
• Speedometers
2. Digital Computers
Digital computers process discrete data (numbers and symbols). They perform calculations
using binary numbers (0 and 1). Most modern computers are digital computers.
Examples:
• Personal computers
• Laptops
• Smartphones
3. Hybrid Computers
Hybrid computers combine the features of analogy and digital computers. They are used where
both continuous and discrete data processing is required.
Examples:
• Medical monitoring machines
• Scientific research systems
b) Based on Size and Capacity
1. Microcomputers
These are small computers designed for individual use.
Examples:
• Desktop computers
• Laptops
• Tablets
2. Minicomputers
Minicomputers are medium-sized computers used by small organizations or departments for
processing data.
3. Mainframe Computers
Mainframe computers are large and powerful computers used by large organizations for handling
huge amounts of data.
Examples:
• Banking systems
• Airline reservation systems
4. Supercomputers
Supercomputers are the most powerful computers with extremely high processing speed. They
are used for complex scientific calculations.
Examples:
• Weather prediction
• Space research
2. Classification of Programming Languages
Programming languages are used to write instructions that a computer can understand.
a) Machine Language
Machine language is the lowest level language, consisting of binary numbers (0 and 1). It is
directly understood by the computer but is difficult for humans to write.
b) Assembly Language
Assembly language uses short codes called mnemonics instead of binary numbers. It is easier
than machine language but still close to hardware.
Example instructions:
• ADD
• SUB
• MOV
c) High-Level Languages
High-level languages are easier for humans to understand and write. They use simple English-
like words and require a compiler or interpreter to convert them into machine language.
Examples:
• C
• C++
• Java
• Python
Q3.1) Introduction to Compilers, Interpreter and Assemblers.
Ans) In computer programming, programs written in high-level or assembly languages cannot be
directly understood by the computer. Therefore, special software called language translators is used
to convert these programs into machine language (binary code) that the computer can execute. The
main types of language translators are compiler, interpreter, and assembler.
1. Compiler
A compiler is a program that translates the entire source code of a high-level language
program into machine code at once before execution.
Features of a Compiler
• Converts the whole program into machine language in a single process.
• Detects and displays errors after compiling the complete program.
• Produces an object code or executable file.
• Execution of compiled programs is usually faster.
Examples of Languages Using Compilers
• C
• C++
• Java
2. Interpreter
An interpreter is a program that translates and executes the source code line by line.
Features of an Interpreter
• Translates one instruction at a time.
• Stops immediately when an error is found.
• Does not produce a separate object code.
• Execution is generally slower than compiled programs.
Examples of Languages Using Interpreters
• Python
• JavaScript
3. Assembler
An assembler is a program that converts assembly language instructions into machine
language.
Features of an Assembler
• Translates mnemonic codes (like ADD, MOV) into binary instructions.
• Produces machine code that the computer can execute.
• Mainly used in low-level programming and hardware-related applications.
Difference Between Compiler, Interpreter and Assembler
Feature Compiler Interpreter Assembler
High-level
Language Used High-level language Assembly language
language
Feature Compiler Interpreter Assembler
Translation Whole program at Converts assembly to
Line by line
Method once machine code
Slower
Speed Faster execution Fast
execution
Object/executable
Output No separate file Machine code
file
Q3.2) Introduction of various operating system with their file system.
Ans) An Operating System (OS) is system software that manages computer hardware and software
resources. It acts as an interface between the user and the computer hardware and controls tasks
such as memory management, file management, and device control.
Each operating system uses a file system, which is a method for organizing, storing, and
retrieving data on storage devices like hard disks or SSDs.
1. Microsoft Windows
Microsoft Windows is one of the most widely used operating systems for personal
computers. It provides a graphical user interface (GUI) that makes it easy for users to operate
computers.
Features
• User-friendly interface
• Multitasking capability
• Wide software support
File System
Windows mainly uses the NTFS (New Technology File System).
Older versions used FAT (File Allocation Table) and FAT32.
Advantages of NTFS
• Better security
• Supports large files and disks
• File compression and encryption
2. Linux
Linux is an open-source operating system widely used for servers, computers, and embedded
systems. It is known for stability and security.
Features
• Open-source and free
• Highly secure and stable
• Used in servers and supercomputers
File System
Linux uses several file systems, such as:
• ext2
• ext3
• ext4
Among these, ext4 is the most commonly used modern Linux file system.
3. macOS
macOS is an operating system developed by Apple for Macintosh computers.
Features
• Smooth graphical interface
• High security and performance
• Integration with Apple devices
File System
macOS uses:
• APFS (Apple File System) – modern file system
• Earlier versions used HFS+ (Hierarchical File System Plus)
4. Android
Android is a mobile operating system mainly used in smartphones and tablets.
Features
• Open-source platform
• Supports a wide range of mobile applications
• Customizable interface
File System
Android generally uses:
• ext4 file system
• Some devices also support F2FS (Flash-Friendly File System) for better performance
on flash storage.
5. UNIX
UNIX is one of the earliest multitasking operating systems used mainly in servers and
workstations.
Features
• Multiuser capability
• High reliability
• Strong security
File System
UNIX uses the UFS (Unix File System) and other variations depending on the system.
SECTION B
Q1) Algorithm and Flowchart.
Ans) 1. Algorithm
An algorithm is a step-by-step procedure or set of instructions used to solve a problem or
perform a specific task. It describes the logical sequence of steps that a computer follows to
produce the desired result.
Algorithms are written in simple language or pseudocode so that they are easy to understand
before implementing them in a programming language.
Characteristics of an Algorithm
• Clear and unambiguous: Each step should be easy to understand.
• Finite: It must end after a certain number of steps.
• Input: It can take zero or more inputs.
• Output: It should produce at least one result.
• Effective: Each step should be simple and feasible.
Example Algorithm (To Add Two Numbers)
1. Start
2. Input two numbers A and B
3. Add A and B
4. Store the result in C
5. Display C
6. Stop
2. Flowchart
A flowchart is a diagrammatic representation of an algorithm. It uses symbols and arrows to
show the sequence of steps involved in solving a problem.
Flowcharts help programmers understand the logic of a program visually before writing the
actual code.
Common Flowchart Symbols
Symbol Meaning
Oval Start / End
Rectangle Process or instruction
Parallelogram Input / Output
Diamond Decision making
Arrow Flow of steps
Q2) Introduction to Python and Setting up the Python development environment.
Ans) Introduction to Python
Python is a high-level, general-purpose programming language known for its simple syntax and
easy readability. It was created by Guido van Rossum and first released in 1991.
Python is widely used in many fields such as software development, data analysis, artificial
intelligence, web development, and scientific computing. Because of its simplicity, Python is one
of the most popular languages for beginners.
Features of Python
• Easy to learn and read due to simple syntax
• High-level language (close to human language)
• Interpreted language (executed line by line)
• Portable – can run on different operating systems
• Large standard library with many built-in functions
Applications of Python
• Web development
• Data science and machine learning
• Automation and scripting
• Game development
• Scientific research
2. Setting Up the Python Development Environment
To start programming in Python, we need to install the Python software and set up a
development environment.
Step 1: Download Python
1. Go to the official Python website:
[Link]
2. Download the latest version of Python suitable for your operating system (Windows,
macOS, or Linux).
Step 2: Install Python
1. Run the downloaded installer.
2. Select “Add Python to PATH” during installation.
3. Click Install Now to complete the installation.
Step 3: Verify Installation
After installation, open the Command Prompt or Terminal and type:
python --version
If Python is installed correctly, the system will display the installed version of Python.
Step 4: Using Python IDLE
Python provides a simple development environment called Python IDLE (Integrated
Development and Learning Environment).
Features of IDLE:
• Write and run Python programs
• Syntax highlighting
• Simple debugging tools
To open IDLE:
• Go to Start Menu → Python → IDLE
Q3) Basic syntax, interactive shell, editing, saving, and running a script, Concept of data
types.
Ans) Basic Syntax of Python
Python has a simple and easy-to-read syntax, which makes it suitable for beginners.
Important Features of Python Syntax
• Python uses indentation (spaces) to define blocks of code instead of brackets.
• Statements are usually written one per line.
• It is case-sensitive, meaning Name and name are treated as different variables.
Example
print ("Hello World")
This program prints Hello World on the screen.
2. Interactive Shell
The interactive shell allows users to run Python commands directly and immediately without
saving them in a file. It is useful for testing small pieces of code.
To start the Python shell:
1. Open Command Prompt or Terminal.
2. Type:
python
You will see the >>> prompt, where you can type Python commands.
Example:
>>> 5 + 3
8
The result is displayed instantly.
3. Editing, Saving, and Running a Script
A Python script is a file that contains Python code and is saved with the. pie extension.
Editing a Script
Programs can be written using editors such as Python IDLE, Notepad, or other code editors.
Example program:
name = "John"
print ("Hello", name)
Saving the Script
1. Click File → Save.
2. Save the file with the extension. pie (Example: [Link]).
Running the Script
The program can be executed in two ways:
1. Using IDLE
• Click Run → Run Module.
2. Using Command Prompt
python [Link]
The program will run and display the output.
4. Concept of Data Types
A data type defines the type of data that a variable can store. In Python, data types help the
interpreter understand how to process the data.
Common Data Types in Python
Data Type Description Example
Integer (int) Whole numbers 10, 25
Float Decimal numbers 3.14, 2.5
String (str) Text or characters "Hello"
Boolean (bool) True or False values True, False
List Ordered collection of items [1,2,3]
Tuple Immutable ordered collection (1,2,3)
Dictionary Collection of key-value pairs {"name”: “John"}
Q4) Random number, Real numbers, immutable variables, Python console Input / Output.
Ans) Random Numbers in Python
In Python, random numbers are used when we need unpredictable values, such as in games,
simulations, or sampling. Python provides a built-in module called random to generate random
numbers.
Example
import random
num = [Link](1,10)
print(num)
This program generates a random integer between 1 and 10.
Common functions in the random module:
• random() – generates a random decimal number between 0 and 1
• randint(a, b) – generates a random integer between a and b
• choice() – selects a random item from a list
2. Real Numbers
Real numbers in Python are represented using the float data type. These numbers contain
decimal points.
Examples of real numbers:
• 3.5
• 10.25
• 0.75
Example
price = 25.75
temperature = 36.6
print(price)
These values are stored as floating-point numbers (float).
3. Immutable Variables
An immutable variable is a variable whose value cannot be changed after it is created. If a
change is needed, Python creates a new object instead of modifying the existing one.
In Python, some immutable data types include:
• Integers (int)
• Floating numbers (float)
• Strings (str)
• Tuples (tuple)
Example
x = 10
x=x+5
print(x)
Here Python actually creates a new value for x rather than modifying the original object.
4. Python Console Input
Python allows users to enter data from the keyboard using the input() function.
Example
name = input("Enter your name: ")
print("Hello", name)
The program asks the user to enter a name and then displays a greeting message.
5. Python Console Output
The print() function is used to display output on the screen.
Example
age = 20
print("Age is:", age)
This command prints the value stored in the variable.
Q5) Arithmetic operators and expressions, Conditions.
Ans) Arithmetic Operators
In Python, arithmetic operators are used to perform mathematical calculations such as
addition, subtraction, multiplication, and division.
Types of Arithmetic Operators
Operator Meaning Example
+ Addition a+b
- Subtraction a-b
* Multiplication a*b
Operator Meaning Example
/ Division a/b
% Modulus (remainder) a % b
** Exponent (power) a ** b
// Floor division a // b
Arithmetic Expressions
An arithmetic expression is a combination of numbers, variables, and arithmetic operators
that produces a value.
Example
x=5
y=2
z = x * y + 10
print(z)
Here the expression x * y + 10 is evaluated to produce the result.
Order of Operations
Python follows the BODMAS rule (Brackets, Orders, Division and Multiplication, Addition and
Subtraction).
conditions
Conditions are used in programming to make decisions based on certain situations. Python
uses conditional statements to check whether a condition is true or false.
The main conditional statements in Python are:
• if
• if-else
• if-elif-else
4. If Statement
The if statement executes a block of code only when the condition is true.
Example:
age = 18
if age >= 18:
print("You are eligible to vote")
5. If-Else Statement
The if-else statement executes one block if the condition is true and another block if it is false.
Example:
num = 5
if num % 2 == 0:
print("Even Number")
else:
print("Odd Number")
6. If-Elif-Else Statement
This is used when multiple conditions need to be checked.
Example:
marks = 75
if marks >= 90:
print("Grade A")
elif marks >= 60:
print("Grade B")
else:
print("Grade C")
Q5) Comparison operators, Logical Operators, Is and in operators, Control statements: if-
else, Nested If-Else, Loops (for, while).
Ans) Comparison Operators
Comparison operators are used to compare two values. The result of a comparison is always
True or False.
Operator Meaning Example
== Equal to a == b
!= Not equal to a != b
> Greater than a>b
< Less than a<b
>= Greater than or equal to a >= b
<= Less than or equal to a <= b
Example
a = 10
b=5
print(a > b)
print(a == b)
2. Logical Operators
Logical operators are used to combine multiple conditions.
Operator Meaning
and True if both conditions are true
or True if at least one condition is true
not Reverses the result
Example
age = 20
print(age > 18 and age < 25)
3. is Operator
The is operator is used to check whether two variables refer to the same object in memory.
Example
a = 10
b = 10
print(a is b)
If both variables refer to the same object, the result will be True.
4. in Operator
The in operator is used to check whether a value exists in a sequence such as a list, string, or
tuple.
Example
numbers = [1,2,3,4,5]
print(3 in numbers)
If the value exists in the list, the result will be True.
5. Control Statements
Control statements determine the flow of execution of a program.
(a) If–Else Statement
The if–else statement is used for decision making.
Example
num = 10
if num > 0:
print("Positive number")
else:
print("Negative number")
(b) Nested If–Else
A nested if–else statement means an if statement inside another if statement.
Example
num = 10
if num >= 0:
if num == 0:
print("Zero")
else:
print("Positive")
else:
print("Negative")
6. Loops
Loops are used to repeat a set of instructions multiple times.
(a) For Loop
A for loop is used to iterate over a sequence such as a list, string, or range.
Example
for i in range(1,6):
print(i)
Output:
1
2
3
4
5
(b) While Loop
A while loop repeats a block of code as long as the condition is true.
Example
i=1
while i <= 5:
print(i)
i += 1
SECTION C
Q1) Built in function and modules in python, user defined functions, passing parameters,
arguments and return values.
Ans) Functions are very important in Python programming. They help to reduce repeated code and
make programs easy to understand. Python provides built-in functions and modules, and
programmers can also create their own functions called user-defined functions.
1. Built-in Functions in Python
Built-in functions are functions already available in Python. We can use them directly without
writing their code.
Examples of Built-in Functions
Function Use:
print() Displays output
input() Takes input from user
len() Finds length
type() Shows data type
sum() Adds values
max() Finds largest value
Example:
Input-
Name= “Python”
Print(len(name))
Output- 6 (len() is a built-in function that counts the number of characters.)
Modules in Python
A module is a file containing functions and programs that can be reused. Python has many built-
in modules.
Common Modules
Module Use
math Mathematical operations
random Generates random numbers
datetime Works with date and time
Example: input-
import math
print([Link](25))
Output
5.0
The math module is imported and sqrt() function is used to find square root.
3. User-Defined Functions
Functions created by the programmer are called user-defined functions.
Example: input-
def greet():
print(“Welcome to Python”)
output: Welcome to Python
greet() is a user-defined function created using def keyword.
Passing Parameters and Arguments:
Parameters are variables written in function definition.
Arguments are values passed during function call.
Example: input
def add(a,b):
print(a+b)
add(5,3)
output- 8
a and b are parameters, 5 and 3 are arguments.
Return Values
A function can send back a result using return statement.
Square(num):
Result= square(4)
print(result)
Output- 16
The function returns the square of the number.
Advantages of Functions:
• Reduces code repetition
• Makes program easy to understand
• Improves readability
• Helps in debugging
• Saves time
Q2) Formal vs actual arguments, Recursion, lists, Common List operations
Ans) Python provides many useful features that make programming simple and powerful.
Formal and actual arguments help in passing values to functions. Recursion allows a function to
call itself. Lists are used to store multiple values, and many operations can be performed on lists.
1. Formal and Actual Arguments
Arguments are values passed to functions.
(a) Formal Arguments
Formal arguments are variables written in the function definition. They receive values from
actual arguments.
(b) Actual Arguments
Actual arguments are the real values passed during the function call.
2. Recursion
Recursion is a process where a function calls itself again and again until a condition becomes
false.
The function repeatedly calls itself to calculate factorial.
5! = 5 × 4 × 3 × 2 × 1
Advantages of Recursion
• Makes code shorter
• Useful for mathematical problems
• Easy to solve complex problems
3. Lists in Python
A list is a collection of items stored in square brackets [ ].
Lists can store:
• Numbers
• Strings
• Different data types
Features of Lists
• Ordered collection
• Mutable (can be changed)
• Allows duplicate values
• Can store multiple data types
Applications of Lists
• Storing student records
• Managing data collections
• Performing calculations
• Data analysis
SECTION-D
Q1) Creating and reading a formatted file (csv or tab-separated).
Ans) Introduction
Formatted files are used to store data in an organized way. Python allows us to create and read
files such as CSV (Comma Separated Values) and tab-separated files. These files are commonly
used for storing tables, records, and spreadsheet data.
1. CSV File in Python
A CSV file stores data separated by commas.
Example of CSV Data
Name, Age, City
Rahul,21, Delhi
Aman,22, Mumbai
2. Creating a CSV File
Python provides the csv module to work with CSV files.
Example Program
import csv
data = [
["Name", "Age", "City"],
["Rahul", 21, "Delhi"],
["Aman", 22, "Mumbai"]
]
with open ("[Link]", "w", newline="") as file:
writer = swifter(file)
writer. write rows(data)
print ("CSV file created")
Output
CSV file created
Explanation
• swifter () is used to write data.
• write rows () writes multiple rows into the file.
3. Reading a CSV File
Example Program
import csv
with open ("[Link]", "r") as file:
reader = screamer(file)
for row in reader:
print(row)
Output
['Name', 'Age', 'City']
['Rahul', '21', 'Delhi']
['Aman', '22', 'Mumbai']
Explanation
• screamer () reads the file.
• Each row is displayed as a list.
. Tab-Separated File
A tab-separated file stores data separated by tabs (\t).
Example Data
Name Age City
Rahul 21 Delhi
Aman 22 Mumbai
5. Creating a Tab-Separated File
Example Program
with open ("[Link]", "w") as file:
file. Write("Name\Tage\city\n")
file. Write("Rahul\t21\Delhi\n")
file. Write("Aman\t22\tumbao\n")
print ("Tab-separated file created")
Output
Tab-separated file created
Explanation
\t is used to create tab spaces between values.
6. Reading a Tab-Separated File
Example Program
with open ("[Link]", "r") as file:
for line in file:
print(line)
Output
Name Age City
Rahul 21 Delhi
Aman 22 Mumbai
Advantages of Formatted Files
• Easy to store large data
• Useful for spreadsheets and databases
• Simple data sharing between programs
• Easy to read and modify
Applications
• Student records
• Employee databases
• Survey data
• Data analysis