RBSE Class 12 Informatics Practices (Code 04) Short Notes 2026 | कक्षा 12 सूचना विज्ञान सम्पूर्ण नोट्स

📅 Monday, 16 February 2026 📖 पढ़ रहे हैं...
RBSE Class 12 Informatics Practices (04) Short Notes 2026 | कक्षा 12 सूचना विज्ञान सम्पूर्ण नोट्स — राजस्थान बोर्ड

📊 RBSE Class 12 — सूचना विज्ञान (Informatics Practices)
Code 04 | सम्पूर्ण Short Notes 2026

राजस्थान माध्यमिक शिक्षा बोर्ड | NCERT Based | RBSE Code 04 | Chapter-wise | Hindi-English Bilingual
🐍 Python Pandas 📊 Data Visualization 📈 Matplotlib 🗄️ SQL Queries 🌐 Networking 🔒 Cyber Security

🐍 Python Pandas — Data Handling

NCERT: Informatics Practices | Unit 1 — Data Handling using Pandas
🐍 अध्याय 1: Python Pandas — Series Most Important

🔹 Pandas Library

Pandas Python की एक शक्तिशाली Open-Source library है जो Data Analysis और Data Manipulation के लिए उपयोग होती है। इसे Wes McKinney ने 2008 में विकसित किया। Pandas दो मुख्य Data Structures प्रदान करता है: Series (1D — एक column) और DataFrame (2D — table/spreadsheet)।

import pandas as pd # pd = standard alias import numpy as np # NumPy भी आवश्यक

🔹 Series — One-Dimensional Data

Series एक labeled, one-dimensional array है। इसमें index (label) और values (data) होते हैं। किसी भी data type (int, float, str) के values हो सकते हैं।

# Series बनाने के तरीके # 1. List से s1 = pd.Series([10, 20, 30, 40]) print(s1) # 0 10 # 1 20 ← Default index: 0,1,2,3 # 2 30 # 3 40 # 2. Custom Index के साथ s2 = pd.Series([85, 92, 78], index=['Ram','Sita','Mohan']) print(s2) # Ram 85 # Sita 92 # Mohan 78 # 3. Dictionary से (keys → index, values → data) d = {'Hindi': 85, 'English': 92, 'Maths': 78} s3 = pd.Series(d) # 4. Scalar Value (सभी index पर same value) s4 = pd.Series(5, index=['a','b','c']) # a 5 # b 5 # c 5 # 5. NumPy Array से arr = np.array([10, 20, 30]) s5 = pd.Series(arr)

🔹 Series — Attributes & Accessing

s = pd.Series([10,20,30,40], index=['a','b','c','d']) # Attributes print(s.values) # [10 20 30 40] → NumPy array print(s.index) # Index(['a','b','c','d']) print(s.dtype) # int64 print(s.size) # 4 (कुल elements) print(s.shape) # (4,) print(s.nbytes) # memory bytes print(s.empty) # False print(s.name) # None (name set कर सकते हैं) # Accessing Elements print(s['a']) # 10 (label-based) print(s[0]) # 10 (position-based) print(s['a':'c']) # a=10, b=20, c=30 (label slice → inclusive) print(s[0:2]) # a=10, b=20 (position slice → exclusive) print(s[['a','c']]) # a=10, c=30 (fancy indexing) print(s.head(2)) # पहले 2 elements print(s.tail(2)) # अंतिम 2 elements

🔹 Series — Operations

s = pd.Series([10, 20, 30, 40], index=['a','b','c','d']) # Arithmetic (element-wise) print(s + 5) # 15, 25, 35, 45 print(s * 2) # 20, 40, 60, 80 print(s ** 2) # 100, 400, 900, 1600 # Two Series (index-aligned, NaN if mismatch) s1 = pd.Series([10, 20, 30], index=['a','b','c']) s2 = pd.Series([1, 2, 3], index=['b','c','d']) print(s1 + s2) # a NaN ← 'a' s2 में नहीं # b 21.0 ← 20+1 # c 32.0 ← 30+2 # d NaN ← 'd' s1 में नहीं # Boolean Filtering print(s[s > 20]) # c=30, d=40 print(s[s % 20 == 0]) # b=20, d=40 # Statistical Functions print(s.sum()) # 100 print(s.mean()) # 25.0 print(s.max()) # 40 print(s.min()) # 10 print(s.count()) # 4 (non-NaN count) print(s.std()) # standard deviation print(s.median()) # 25.0 print(s.describe()) # summary statistics
🔑 परीक्षा Tips: Series = 1D labeled array | pd.Series(list/dict/scalar) | Default index: 0,1,2... | s['label'] = label-based | s[0] = position-based | Label slice → inclusive | Position slice → exclusive | NaN → mismatch index | .sum(), .mean(), .max(), .min(), .count(), .describe()
📖 NCERT Reference: Informatics Practices, Chapter 1 — Querying & Data Handling (Pandas Series)
🐍 अध्याय 2: Python Pandas — DataFrame Most Important

