0% found this document useful (0 votes)
583 views

Sahodaya Comp Set 2 AK

This document contains a pre-board examination answer key for grade 12 computer science. It includes three sections - Section A with short answer questions, Section B with two long answer questions and Section C with Python programs related to database operations and stack operations.

Uploaded by

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

Sahodaya Comp Set 2 AK

This document contains a pre-board examination answer key for grade 12 computer science. It includes three sections - Section A with short answer questions, Section B with two long answer questions and Section C with Python programs related to database operations and stack operations.

Uploaded by

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

BANGALORE SAHODAYA SCHOOLS COMPLEX

ASSOCIATION

PRE-BOARD EXAMINATION (2023-2024)


Grade XII
SET - II
Date: Max. Marks: 70
Subject: Computer Science (083) Time: 3 Hours

ANSWER KEY

SECTION- A

SL. ANSWER M
NO

1 True 1

2 c) ans 1

3 d) {1: 'One', 2: 'Two', 3: 'C', 4: 'Four', 5: 'Five'} 1

4 c) 0 1

5 b) ['I', 'N', 'F', 'O', 'R', 'M', 'A', 'T', 'I', 'C', 'S'] 1

6 a) wb+ 1

7 b) alter 1

8 c) ORDER BY 1

9 d) Statement 4 1

10 b) Foreign key 1

11 c) both iii and iv 1

12 b) Constraint 1

1
13 False 1

14 -8.0 1

15 d) Cartesian Product 1

16 b) Username, Password, Hostname 1

17 c) 1

18 b) 1

SECTION- B

19 Switch: Switches are primarily used for LAN traffic management. They create and 2
manage LAN segments, provide efficient switching of data within a single network, and
support local communication among devices connected to the same network segment.
Switches are designed for high-speed data transfer within a LAN.

Router: Routers are used for interconnecting different networks, including LANs and
WANs. They make decisions about the best path for data packets to reach their
destination across different networks. Routers are responsible for network segmentation,
routing, and ensuring data can traverse multiple networks to reach its intended
destination.

(Any two valid points are accepted)

(OR)

Web Server: Web servers are typically located on remote servers or data centers and are
maintained and operated by web hosting providers, organizations, or individuals. They
are designed to be accessible over the internet and respond to incoming requests from
clients.

Web Browser: Web browsers are installed and run on the client's local device. They are
used to access and interact with web content hosted on remote web servers. Users open
web browsers to view websites, and the web browser displays the web content locally on
the user's device.

(Any two valid points are accepted)

2
20 2

21 2

(OR)

22 [ ] [25, 20, 15, 10]

23 A primary key enforces the uniqueness of each record or row in a database table. This 2
means that no two rows in the table can have the same value for the primary key column.
This uniqueness ensures that each row can be uniquely identified by its primary key
value.

24 CHAR (Character Fixed-Length): CHAR is used to store fixed-length character strings. 2


This means that each value of a CHAR column will occupy a fixed amount of storage,
regardless of the actual length of the string. If the string is shorter than the defined length,
it is padded with spaces to fill the fixed size.

3
VARCHAR (Character Variable-Length): VARCHAR is used to store variable-length
character strings. It only uses as much storage as needed to store the actual data, so it
doesn't pad with spaces. This makes VARCHAR more space-efficient for storing strings
of varying lengths.

(Any valid points are accepted)

(OR)

The different types of aggregate functions are


Min(), Max(), SUM(), Count(), AVG()
SELECT MIN(Price) AS LowestPrice FROM Products;
SELECT MAX(Salary) AS HighestSalary FROM Employees;
(Any two valid examples can be awarded marks)

25 [5, 11, 12] [5, 11, 12] 2

SECTION - C

26 5 58 3

27 i. ITEMCODE is suitable as primary key as it is should be unique and also not to 3


accept null values.
ii. ALTER TABLE FRESH DROP COLUMN QTY;
iii. ALTER TABLE ADD COLUMN PRICE FLOAT DEFAULT 20;
28 def countwords(file_path): 3
try:
with open(file_path, 'r') as file:
text = file.read()
words = text.split()

digit_words = [word for word in words]


return len(digit_words)
except FileNotFoundError:
print(f"File '{file_path}' not found.")
return 0
except Exception as e:
print(f"An error occurred: {e}")
return 0
Creating a function – ½ mark
Opening the file with correct mode – ½ mark

