Current Affairs updated daily
KalviGavaniKalviGavani

Tamil Nadu Class 12 Informatics Practices Important Questions — Samacheer Kalvi

Most important questions for TN Board Class 12 Informatics Practices with answers — Python Pandas, SQL, Networking, Cybersecurity for board exam preparation.

Updated 17 June 20268 min read

Class 12 Informatics Practices — Important Questions


1-Mark Questions

1. What is a DataFrame in Pandas? Answer: A two-dimensional labelled data structure with rows and columns, like a spreadsheet. 2. Which Pandas method shows the first 5 rows of a DataFrame? Answer: df.head() 3. What does df.shape return? Answer: A tuple (rows, columns) giving the dimensions of the DataFrame. 4. Name the command to import Pandas. Answer: import pandas as pd 5. What is the full form of DDL? Answer: Data Definition Language. 6. Which SQL command removes a table completely including its structure? Answer: DROP TABLE 7. What does TRUNCATE do in SQL? Answer: Removes all rows from a table but keeps the table structure. 8. What is a Primary Key? Answer: A column (or set of columns) that uniquely identifies each row in a table — must be not null and unique. 9. Which SQL function counts the number of rows? Answer: COUNT(*) 10. What is LAN? Answer: Local Area Network — a network covering a small area like a building or campus. 11. Name one difference between a hub and a switch. Answer: A hub broadcasts data to all connected devices; a switch sends data only to the specific destination device. 12. What is phishing? Answer: A cyberattack that uses fake emails or websites to trick users into revealing passwords or personal information. 13. What does DNS stand for? Answer: Domain Name System — translates domain names to IP addresses. 14. What is the groupby() function used for in Pandas? Answer: To group rows by one or more columns and apply aggregate functions (sum, mean, etc.) to each group. 15. Which Matplotlib function creates a pie chart? Answer: plt.pie() 16. What is ransomware? Answer: Malware that encrypts the victim's files and demands payment to restore access. 17. What is a Foreign Key? Answer: A column in a table that refers to the Primary Key of another table, establishing a link between them. 18. Which SQL clause filters groups after GROUP BY? Answer: HAVING 19. What does df.isnull().sum() return? Answer: The count of missing (NaN) values in each column of the DataFrame. 20. What is the IT Act 2000? Answer: India's first cyber law that defines offences like hacking, data theft, and provides penalties for cybercrime.


2-Mark Questions

1. Distinguish between DELETE and TRUNCATE in SQL.

Answer
  • DELETE: Removes specific rows using a WHERE condition. Can be rolled back. Slower — logs each row deletion.
  • TRUNCATE: Removes all rows at once. Cannot be rolled back. Faster — does not log individual rows.

2. What is the difference between df.iloc[] and df.loc[]?

Answer
  • df.iloc[]: Position-based indexing — uses integer index. df.iloc[0] = first row.
  • df.loc[]: Label-based indexing — uses row label and column name. df.loc[0, 'Name'] = value at row 0, column 'Name'.

3. List any two types of network topology with one advantage each.

Answer
  • Star topology: All devices connect to a central switch. Advantage: Easy to add devices; failure of one device doesn't affect others.
  • Bus topology: All devices share a single cable. Advantage: Simple and cheap for small networks.

4. What is the difference between a virus and a worm?

Answer
  • Virus: Attaches itself to an existing program; spreads when the infected program is run; requires human action.
  • Worm: Self-replicating program; spreads automatically across networks without any human action.

5. Write the syntax for INNER JOIN in SQL.

Answer
SELECT column_names
FROM table1
INNER JOIN table2
ON table1.column = table2.column;

Returns only rows where there is a match in both tables.


3-Mark Questions

1. Write Python code to create a DataFrame and display rows where marks are greater than 80.

Answer
import pandas as pd

data = {
    'Name': ['Anitha', 'Bala', 'Chitra', 'Devi'],
    'Marks': [85, 75, 92, 68]
}
df = pd.DataFrame(data)

filtered = df[df['Marks'] > 80]
print(filtered)

2. Write SQL statements to (a) create a table, (b) insert a record, and (c) select all records.

Answer
-- (a) Create
CREATE TABLE Student (
    RollNo INT PRIMARY KEY,
    Name VARCHAR(50),
    Marks INT
);

-- (b) Insert
INSERT INTO Student VALUES (101, 'Anitha', 85);

-- (c) Select
SELECT * FROM Student;

3. Explain three cybersecurity best practices.

Answer1. Strong passwords: Use 8+ characters with upper/lowercase, numbers, and symbols. Never reuse passwords. 2. Two-factor authentication (2FA): Adds a second verification step (OTP, app) so a stolen password alone cannot grant access. 3. Software updates: Regularly update OS and applications to patch known vulnerabilities that attackers exploit.

4. Compare LAN, MAN, and WAN.