🔹 DataFrame — Two-Dimensional Data

DataFrame एक 2D labeled data structure है — rows और columns दोनों में index होता है। एक spreadsheet/table जैसा। प्रत्येक column एक Series है।

# DataFrame बनाने के तरीके # 1. Dictionary of Lists से data = { 'Name': ['Ram', 'Sita', 'Mohan'], 'Marks': [85, 92, 78], 'City': ['Jaipur', 'Jodhpur', 'Udaipur'] } df = pd.DataFrame(data) print(df) # Name Marks City # 0 Ram 85 Jaipur # 1 Sita 92 Jodhpur # 2 Mohan 78 Udaipur # 2. Custom Index df = pd.DataFrame(data, index=['S1','S2','S3']) # 3. List of Dictionaries data2 = [ {'Name':'Ram', 'Marks':85}, {'Name':'Sita', 'Marks':92} ] df2 = pd.DataFrame(data2) # 4. Dictionary of Series s1 = pd.Series(['Ram','Sita'], index=['a','b']) s2 = pd.Series([85, 92], index=['a','b']) df3 = pd.DataFrame({'Name': s1, 'Marks': s2}) # 5. CSV File से (सबसे आम) df = pd.read_csv("students.csv") # CSV में save करना df.to_csv("output.csv", index=False)

🔹 DataFrame — Attributes

print(df.shape) # (3, 3) → (rows, columns) print(df.size) # 9 (total elements) print(df.columns) # Index(['Name','Marks','City']) print(df.index) # RangeIndex(start=0, stop=3) print(df.dtypes) # प्रत्येक column का data type print(df.values) # 2D NumPy array print(df.T) # Transpose (rows↔columns) print(df.empty) # False print(df.ndim) # 2

🔹 Accessing Data — loc & iloc

# Column Access print(df['Name']) # single column → Series print(df[['Name','Marks']]) # multiple columns → DataFrame # Row Access print(df.loc[0]) # label-based row print(df.iloc[0]) # position-based row # loc → Label-based (inclusive) print(df.loc[0:1, 'Name':'Marks']) # rows 0-1, cols Name to Marks # iloc → Position-based (exclusive) print(df.iloc[0:2, 0:2]) # rows 0-1, cols 0-1 # Single Cell print(df.loc[0, 'Name']) # 'Ram' print(df.iloc[0, 0]) # 'Ram' print(df.at[0, 'Name']) # 'Ram' (faster for single cell)
🔑 Key: DataFrame = 2D (Table) | dict of lists → सबसे common | read_csv() → CSV load | to_csv() → save | df['col'] → column | loc → label (inclusive) | iloc → position (exclusive) | .shape → (rows, cols) | .T → transpose | .columns → column names
📖 NCERT Reference: Informatics Practices, Chapter 1 — DataFrame Basics
🐍 अध्याय 3: DataFrame Operations (संक्रियाएँ) Most Important

🔹 Adding / Deleting Columns & Rows

# Column जोड़ना df['Grade'] = ['A', 'A+', 'B'] # new column df['Total'] = df['Marks'] + 10 # computed column # Column हटाना df = df.drop('Grade', axis=1) # axis=1 → column del df['Total'] # alternative # Row जोड़ना (append deprecated → use concat) new_row = pd.DataFrame({'Name':['Geeta'],'Marks':[88],'City':['Kota']}) df = pd.concat([df, new_row], ignore_index=True) # Row हटाना df = df.drop(0, axis=0) # axis=0 → row (by index) df = df.drop([1, 2], axis=0) # multiple rows

