0% found this document useful (0 votes)
13 views8 pages

Comp 1

The document is a Class 12 Computer Science Question Paper worth 70 marks, divided into three sections: Computer Networks, Interface Python with MySQL, and Case Study-based Questions. Each section contains multiple choice, short answer, and long answer questions covering various topics related to computer networks and Python database interaction. The paper emphasizes clear writing and proper syntax for programming questions.

Uploaded by

sathyasree.jc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views8 pages

Comp 1

The document is a Class 12 Computer Science Question Paper worth 70 marks, divided into three sections: Computer Networks, Interface Python with MySQL, and Case Study-based Questions. Each section contains multiple choice, short answer, and long answer questions covering various topics related to computer networks and Python database interaction. The paper emphasizes clear writing and proper syntax for programming questions.

Uploaded by

sathyasree.jc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

**Class 12 Computer Science Question Paper (70 Marks)**

**General Instructions:**

1. All questions are compulsory.

2. The question paper is divided into three sections: A, B, and C.

3. Marks are indicated against each question.

4. Write your answers neatly and clearly.

5. Use proper syntax for programming questions.

---

### **Section A: Computer Networks** (25 Marks)

**1. Multiple Choice Questions (1 Mark each)** (5 x 1 = 5 Marks)

Choose the correct option:

a) Which of the following is not a networking device?

i) Router

ii) Switch

iii) Compiler

iv) Hub

b) In which layer of the OSI model does IP addressing work?

i) Application Layer

ii) Network Layer

iii) Data Link Layer

iv) Physical Layer


c) What is the default subnet mask for a Class B IP address?

i) 255.0.0.0

ii) 255.255.0.0

iii) 255.255.255.0

iv) 255.255.255.255

d) Which protocol is used for transferring files on the internet?

i) HTTP

ii) FTP

iii) SMTP

iv) POP3

e) Which of the following is an example of an IP address?

i) www.google.com

ii) 192.168.1.1

iii) [email protected]

iv) https://example.com

---

**2. Short Answer Questions** (2 Marks each) (4 x 2 = 8 Marks)

a) Define computer network. List any two advantages of networking.

b) Differentiate between HTTP and HTTPS.


c) What is the function of a router in a network?

d) Explain the concept of bandwidth in a network.

---

**3. Long Answer Questions** (3 Marks each) (4 x 3 = 12 Marks)

a) Explain the OSI model in brief. Mention the functions of the Transport Layer.

b) What is DNS? How does it work?

c) Write the advantages and disadvantages of using wireless networks.

d) Compare IPv4 and IPv6. Mention any two differences.

---

### **Section B: Interface Python with MySQL** (25 Marks)

**4. Multiple Choice Questions (1 Mark each)** (5 x 1 = 5 Marks)

Choose the correct option:

a) Which of the following is a valid MySQL connector module in Python?

i) sqlite3

ii) mysql.connector

iii) pyodbc
iv) psycopg2

b) What is the correct method to execute a SQL query in Python?

i) cursor.query()

ii) cursor.execute()

iii) execute.sql()

iv) query.execute()

c) Which command is used to fetch all rows from a MySQL query result in Python?

i) fetchrow()

ii) fetchall()

iii) fetch()

iv) fetchrows()

d) Which keyword is used to define a primary key in a MySQL table?

i) PRIMARY

ii) PRIMARY KEY

iii) PK

iv) PRIMARYKEY

e) What is the default port number for MySQL?

i) 3306

ii) 8080

iii) 1433

iv) 1521

---
**5. Short Answer Questions** (2 Marks each) (4 x 2 = 8 Marks)

a) Write the steps to establish a connection between Python and MySQL.

b) What is the purpose of the commit() method in Python’s MySQL connector?

c) Explain the difference between fetchone() and fetchall().

d) Write a Python statement to insert a record into a MySQL table named `Students` with columns
`RollNo`, `Name`, and `Class`.

---

**6. Long Answer Questions** (3 Marks each) (4 x 3 = 12 Marks)

a) Write a Python program to display all records from a MySQL table named `Books`.

b) Explain the process of creating a database and a table in MySQL using Python code.

c) Write a Python program to update the `marks` of a student in the `Results` table where `RollNo` is
101.

d) Discuss the importance of exception handling in Python while connecting with a MySQL database.
Write a small code snippet demonstrating the use of `try` and `except` for a database connection.

---

### **Section C: Case Study-based Questions** (20 Marks)


**7. Case Study Question (4 Marks)**

The following is a Python script:

```python

import mysql.connector

try:

con = mysql.connector.connect(host="localhost", user="root", password="password",


database="School")

cursor = con.cursor()

query = "SELECT * FROM Students WHERE Class = '12';"

cursor.execute(query)

records = cursor.fetchall()

for record in records:

print(record)

con.close()

except mysql.connector.Error as err:

print("Error:", err)

```

Answer the following:

a) What is the purpose of the `connect()` method in the above script? (1 Mark)

b) Identify the SQL query used in the script and explain its function. (1 Mark)

c) How can the script be modified to display only the names of students in Class 12? (2 Marks)
---

**8. Case Study Question (4 Marks)**

A school wants to store information about its staff in a table named `Staff` with columns: `StaffID`,
`Name`, `Designation`, and `Salary`.

Write the following:

a) The SQL query to create this table. (2 Marks)

b) A Python code snippet to insert a new record into this table with the following details:

`StaffID`: 101, `Name`: "Arun", `Designation`: "Teacher", `Salary`: 50000 (2 Marks)

---

**9. Case Study Question (4 Marks)**

A company wants to track its sales using a database. The `Sales` table has the following columns:

`ProductID`, `ProductName`, `QuantitySold`, and `Price`.

Answer the following:

a) Write a Python program to calculate the total revenue by summing up `QuantitySold * Price` for
all rows in the `Sales` table. (2 Marks)

b) What will happen if the database connection is not closed after execution? Explain briefly. (2
Marks)

---
**10. Case Study Question (8 Marks)**

A network administrator needs to secure a company's database server. Answer the following:

a) What are two common security threats to a database? How can these threats be mitigated? (4
Marks)

b) Write a Python program that uses parameterized queries to prevent SQL injection while fetching
records from a `Users` table where `username` is input by the user. (4 Marks)

You might also like