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/ 5
II PREBOARD (2024-25) MS
CLASS XII COMPUTER SCIENCE
Time allowed: 3 Hours SET:A Maximum Marks: 70
Q No. Section-A (21 x 1 = 21 Marks) Marks 1. False (1) 2. (A) ['SQL', 'PYSQL', 'PY'] (1) 3. (A) Only 4 (1) 4. (C) len(L)==5*len(S) (1) 5. 201312010 (1) 6. (C) Statement 4 (1) 7. (D) 15 and 5 (1) 8. (A) 3 (1) 9. (B) There can be only one foreign key in the table (1) 10. (C) 1,2,4,5 are correct (1) 11. False (1) 12. (B) 11%9%9 (1) 13. COUNT(*) (1) 14. (C) Only 2 (1) 15. (A) 1 (1) 16. (C) Distinct (1) 17. (C) SMTP (1) 18. (C) Bridge (1) 19. Star Topology (1) 20. (A) Both A and R are true and R is the correct explanation for A (1) 21. (C) A is True but R is False (1) Q No Section-B ( 7 x 2=14 Marks) MM 22. [2,5]:[6,7], List cannot be a key (2) 23. (A) True or False, 5 > 2 and 3 < 8 (B) 5 + 3, 10 - 4 * 2 (2) 24. (A) d.popitem() (B)d.get(2) (2) 25. (A) and (B) (2) 26. Find the error in the given code: (2) numbers = [1, 2, 3, 4, 5] squares = [] if len(numbers) > 0: for num in numbers: square = num ** 2 squares.append(square) print("The squared numbers are: ",squares) else: print("The list is empty") 27. I check (age <= 17) or default 17 (2) II alter table employeeadd blood_group varchar(5) not null; OR Alter table employee change mname mother_name varchar(50); 28. (A) In Bus topology, all devices are connected to a single central cable (the "bus") (2) where data flows in both directions. (B) In Star topology, all devices are connected to a central hub or switch, which controls and directs data flow. (C) In Bus topology, if the main cable fails, the entire network is disrupted, affecting all connected devices. (D) In Star topology, if one device fails, it does not affect the rest of the network. However, if the central hub or switch fails, the whole network goes down. OR FTP stands for File Transfer Protocol. Definition: FTP is a standard network protocol used to transfer files from one host to another over a TCP-based network, such as the internet. It allows users to upload, download, and manage files on remote servers. Q No. Section-C ( 3 x 3 = 9 Marks) Marks 29. def find5(): (3) with open("prep.txt", "r") as file: for line in file: words = line.split() if len(words) > 5: print(line.strip()) OR def findvowel(): vowels = ('A', 'E', 'I', 'O', 'U', 'a', 'e', 'i', 'o', 'u') with open("prep.txt", "r") as file: for line in file: words = line.split() for word in words: if word.startswith(vowels): print(word)
30. Shop = [] # Stack initialization (3)
def Push_item(item): if item[1] > 50: # Check if Price > 50 Shop.append(item) else: print(f"Item {item[0]} not pushed: Price <= 50") def Pop_item(): if not Shop: # Check if stack is empty print("Underflow") else: item = Shop.pop() print("Popped item:", item)\ def Peep(): if not Shop: print("Stack is empty") else: print("Top item:", Shop[-1]) OR stack = [] # Stack initialization def push(N): for word in N: if word[0].isupper(): # Check if the string starts with a capital letter stack.append(word) def pop(): if not stack: # Check if stack is empty print("Empty") return None else: word = stack.pop() return len(word) def Disp(): if not stack: print("None") else: print("Stack elements:", stack) 25. ['CHEMISTRYCHEMISTRY', 'HINDIHINDI', 'PHYSICSPHYSICS', 'CSCS', (3) 'MATHSMATHS'] OR 2033 Q No. Section-D ( 4 x 4 = 16 Marks) Marks 26. (A)UPDATE Personal SET Salary = Salary * 1.05 WHERE Allowance IS NOT (4) NULL; (B)SELECT Name, Designation FROM Personal WHERE Salary = (SELECT MIN(Salary) FROM Personal); (C)SELECT * FROM Personal ORDER BY Salary DESC; (D)SELECT * FROM Personal WHERE Designation = 'Clerk' AND Salary IS NULL; OR (A) Name Designation Mahesh Superviser (B) P_ID Name Desig Salary Allowance P02 Kashish Clerk NULL 1600 P03 Mahesh Superviser 48000 NULL (C) P_ID Name Designation Salary Allowance P01 Rohit Manager 89000 4800 P04 Salil Clerk 31000 1900 P03 Mahesh Superviser 48000 NULL P05 Ravina Superviser NULL 2100 P02 Kashish Clerk NULL 1600 (D) : P_ID Name Designation Salary Allowance P02 Kashish Clerk NULL 1600 27. (A) import csv (4) def ADD(): admnno = input("Enter admission number: ") name = input("Enter student name: ") student_class = input("Enter student class: ") student_data = [admnno, name, student_class] with open('record.csv', mode='a', newline='') as file: writer = csv.writer(file) writer.writerow(student_data) print("Record added successfully!") (B) def DisplayR12() with open('record.csv', mode='r') as file: reader = csv.reader(file) for row in reader: if row[2] == '12': # Assuming the class is stored in the 3rd column print(" | ".join(row)) 28. (A) Select type, sum(amount) as total_amount from transaction group by type; (4) (B) )select t.trno, t.cno, t.amount, t.type, t.dot from transaction t join customer c on t.cno = c.cno where c.address = 'delhi'; (C) Select dot from transaction tjoin customer c on t.cno = c.cno where c.cname like 'r%n'; (D) select c.address, avg(t.amount) as avg_amoun from transaction t join customer c on t.cno = c.cno where c.address in ('delhi', 'chennai') group by c.address; OR (D)Select * from customer c natural join transaction t; 29. import mysql.connector as m (4) def remove_item(): conn = m.connect(host="localhost", user="root", password="tiger", database="STORE") cursor = conn.cursor() item_name = input("Enter the item name to remove: ") sql_query = "DELETE FROM ITEM WHERE Iname = %s" cursor.execute(sql_query, (item_name,)) conn.commit() conn.close() remove_item() Q.No. SECTION E (2 X 5 = 10 Marks) Marks 30. (A)import pickle (5) def FindBook(price): try: with open('BOOK.DAT', 'rb') as file: while True: try: book = pickle.load(file) if book[3] >= price: # Compare the book price with the input price print(book) except EOFError: break except FileNotFoundError: print("The file 'BOOK.DAT' does not exist.") (B) import pickle def Add(): try: BNO = input("Enter Book Number: ") BNAME = input("Enter Book Name: ") BTYPE = input("Enter Book Type: ") PRICE = float(input("Enter Book Price: ")) new_book = [BNO, BNAME, BTYPE, PR with open('BOOK.DAT', 'ab') as file: pickle.dump(new_book, file) print("Record added successfully.") (C) import pickle def Modify(): try: books = [] with open('BOOK.DAT', 'rb') as file: while True: try: book = pickle.load(file) if book[2].lower() == 'fictional': # Check if the book type is 'fictional' book[3] += 100 # Increase price by 100 books.append(book) except EOFError: break with open('BOOK.DAT', 'wb') as file: for book in books: pickle.dump(book, file) print("Prices of fictional books have been updated.") except FileNotFoundError: print("The file 'BOOK.DAT' does not exist.") 31. (A) Building 3,with maximum Computers (B) Bus/Star (C) In all the buildings (D) Use fiber optics for 120m distance (E) Telnet