🔹 Boolean Indexing / Filtering

# शर्त के आधार पर data निकालना print(df[df['Marks'] > 80]) # marks > 80 print(df[df['City'] == 'Jaipur']) # city = Jaipur print(df[(df['Marks']>80) & (df['City']=='Jaipur')]) # AND print(df[(df['Marks']>90) | (df['City']=='Jodhpur')]) # OR

🔹 Statistical Methods

print(df['Marks'].sum()) # कुल print(df['Marks'].mean()) # औसत print(df['Marks'].max()) # अधिकतम print(df['Marks'].min()) # न्यूनतम print(df['Marks'].median()) # मध्यिका print(df['Marks'].mode()) # बहुलक print(df['Marks'].std()) # मानक विचलन print(df['Marks'].var()) # प्रसरण (variance) print(df['Marks'].count()) # गणना (non-NaN) print(df['Marks'].quantile(0.25)) # Q1 print(df.describe()) # सम्पूर्ण सांख्यिकी सारांश

🔹 Sorting & Other Operations

# Sorting df.sort_values('Marks', ascending=False) # marks descending df.sort_values(['City','Marks']) # multi-column sort df.sort_index() # index से sort # Rename df.rename(columns={'Marks':'Score'}, inplace=True) # Missing Values (NaN) df.isnull() # NaN कहाँ-कहाँ है → True/False df.isnull().sum() # प्रत्येक column में कितने NaN df.dropna() # NaN वाली rows हटाओ df.fillna(0) # NaN को 0 से भरो df.fillna(df.mean()) # NaN को mean से भरो # Iteration for index, row in df.iterrows(): print(index, row['Name'], row['Marks'])

🔹 Pivot Table & GroupBy

# GroupBy — SQL जैसा grouped = df.groupby('City') print(grouped['Marks'].mean()) # city-wise average marks print(grouped['Marks'].sum()) # city-wise total print(grouped.count()) # city-wise count # Pivot Table pd.pivot_table(df, values='Marks', index='City', aggfunc='mean')
🔑 Key: drop(axis=1)→column हटाओ | drop(axis=0)→row हटाओ | df[df['col']>val] → filter | describe()→सम्पूर्ण stats | sort_values()→sort | isnull()→NaN check | dropna()→NaN rows हटाओ | fillna()→NaN भरो | groupby()→group-wise stats | read_csv()/to_csv()→CSV
📖 NCERT Reference: Informatics Practices, Chapter 1 — DataFrame Operations

📊 Data Visualization — Matplotlib

NCERT: Informatics Practices | Unit 2 — Data Visualization
📊 अध्याय 4: Data Visualization Basics (डाटा दृश्यीकरण) Most Important

🔹 Data Visualization क्या है?

डाटा को चित्रात्मक/ग्राफ़िकल रूप (Charts, Graphs, Maps) में प्रदर्शित करना। उद्देश्य: डाटा को समझना आसान, patterns और trends पहचानना, निर्णय लेना। Python में Matplotlib library सबसे लोकप्रिय है।

🔹 Chart Types — कब क्या उपयोग करें?

ChartउपयोगMatplotlib Function
Line Chartसमय के साथ बदलाव (Trends) — तापमान, शेयर बाज़ार, जनसंख्याplt.plot()
Bar Chartश्रेणियों की तुलना — विषयवार अंक, शहरवार जनसंख्याplt.bar() / plt.barh()
HistogramFrequency Distribution — अंकों का वितरण, आयु वर्गplt.hist()
Pie Chartप्रतिशत/अनुपात दिखाना — बजट, मार्केट शेयरplt.pie()

🔹 Matplotlib — Setup

import matplotlib.pyplot as plt # Basic Plot plt.plot([1, 2, 3, 4], [10, 20, 25, 30]) plt.xlabel("X-axis") # X-axis label plt.ylabel("Y-axis") # Y-axis label plt.title("My First Plot") # Title plt.show() # Display
🔑 Key: import matplotlib.pyplot as plt | Line→Trends | Bar→तुलना | Histogram→Frequency | Pie→प्रतिशत | plt.show()→display | plt.xlabel/ylabel/title→labels
📖 NCERT Reference: Informatics Practices, Chapter 2 — Data Visualization
📈 अध्याय 5: Matplotlib — Line, Bar, Histogram Most Important