4
Using split function- ½ mark
Finding the length of the word- ½ mark
Logic- 1 mark
(Marks can be awarded to any program performs the same task)

(OR)
def countwords(file_path):
try:
with open(file_path, 'r') as file:
text = file.read()
words = text.split()
count_my = 0
count_me = 0
for word in words:
word = word.strip('.,?!\'"()[]{}').lower()
if word == 'my':
count_my += 1
elif word == 'me':
count_me += 1
print(f"No. of words 'my' is {count_my}")
print(f"No. of words 'me' is {count_me}")
except FileNotFoundError:
print(f"File '{file_path}' not found.")
except Exception as e:
print(f"An error occurred: {e}")
file_path = 'myfile.txt'
countwords(file_path)

Creating a function – ½ mark


Opening the file with correct mode – ½ mark
Using strip function- ½ mark
Counting the word- ½ mark
Logic- 1 mark
(Marks can be awarded to any program performs the same task)

29 i. UPDATE TABLE EMPLOYEE SET SALARY =SALARY + (SALARY*0.10) 3


WHERE SALARY<3500;
ii. SELECT ENAME,DEPTID,DNAME,SALARY AS “GROSS SALARY” FROM
EMPLOYEE WHERE DLOCATION =”New Delhi”
iii. DELETE FROM EMPLOYEE WHERE DEPTID=1;

5
30 def __init__(self): 3
self.status =
def push_element(self, record):
self.status.append(record) # Push the student record onto the stack

def pop_element(self):
if not self.status:
print("Stack Empty")
else:
record = self.status.pop
print("Popped Student Record:")
print("Roll Number:", record[0])
print("Name:", record[1])
print("Date of Birth:", record[2])
print("Class:", record[3])
creating the function for Push_element & pop element - ½ mark
checking whether the stack is empty or not – ½ mark
logic – 2 marks
(Mark can be awarded to any program that does the Push and pop operation of a
stack)
(OR)
def Push(books):
stack = []
count = 0
for book, price in books.items():
if price > 300:
stack.append(book)
count += 1
print("The stack contains:")
for book in reversed(stack):
print(book)
print("The count of elements in the stack is", count)
Dbook = {
"Python": 350,
"Hindi": 200,
"English": 270,
"Physics": 600,
"Chemistry": 550
}
Push(Dbook)

6
creating the function for Push - ½ mark
checking whether the stack is empty or not – ½ mark
logic – 2 marks
(Mark can be awarded to any program that does the Push operation of a stack)
SECTION - D

31 i. SELECT ADMNO, STREAMID FROM STUDENT, STREAM; 4


ii. DESC STUDENT (OR) DESCRIBE STUDENT;
iii. SELECT * FROM STUDENT WHERE CLASS = “XII”;
iv. SELECT NAME FROM STUDENT WHERE NAME LIKE “%n” AND
CLASS=”XII”;
32 i. csv 5
ii. a
iii. csv.reader()
iv. close()
SECTION - E

33 i. Administrative office since it has more no of computers. 1*5=


ii. Star topology
iii. Modem- with in the block, Switch – between the blocks 5
iv. WAN
v. VOIP
34 i. The Python file read() function allows us to read an entire file at once and store it 1+
in a string. readlines() reads all of the lines and returns a list of strings. 4
ii.

7
(OR)

i) Text Files: Text files store data as a sequence of characters. These characters are
typically encoded using a character encoding like ASCII or Unicode. Text files are human-
readable and contain plain text, which can include letters, numbers, symbols, and control
characters (e.g., newline or tab).
Binary Files: Binary files store data in a binary format, which means the information is
represented using a sequence of 0s and 1s. Binary files can contain a wide range of data
types, including text, images, audio, executables, and more. They are not human-readable
as the data is encoded in a way that is not easily understood without proper interpretation.
ii)

8
35 i. Primary key will not accept null values where as unique key will accept null 1+4
values
ii. mycursor.execute(“USE MY”)
mycursor.execute(querry)
con1.commit()
con1.close()
(OR)
i. Char(n) is of fixed length of characters, whereas Varchar(n) is used as variable
character.
ii. mycursor= mydb.cursor()
mycursor.execute(change)
mydb.commit()
mycursor.fetchall()

You might also like