Sahodaya Comp Set 2 AK
Sahodaya Comp Set 2 AK
ASSOCIATION
ANSWER KEY
SECTION- A
SL. ANSWER M
NO
1 True 1
2 c) ans 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
12 b) Constraint 1
1
13 False 1
14 -8.0 1
15 d) Cartesian Product 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.
(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.
2
20 2
21 2
(OR)
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.
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.
(OR)
SECTION - C
26 5 58 3
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)
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
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()