🔹 Line Chart — plt.plot()

import matplotlib.pyplot as plt # Simple Line Chart months = ['Jan','Feb','Mar','Apr','May'] sales = [100, 150, 130, 180, 200] plt.plot(months, sales, color='blue', marker='o', linestyle='--', linewidth=2, markersize=8, label='Sales 2026') plt.xlabel("Month") plt.ylabel("Sales (₹ Lakhs)") plt.title("Monthly Sales Report") plt.legend() # label दिखाता है plt.grid(True) # grid lines plt.show() # Multiple Lines plt.plot(months, sales, 'b-o', label='2026') plt.plot(months, [80,120,110,160,190], 'r--s', label='2025') plt.legend() plt.show()

🔹 Line Style & Markers

ParameterValues
color'r'(red), 'b'(blue), 'g'(green), 'k'(black), 'y'(yellow), 'm'(magenta), '#FF5733'(hex)
linestyle'-'(solid), '--'(dashed), '-.'(dash-dot), ':'(dotted)
marker'o'(circle), 's'(square), '^'(triangle), 'D'(diamond), '*'(star), '+'(plus)
linewidth1, 2, 3... (मोटाई)

🔹 Bar Chart — plt.bar() / plt.barh()

# Vertical Bar Chart subjects = ['Hindi','English','Maths','Science','SST'] marks = [85, 92, 78, 88, 75] plt.bar(subjects, marks, color=['red','blue','green','orange','purple'], width=0.5, edgecolor='black') plt.xlabel("Subjects") plt.ylabel("Marks") plt.title("Subject-wise Marks") plt.show() # Horizontal Bar Chart plt.barh(subjects, marks, color='skyblue') plt.xlabel("Marks") plt.title("Marks (Horizontal)") plt.show()

🔹 Histogram — plt.hist()

# Histogram — Frequency Distribution marks = [45,55,60,65,70,72,75,78,80,82,85,88,90,92,95] plt.hist(marks, bins=5, color='steelblue', edgecolor='black', alpha=0.7) # bins = कितने groups (bars) बनाने हैं # alpha = transparency (0 to 1) plt.xlabel("Marks Range") plt.ylabel("Frequency (Students)") plt.title("Marks Distribution") plt.show() # bins=[0,40,60,80,100] → custom ranges

Bar Chart vs Histogram: Bar Chart → Categories (discrete) की तुलना, bars के बीच gap। Histogram → Continuous data का frequency distribution, bars सटे हुए (no gap)।

🔑 Key: plt.plot()→Line | plt.bar()→Vertical Bar | plt.barh()→Horizontal | plt.hist()→Histogram | color, marker, linestyle→customization | bins→histogram groups | legend()→label box | grid(True)→grid | Bar = categories (gap) | Histogram = continuous (no gap)
📖 NCERT Reference: Informatics Practices, Chapter 2 — Line, Bar & Histogram Charts
📈 अध्याय 6: Matplotlib — Pie Chart & Customization

🔹 Pie Chart — plt.pie()

# Pie Chart — अनुपात / प्रतिशत subjects = ['Hindi','English','Maths','Science','SST'] marks = [85, 92, 78, 88, 75] plt.pie(marks, labels=subjects, autopct='%1.1f%%', # प्रतिशत दिखाना startangle=90, # शुरुआत का कोण colors=['red','blue','green','orange','purple'], explode=[0, 0.1, 0, 0, 0], # Sita slice बाहर निकालना shadow=True) plt.title("Subject-wise Marks Distribution") plt.legend(loc='lower right') plt.show()

🔹 Saving Charts

# Chart को file में save करना plt.plot([1,2,3], [10,20,30]) plt.title("Saved Chart") plt.savefig("chart.png", dpi=300, bbox_inches='tight') # dpi = resolution (dots per inch) # bbox_inches='tight' → extra whitespace हटाता plt.savefig("chart.pdf") # PDF format plt.savefig("chart.jpg") # JPG format

🔹 Subplot — Multiple Charts in One Figure