Answer
FeatureLANMANWAN
Full FormLocal Area NetworkMetropolitan Area NetworkWide Area Network
CoverageBuilding / campusCityCountry / global
SpeedVery highHighModerate
ExampleOffice networkCity cable TV networkInternet

5. Write Python code to draw a bar chart showing subject-wise marks.

Answer
import matplotlib.pyplot as plt

subjects = ['Tamil', 'English', 'Maths', 'Science', 'Social']
marks = [82, 78, 95, 88, 80]

plt.bar(subjects, marks, color='steelblue')
plt.title("Subject-wise Marks")
plt.xlabel("Subject")
plt.ylabel("Marks")
plt.show()

5-Mark Questions

1. Explain the DDL commands in SQL with syntax and example.

Answer outline: DDL (Data Definition Language) commands define or modify database structure.

CommandPurposeExample
CREATECreate a new tableCREATE TABLE Student (...)
ALTERModify existing tableALTER TABLE Student ADD Grade CHAR(2)
DROPDelete table completelyDROP TABLE Student
TRUNCATERemove all rows, keep structureTRUNCATE TABLE Student
RENAMERename a tableRENAME TABLE Student TO Learner

Example:

CREATE TABLE Employee (
    EmpID INT PRIMARY KEY,
    Name VARCHAR(100),
    Salary DECIMAL(10,2),
    Dept VARCHAR(50)
);
ALTER TABLE Employee ADD JoinDate DATE;

2. Write a Python program using Pandas to read student data, group by city, and find average marks.

Answer
import pandas as pd

data = {
    'Name': ['Anitha', 'Bala', 'Chitra', 'Devi', 'Elan'],
    'Marks': [85, 72, 91, 68, 88],
    'City': ['Chennai', 'Madurai', 'Chennai', 'Coimbatore', 'Madurai']
}

df = pd.DataFrame(data)
print("Full DataFrame:")
print(df)

# Group by city and find mean marks
city_avg = df.groupby('City')['Marks'].mean()
print("\nAverage marks by city:")
print(city_avg)

# Find city with highest average
print("\nCity with highest average:", city_avg.idxmax())

3. Explain the types of cyber threats with examples.

Answer outline:

ThreatDescriptionExample
MalwareHarmful softwareVirus, worm, trojan, spyware
PhishingFake emails/sitesFake bank login page
RansomwareEncrypts files, demands moneyWannaCry (2017)
DoS/DDoSFloods server with requestsOverwhelms website servers
SQL InjectionMalicious SQL in input' OR 1=1 -- in login form
Man-in-the-MiddleIntercepts communicationPublic Wi-Fi snooping
KeyloggerRecords keystrokesSteals typed passwords

Prevention: Antivirus software, firewall, strong passwords, regular updates, HTTPS only, VPN on public networks, 2FA.

4. What is Pandas Series? Write a Python program to create a Series and perform operations on it.

Answer

A Pandas Series is a one-dimensional labelled array capable of holding any data type. It is like a column in a spreadsheet.

import pandas as pd

# Create a Series
marks = pd.Series([85, 78, 92, 68, 95],
                  index=['Tamil', 'English', 'Maths', 'Social', 'Science'])

print("Series:")
print(marks)

print("\nHighest mark:", marks.max())
print("Lowest mark:", marks.min())
print("Average:", marks.mean())
print("Subjects with marks > 80:")
print(marks[marks > 80])
print("Maths marks:", marks['Maths'])

5. Explain the aggregate functions in SQL with examples. Assume a table Sales(SaleID, Product, Amount, Region).

Answer

Aggregate functions perform calculations on a set of rows and return a single value.

-- Count total sales
SELECT COUNT(*) FROM Sales;

-- Total revenue
SELECT SUM(Amount) FROM Sales;

-- Average sale amount
SELECT AVG(Amount) FROM Sales;

-- Highest sale
SELECT MAX(Amount) FROM Sales;

-- Lowest sale
SELECT MIN(Amount) FROM Sales;

-- Total sales per region
SELECT Region, SUM(Amount) AS Total
FROM Sales
GROUP BY Region;

-- Regions with total > 50000
SELECT Region, SUM(Amount) AS Total
FROM Sales
GROUP BY Region
HAVING SUM(Amount) > 50000;

Practical Exam Hints

  • Always include import pandas as pd and import matplotlib.pyplot as plt at the top of programs
  • End every Matplotlib program with plt.show()
  • SQL keywords in CAPS by convention (SELECT, FROM, WHERE)
  • End SQL statements with semicolon (;)
  • For merging questions: remember how='inner', how='left', how='right', how='outer'
  • Common df.fillna() usage: df['column'].fillna(df['column'].mean()) to fill with mean

Frequently Asked Questions

Pandas DataFrame operations, SQL queries (DDL/DML/aggregate), types of network topologies, cybersecurity threats, and Matplotlib chart types appear most frequently.