# 1 row, 2 columns → 2 charts side by side fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 5)) ax1.plot([1,2,3], [10,20,30], 'b-o') ax1.set_title("Line Chart") ax1.set_xlabel("X") ax2.bar(['A','B','C'], [5,8,3], color='green') ax2.set_title("Bar Chart") plt.tight_layout() # overlap न हो plt.show()

🔹 Chart Customization Summary

Functionकार्य
plt.xlabel("text")X-axis label
plt.ylabel("text")Y-axis label
plt.title("text")Chart title
plt.legend()Legend box दिखाना
plt.grid(True)Grid lines
plt.xticks(rotation=45)X labels rotate
plt.ylim(0, 100)Y-axis range
plt.figsize=(10,6)Figure size
plt.savefig("file.png")Save to file
plt.show()Display chart
🔑 Key: plt.pie() → labels, autopct='%1.1f%%', explode, shadow | savefig()→save | subplots()→multiple charts | tight_layout()→no overlap | dpi=300→high quality | figsize=(w,h)→size
📖 NCERT Reference: Informatics Practices, Chapter 2 — Pie Chart & Customization

🗄️ Database & SQL

NCERT: Informatics Practices | Unit 3 — Database Management
🗄️ अध्याय 7: DBMS & MySQL Basics Most Important

🔹 Database & DBMS

Database: संबंधित डाटा का व्यवस्थित संग्रह। DBMS: डाटाबेस बनाने, प्रबंधित और access करने का सॉफ्टवेयर। RDBMS: Relational DBMS — डाटा Tables (Relations) में संग्रहित। उदाहरण: MySQL (Open Source), Oracle, PostgreSQL, MS SQL Server।

🔹 RDBMS Key Terms

Termअर्थउदाहरण
Relation/TableRows + Columns का संग्रहSTUDENT table
Tuple/Record/Rowएक पंक्ति (एक student)(101, Ram, 85)
Attribute/Column/Fieldएक गुण (property)Name, Marks
DegreeColumns की संख्या4 columns → Degree=4
CardinalityRows की संख्या3 rows → Cardinality=3
Primary KeyUnique + NOT NULL identifierRoll_No
Foreign Keyदूसरी table की PK refer करताDept_ID
Candidate KeyPK बन सकने वाले सभी columnsRoll_No, Aadhar

🔹 MySQL Data Types

CategoryTypesउदाहरण
NumericINT, FLOAT, DOUBLE, DECIMALINT → 85, FLOAT → 85.5
StringCHAR(n), VARCHAR(n), TEXTCHAR(10) → fixed, VARCHAR(50) → variable
Date/TimeDATE, TIME, DATETIME, YEARDATE → '2026-02-16'
🔑 Key: RDBMS → Tables | Degree → Columns | Cardinality → Rows | Primary Key → Unique+NOT NULL | Foreign Key → दूसरी table refer | CHAR → fixed length | VARCHAR → variable length | MySQL → Open Source
📖 NCERT Reference: Informatics Practices, Chapter 3 — Database Concepts
🗄️ अध्याय 8: SQL — DDL, DML, DQL Commands Most Important

🔹 SQL Categories

DDL: CREATE, ALTER, DROP — संरचना। DML: INSERT, UPDATE, DELETE — डाटा बदलना। DQL: SELECT — डाटा पढ़ना।

🔹 DDL — CREATE, ALTER, DROP

CREATE DATABASE school; USE school; CREATE TABLE student ( roll_no INT PRIMARY KEY, name VARCHAR(50) NOT NULL, marks FLOAT, city VARCHAR(30) DEFAULT 'Jaipur', dob DATE ); ALTER TABLE student ADD phone VARCHAR(15); ALTER TABLE student DROP COLUMN phone; ALTER TABLE student MODIFY marks INT; DROP TABLE student;

🔹 DML — INSERT, UPDATE, DELETE

INSERT INTO student VALUES(101,'Ram',85.5,'Jaipur','2008-05-10'); INSERT INTO student(roll_no,name,marks) VALUES(102,'Sita',92); UPDATE student SET marks=90 WHERE roll_no=101; UPDATE student SET city='Jodhpur' WHERE name='Ram'; DELETE FROM student WHERE roll_no=103; DELETE FROM student WHERE marks < 33; -- fail students

🔹 DQL — SELECT Queries

SELECT * FROM student; SELECT name, marks FROM student; SELECT DISTINCT city FROM student; -- WHERE conditions SELECT * FROM student WHERE marks > 80; SELECT * FROM student WHERE city='Jaipur' AND marks>75; SELECT * FROM student WHERE city='Jaipur' OR city='Jodhpur'; SELECT * FROM student WHERE NOT city='Kota'; -- BETWEEN, IN, LIKE, IS NULL SELECT * FROM student WHERE marks BETWEEN 70 AND 90; SELECT * FROM student WHERE city IN ('Jaipur','Jodhpur','Kota'); SELECT * FROM student WHERE name LIKE 'R%'; -- R से शुरू SELECT * FROM student WHERE name LIKE '%am'; -- am पर अंत SELECT * FROM student WHERE name LIKE '_i%'; -- दूसरा अक्षर i SELECT * FROM student WHERE phone IS NULL; -- ORDER BY SELECT * FROM student ORDER BY marks DESC; SELECT * FROM student ORDER BY city ASC, marks DESC;
🔑 Key: DDL→संरचना (CREATE/ALTER/DROP) | DML→डाटा (INSERT/UPDATE/DELETE) | DQL→पढ़ना (SELECT) | WHERE→शर्त | LIKE→pattern (% = कोई भी, _ = एक char) | BETWEEN→सीमा | IN→सूची | IS NULL→खाली | ORDER BY→क्रम (ASC/DESC)
📖 NCERT Reference: Informatics Practices, Chapter 4 — SQL Commands
🗄️ अध्याय 9: SQL — Aggregate Functions & GROUP BY Most Important

🔹 Aggregate Functions

SELECT COUNT(*) FROM student; -- कुल rows SELECT COUNT(city) FROM student; -- NULL नहीं गिनता SELECT SUM(marks) FROM student; -- जोड़ SELECT AVG(marks) FROM student; -- औसत SELECT MAX(marks) FROM student; -- अधिकतम SELECT MIN(marks) FROM student; -- न्यूनतम -- Alias SELECT AVG(marks) AS average_marks FROM student;

🔹 GROUP BY & HAVING

-- City-wise average marks SELECT city, AVG(marks) FROM student GROUP BY city; -- City-wise count SELECT city, COUNT(*) AS total FROM student GROUP BY city; -- HAVING (group पर शर्त — WHERE group पर काम नहीं करता) SELECT city, AVG(marks) AS avg_m FROM student GROUP BY city HAVING AVG(marks) > 80; -- WHERE vs HAVING -- WHERE → row-level filter (GROUP BY से पहले) -- HAVING → group-level filter (GROUP BY के बाद)

🔹 String & Math Functions

-- String Functions SELECT UPPER('hello'); -- HELLO SELECT LOWER('HELLO'); -- hello SELECT LENGTH('Ram'); -- 3 SELECT LEFT('Python', 3); -- Pyt SELECT RIGHT('Python', 3); -- hon SELECT SUBSTRING('Python',2,3); -- yth (position 2 से 3 chars) SELECT CONCAT('Ram',' ','Kumar'); -- Ram Kumar SELECT TRIM(' Ram '); -- Ram SELECT INSTR('Python','th'); -- 3 -- Math Functions SELECT ROUND(3.567, 1); -- 3.6 SELECT ROUND(3.567); -- 4 SELECT MOD(10, 3); -- 1 (शेषफल) SELECT POWER(2, 3); -- 8 SELECT ABS(-5); -- 5 -- Date Functions SELECT NOW(); -- current datetime SELECT CURDATE(); -- current date SELECT YEAR('2026-02-16'); -- 2026 SELECT MONTH('2026-02-16'); -- 2 SELECT DAY('2026-02-16'); -- 16 SELECT DAYNAME('2026-02-16');-- Monday
🔑 Key: COUNT(*)→सभी rows | COUNT(col)→NULL नहीं | SUM/AVG/MAX/MIN | GROUP BY→समूह | HAVING→group शर्त | WHERE→row शर्त | UPPER/LOWER/LENGTH/SUBSTRING/CONCAT/TRIM | ROUND/MOD/ABS/POWER | NOW/CURDATE/YEAR/MONTH/DAY
📖 NCERT Reference: Informatics Practices, Chapter 4 — Aggregate Functions
🗄️ अध्याय 10: Python–MySQL Connectivity Most Important

🔹 Steps: Connect → Cursor → Execute → Fetch/Commit → Close

import mysql.connector # Step 1: Connection conn = mysql.connector.connect( host="localhost", user="root", password="1234", database="school" ) if conn.is_connected(): print("Connected!") # Step 2: Cursor cursor = conn.cursor() # Step 3 & 4: SELECT (Read) cursor.execute("SELECT * FROM student WHERE marks > 80") rows = cursor.fetchall() # list of tuples for row in rows: print(row) # fetchone() → एक row # fetchmany(3) → 3 rows # fetchall() → सभी rows # Step 3 & 4: INSERT (Write) sql = "INSERT INTO student VALUES(%s, %s, %s, %s)" val = (104, "Geeta", 88, "Kota") cursor.execute(sql, val) conn.commit() # ← DML (INSERT/UPDATE/DELETE) में ज़रूरी! # Multiple INSERT records = [(105,"Hari",75,"Jaipur"), (106,"Priya",91,"Udaipur")] cursor.executemany(sql, records) conn.commit() # UPDATE cursor.execute("UPDATE student SET marks=95 WHERE roll_no=102") conn.commit() print(cursor.rowcount, "record(s) updated") # DELETE cursor.execute("DELETE FROM student WHERE marks < 33") conn.commit() # Step 5: Close cursor.close() conn.close()

🔹 Dynamic Input Example

# User से input लेकर search करना roll = int(input("Enter Roll No: ")) cursor.execute("SELECT * FROM student WHERE roll_no = %s", (roll,)) result = cursor.fetchone() if result: print("Name:", result[1], "Marks:", result[2]) else: print("Record not found!") # Create table from Python cursor.execute("""CREATE TABLE IF NOT EXISTS marks ( subject VARCHAR(30), score INT )""") conn.commit()
🔑 Key: import mysql.connector | connect(host, user, password, database) | cursor() → execute() → fetch/commit | fetchall()→सभी | fetchone()→एक | commit()→DML में ज़रूरी | %s→placeholder | executemany()→multiple rows | rowcount→affected rows | close()→अंत में
📖 NCERT Reference: Informatics Practices, Chapter 5 — Python-MySQL Interface

🌐🔒 Networking & Cyber Security

NCERT: Informatics Practices | Unit 4 — Society, Law & Ethics
🌐 अध्याय 11: Networking Concepts (नेटवर्किंग) Most Important

🔹 Network Types

PAN: व्यक्तिगत (Bluetooth, USB, 10m)। LAN: भवन/कैम्पस (स्कूल, ऑफिस)। MAN: शहर (Cable TV)। WAN: देश/विश्व (Internet = सबसे बड़ा WAN)।

🔹 Network Topology

Bus: एक केबल, सस्ता, केबल खराब→सब बंद। Star: Hub/Switch से जुड़े, सबसे लोकप्रिय, 1 खराब→बाकी चालू। Ring: वृत्ताकार, no collision। Mesh: सब-से-सब, सबसे विश्वसनीय, महँगा। Tree: Star+Bus hierarchical।

🔹 Transmission Media

Wired: Twisted Pair (LAN, 100m, सस्ता), Coaxial (Cable TV), Fiber Optic (सबसे तेज़, light, EMI-proof, महँगा)। Wireless: Radio (Wi-Fi), Microwave (towers), Infrared (remote), Satellite (VSAT, GPS)।

🔹 Network Devices

Modem: Digital↔Analog। Hub: Broadcast (unintelligent)। Switch: Destination only (intelligent)। Router: Networks जोड़ता (IP routing)। Gateway: अलग protocols जोड़ता। Repeater: Signal amplify।

🔹 Protocols & Internet

TCP/IP: Internet foundation। HTTP (80)/HTTPS (443): Web। FTP (21): File transfer। SMTP (25): Email send। POP3/IMAP: Email receive। DNS: Domain→IP। IPv4: 32-bit (192.168.1.1)। IPv6: 128-bit (hexadecimal)। URL: Protocol+Domain+Path। WWW: Tim Berners-Lee, 1989। भारत में Internet: 15 Aug 1995, VSNL।

🔑 Key: LAN→भवन | WAN→विश्व | Star→popular | Mesh→reliable | Fiber→fastest | Hub→broadcast | Switch→intelligent | Router→network connect | TCP/IP→Internet | HTTP→80 | HTTPS→443 | FTP→21 | SMTP→25 | DNS→name→IP | IPv4→32bit | IPv6→128bit
📖 NCERT Reference: Informatics Practices, Chapter 6 — Computer Networks
🔒 अध्याय 12: Cyber Security & Ethics (साइबर सुरक्षा)

🔹 Cyber Threats (साइबर खतरे)

Virus: Host program से जुड़कर फैलता। Worm: बिना host, network से फैलता। Trojan: उपयोगी दिखता, अंदर malicious। Spyware: गुप्त जासूसी। Ransomware: Data encrypt→फिरौती। Adware: अनचाहे विज्ञापन। Keylogger: Keyboard strokes record।

🔹 Cyber Crimes

Hacking: अनधिकृत access। Phishing: नकली site/email→data चोरी। Cyberstalking: Online पीछा/धमकी। Identity Theft: पहचान चुराना। Cyberbullying: Online उत्पीड़न। Denial of Service (DoS): Server को overload करना।

🔹 सुरक्षा उपाय

Firewall: Network traffic filter। Antivirus: Malware detect/remove। Encryption: Data को coded form में (HTTPS/SSL)। Strong Passwords: 8+ chars, mixed। 2FA: Password + OTP। Regular Updates और Backup अनिवार्य।

🔹 IT Act 2000 & Ethics

IT Act 2000 (2008 संशोधित) — भारत का पहला साइबर कानून। Digital signatures को मान्यता। CERT-In: Indian Computer Emergency Response Team। Digital Footprint: Online गतिविधियों का रिकॉर्ड। IPR: Copyright, Patent, Trademark। Plagiarism: चोरी — अनैतिक। Open Source: Linux, Python, LibreOffice — स्वतंत्र। Creative Commons (CC): कुछ अधिकारों के साथ sharing। Free Software Foundation: Richard Stallman। E-Waste: पुराने electronics का safe disposal ज़रूरी।

🔑 Key: Virus→host | Worm→अकेले | Trojan→छिपा | Ransomware→फिरौती | Phishing→नकली site | Firewall→filter | Encryption→coded | IT Act→2000 | 2FA→Password+OTP | CERT-In→nodal | Open Source→free (Linux, Python) | IPR→Copyright/Patent
📖 NCERT Reference: Informatics Practices, Chapter 7 — Societal Impact & Ethics

❓ अक्सर पूछे जाने वाले प्रश्न (FAQ)

RBSE Code 04 में कौन-कौन से topics हैं?
Informatics Practices (Code 04) में: Python Pandas (Series & DataFrame), Data Visualization (Matplotlib — Line, Bar, Histogram, Pie), SQL (DDL, DML, DQL, Functions, GROUP BY), Python-MySQL Connectivity, Networking Concepts, Cyber Security — कुल 12 अध्याय।
Computer Science (083) और Informatics Practices (04) में क्या अंतर है?
CS में Python advanced (Functions, Recursion, File Handling, Stack, Boolean Algebra) है, जबकि IP में Pandas (Data Analysis) और Matplotlib (Visualization) मुख्य हैं। SQL और Networking दोनों में समान हैं। IP में Boolean Algebra और Stack नहीं है।
PDF कैसे डाउनलोड करें?
'PDF Download करें' बटन क्लिक → नई विंडो → Ctrl+P → 'Save as PDF' चुनें।
Board Exam में Pandas code कैसे लिखें?
import pandas as pd लिखना न भूलें। Code में proper indentation रखें। Output भी लिखें — DataFrame/Series का output tabular form में दिखाएँ। Comments (#) लगाएँ।

📤 शेयर करें:

💼

सरकारी नौकरी की तैयारी करें!

SSC, Railway, Bank, UPSC के लिए

Visit Now →

💬 टिप्पणियाँ

No comments:

Post a Comment