0% found this document useful (0 votes)
424 views152 pages

Comp 2024 2025 Sample Papers Practice

Practice sample papers for computer science

Uploaded by

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

Comp 2024 2025 Sample Papers Practice

Practice sample papers for computer science

Uploaded by

manugurjar174
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 152
Contents # Latest CBSE Syllabus & Circulars released on Sth Sep. & 3rd April 2024 for Academic. Year 2024-2025 (CBSE Cir. No-CBSE/Academic/Dir.{Acad ]/2024; Acad 30/2024) ie ™ CBSE Solved Paper 2024 . en Q Mind Maps : O On Tips Notes O Sample Question Papers (Solved) 19 © Sample Question Paper - 1 (Issued by Board on September 5, 2024) oe © Answers of Sample Question Paper - 1 (CBSE Marking Scheme 2024-25) 7 © Sample Question Paper -2 39 © Sample Question Paper -3 46 © Sample Question Paper -4 53 © Sample Question Paper -5 G Self Assessment Papers* 60 © Self Assessment Paper - 1 67 ‘© Self Assessment Paper - 2 74 © Self Assessment Paper -3 80 © Self Assessment Paper -4 86 © Self Assessment Paper - 5 © Answers 93 © Sample Question Paper -2 99 © Sample Question Paper - 3 aa ¢ Sample Question Paper -4 109 © Sample Question Paper -5 a Q High Scoring Cheat Sheet aa “Answers can be downloaded from wwwoswaalbooks.com or by scanning the QR code inside PIGETVEARILONG} Mayuiss tests} R "HIGHLY LIKELY QUESTIONS" : ese qvestons re selected by Osvaldo Bord. These ae high ikl tobe ated inthe upcoming lexaminations. ‘The changes for classes IX-XII year-end Boa Circular 2024-25 Tac C2 aia reaticas foram aS aie ew Ren tare are EH ret eH eaTETA TEA) SI GIST sere CENTRAL BOARD OF SECONDARY EDUCATION Ministry of Education, Govt. of Inala) {An Autonomous Organisation Under the (Classes IX-X) 1rd Examinations (2024-25) ‘Academic Session 2024-25 Particulars ‘Academic Session 2023-24 (co change from previous academic session) > Competency Focused — Questions] * Competency Focused _ Questions question paper operand of MCOY Case Based| in the form of MCQsiCasé Based for year-end Questions, Source-based Integrated] Questions, Source-based Integrated examination Questions or any other type = 50% Questions or any other type = 507% Board + Select response type questions (MCQ)|* _Selectresponse type questions (MCQ) Examination = 20% = 20% (Theory) «Constructed response questions |+ Constructed response _ questions (hort Answer/Long Answer Type] (Short ‘Answer/Long Answer Type Questions, as per existing pattern) = Questions, as per existing pattern) 30% 30% (Classes XI-XII) Particulars Academic Session 2023-24 Academic Session 2024-25 ‘Composition of |* Competency Focused Questions Competency Focused Questions question paper in the form of MCQs/ Case Based in the form of MCQs/ Case Based for year-end Guestions, Source-based Integrated | Questions, Source-based Integrated examination’ Questions or any other type = 40% ‘Questions or any other type = 50% Board + Select response type questions (MCQ)| * Select response type questions (MCQ) Examination = 20% 20% (Theory) + Constructed response questions] * Constructed response questions (hort Answer Questions/Long] (Short _~— Answer Questions/Long, ‘Answer type Questions, as per] Answer type Questions, as per existing pattern) = 40% existing pattern) = 30% Sample Question Papers may also be referred to various subjects for classes IX-XII are available at the link httpsi//cbsea fe ‘WHA/ Telephone: 011-23212603 AAATZE/ Websitezhttp://ebseacademic. Curriculum document released by the Board for the ‘Academic Session 2024-25 and the {for details of the QP design of individual subjects. Learning frameworks for ‘fren war, 17 Tay Ua, Fetgyrae Uttar, AG fercit-110002 ‘Shiksha Sadan’, 17, Rouse Avenue, Institutional Area, New Dethi~ 110002 6 .cademic.nic.in for reference. (Or. Joseph Emmanuel) Director (Academics) Am in. Het/e-mail: [email protected]. Syllabus 2024-25 COMPUTER SCIENCE (Code No.- 083) CLASS-XII 1. Prerequisites ‘Computer Science- Class XI 2. Learning Outcomes Student should be able to @) apply the concept of function. (©) explain and use the concept of file handling, (©) use basic data structure: Stacks, (d) explain basics of computer networks, (e) use Database concey i Pts, SQL along with connectivity between Python and SQL. 3. Distribution of Marks: Unit g re No} UnitName | Marks eae s Theory | Practical 1 [Computational Thinking and 0 | 50 Programming -2 M_ |Computer 10 15 uae Networks Mit [Database ~» | 3 20 Management Total 7 [no | 7» 4. Unit wise Syllabus Unit I: Computational Thinking and Programming -2 ‘* Revision of Python topics covered in Class XI ‘© Functions: types of function (built-in functions, functions defined in module, user defined functions), creating user defined function, arguments and parameters, default parameters, positional parameters, function returning value(s), flow of execution, scope of a variable (global scope, local scope) © Exception Handling: Introduction, handling exceptions using try-except-finally blocks Unit Introduction to files, types of files (Text file, Binary file, CSV file), relative and absolute paths ‘Text file: opening a text file, text file open modes (.r+,w, w+, a, a+), closing a text file, opening a file using with clause, writing/appending data to a text file using write() and writelines(), reading from a text file using read(), readline) and readlines(), seek and tell methods, manipulation of data ina text file Binary file: basic operations on a binary file: open using file open modes (rb, rb+, wb, wb+, ab, ab+), close a binary file, import pickle module, dumpQ) and load() method, read, write/create, search, append and update operations in a binary file CSV file: import csv module, open / close csv file, write into a csv file using writer(,writerow(), writerows() and read from a csv file using reader() Data Structure: Stack, operations on stack (push & pop), implementation of stack using list. ‘omputer Networks Evolution of networking: introduction to computer networks, evolution of networking, (ARPANET, NSFNET, INTERNET) Data communication terminologies: concept of communication, components of data communication (senderreceiver, message, communication media, protocols), measuring, capacity of communication media (bandwidth, data transfer rate), IP address, switching techniques (Circuit switching, Packet switching) Transmission media: Wired communication media (Twisted pair cable, Co-axial cable, Fiber- optic cable), Wireless media (Radio waves, Micro waves, Infrared waves) Syllabus Network devices (Modem, Ethernet card, RJ45, Repeater, Hub, Switch, Router, Gateway, WIFI card) Network topologies and Network types: types of networks (PAN, LAN, MAN, WAN), networking topologies (Bus, Star, Tree) Network protocol: HTTR FTP PPR SMTP, TCPAR, POP3, HTTPS, TELNET, VolP ¢ Introduction to web services: WWW, Hyper Text Markup Language (HTML), Extensible Markup Language (XML), domain names, URL, website, web browser, web servers, web hosting Unit IIl: Database Management © Database concepts: introduction to database concepts and its need ‘* Relational data model: relation, attribute, tuple, domain, degree, cardinality, keys (candidate key, primary key, alternate key, foreign key) © Structured Query Language: introduction, Data Definition Language and Data Manipulation Language, data type (char(n), varchar(n), float, date), constraints (not null, unique, primary key), create database, use database, show databases, drop database, show tables, create table, describe table, alter table (add and remove an attribute, add and remove primary key), drop table, insert, delete, select, operators (mathematical, relational and logical), aliasing, distinct clause, where clause, in, between, order by, meaning of null, is null, is not null, like, update command, delete command, aggregate functions (max, min, avg, sum, count), group by, having clause, joins: cartesian product on two tables, equi-join and natural join © Interface of python with an SQL database: connecting SQL with Python, performing insert, update, delete queries using cursor, display data by using connect(), cursor(), execute(), commit(), fetchoneQ), fetchall(),_ rowcount, creating database connectivity applications, use of %s format specifier or format() to perform queries 5. Practical 8. Unit Name Marks No. (Total 30) 1. | Lab Test: 1. Python program (60% logic 8 + 20% documentation + 207% code quality) | 2, SQL queries (4 queries based} on one or two tables) 2. | Report file: © Minimum: 15 Python programs. © SQL Queries - Minimum 5 7 sets using one table / two tables. ‘© Minimum 4 programs based on Python - SQL connectivity 3. | Project (using concepts learnt é Classes 11 and 12) 4. | Viva voce 3 6. Suggested Practical List: Python Programming, © Reada text ile line by line and display each word separated by a #. Read a text file and display the number of vowels/ consonants/uppercase/lowercase characters in the file, Remove all the lines that contain the character ‘a’ ina file and write it to another file. © Create a binary file with name and roll number. Search for a given roll number and display the name, if not found display appropriate message. © Create a binary file with roll number, name and marks. Input a roll number and update the marks, © Writea random number generator that generates random numbers between 1 and 6 (simulates a dice). © Write a Python program to implement a stack using list, Syllabus’ © Create a CSV file by password, read given user id, Database Management entering userid and and search the password for ° pete a student table and insert data. implement the followin, a Implement 1B SQL commands on the © ALTER table to add new attribul ites / modif “data type /drop attributes ee © UPDATE table to modify data © ORDER By-'to dis, lay data is it descending orders ascending / © DELETE to remove tuple(s) 0 GROUP BY and find the min, ‘max,sum,count and average Similar exercise may be framed for other cases: * © Integrate SQL with module, 7. Suggested Reading Material Python by importing suitable © NCERT Textbook. for COMPUTER : SCIENCE’: (Class XIN) © Support Materials on the CBSE website. 8. Project The aim of the class projectis to create something that is tangible and useful using Python file handling/ Python-SQL connectivity. This should be done in groups of two to three students and should be started by students at least 6 months before the submission deadline. The aim here is lo find a real world problem that is worthwhile tosolve. Students are encouraged to visit local businesses and ask them about the problems that they are facing. For example, if a business is finding it hard to create invoices for filing GST claims, then students can do a project that takes the raw data (list of transactions), groups the transactions by category, accounts for the, GST tax rates, and creates invoices in the appropriate format. Students can be extremely creative here. They canuse a wide variety of Python libraries to create user friendly applicationssuch as games, software for their school, software for their disabled fellow students, and mobile applications, of course to do some of these projects, some additional learning is required; this should be encouraged. Students should know how to teach themselves. The ‘students should be sensitized to avoid plagiarism and violations of copyright issues while working on projects. Teachers should take necessary measures for this. ao = Be mindful. Be grateful. ” Be positive. Be true. Be kind O} ey 5p CBSE Board Examination — 2024 COMPUTER SCIENCE Solved Paper Class- 12" ‘Maximum Marks: 70 GENERAL INSTRUCTION: lease check his question paper contain 35 questions, ‘The Paper is ivided into 5 Sections ~ A.B,C,D and E, Section C, consists of 5 quest Section D, consists of 2 ies SECTION- A 1. State True o False: While defining a function in Python, the positional parameters in the function header must always be written after the default parameters. 1 2 The SELECT statement when combined with clause, returns records without repetition. a (A) DISTINCT (8) DESCRIBE (©) UNIQUE () NULL. 3. What will be the output of the following statemer print (16*5/4*2/5-8) 1 (A) 3.33 (6) 6.0 © 0.0 (©) -13.33, 4. What possible output from the given options is expected to be displayed when the following Python code is executed ? 1 import random Signal =[/RED’ , “YELLOW ’, ‘GREEN ‘] for K in range (2, 0,-1): R = random. randrange (K) print (Signal [RJ , end = “#") (A) YELLOW # RED # (B) RED # GREEN # (©) GREEN # RED # (D) YELLOW # GREEN # In SQL, the aggregate function which will display the 5. cardinality of the table is 1 (A) sum () @) count (*) (©) avg) (D) sum (*) 6. Which protocol out of the following is used to send and receive emails over a computer network? 1 (A) PPP (8) HTTP () FIP (p) sur? Section A, consists of 18 questions (1 10 18). Each question carries 1 mark. ts of? questions (19 to 25). Each question carries 2 marks. ns (26 to 30). Each question carries 3 marks. (81 to 32), Each question carries 4 marks, Section E, consists of 3 questions (33 to 35). Lach question carries 5 marks All programming questions are to be anstoered using Python Language only. 7. Identify the invalid Python statement from the following. ‘ (A) d = dict () (B) e=() (©) f= (D) g = dict} 8. Consider the statements. given below and then choose the correct output from the given options: 1 myStr= “MISSISSIPPI” print (mySte [24] +” #* + myStr [-5:) (A) MISSI#SIPPI —(B) MISS#SIPPL (©) MISS#IPPIS—_(D) MISSI#IPPIS 9, ‘Identify the statement from the following which will raise an error: 1 (A) print ("A'*3)—(B) print (6*3) (©) print C715" +3) (D) print 15" + “13") 1 10, Select the correct output of the following code: event= * G20 Presidency@2023" Leevent.. split’) (print (Lf: -21) (A) G20" (B) [Presidency@2023'] (©) (G20) (D) ‘Presidency@202" 11. Which of the following options is the correct unit of measurement for network bandwidth 7 1 (A) KB (8) Bit (C) Hz (D) Km 12. Observe the given Python code carefully: 1 a=20 def convert (a): b=20 a=atb convert (10) print (a) Select the correct output from the given options: (a) 10 (B) 20 «0 (D) Error 13. State whether the following statement is True or False: 1 While handling exceptions in Python, name of the Fegan ‘solved Papers 2024 exception has tobe compulsorily add with exept 14, Which of the following is not a DDL. command tn ce mma (a) Dror. (®) CREATE, (© UPDATE (D) ALTER 415, Fillin the blank: 1 's a set of rules that needs to be followed dy the communicating ps successfl and reliable d network, 16. Consider the following Python statement a Feopen (‘CONTENT ..TXT") Which of the following is an invalid statement in arties in order to have a lata communication over a Python? (A) Eseek (1,0) (B) seek (0,1) o Seek 0,-1)_ (D) Eseck (0,2) . 17 and 18 are ASSERTION (A) and REASO! (R) based questions. | a Mark the correct choice as (A) Both (A) and (R) are true and (R) is the correct explanation for (A). (8) Both (A) and (R) are true and (R) is not the correct explanation for (A). (©) (A)is true but (R) is false. (D) (A) is false but (R) is true. 17. Assertion (A): CSV file is a human readable text file where each line has a number of fields, separated by comma or some other delimiter, Reason (R): writerow () method is used to write a single row in a CSV file. 1 18. Assertion (A): The expression "HELLO" . sortQ) in Python will give an error. 1 Reason (R):sort() does not exist asa method/function for strings in Python, SECTION- B 194A) (i) Expand the following terms: XML, PPP Gi) Give one difference between circuit switching and packet switching. ‘OR Define the term web hosting. ) Name any two web browsers, 20, The code given below accepts five numbers and 141=2 (8) displays whether they are even or odd: 2 Observe the following code carefully and rewrite it after removing all syntax and logical errors: Underline all the corrections made. def EvenOdd () for iin range (5): num = int (input (“Enter a number") if nun: print ("Even") else: print (” Odd” ) EvenOdd () 117 21, (A) Write a user defined function in Python named showGrades (8) which takes the dictionary $ a an argument. The dictionary, $ contains Name: Eng Math, Sclence] as key: value pairs. The function displays. the corresponding grade obtained by the students according to the following grading rules: 2 “Average of Eng Math, Science _|_Grade_| >=90 <9 but >=60 B <0 S For example: Consider the following dictionary S=("AMIT”: [92, 86, 64], “NAGMA": [65, 42, 43], “DAVID”: [92, 90, 88]} ‘The output should be: AMIT-B NAGMA-C DAVID-A oR (8) Write a user defined function in Python named Puzzle (W, N) which takes the argument W as an English word and N as an integer and returns the string where every N® alphabet of the word W is replaced with an underscore (“_"). For example: if W contains the word “TELEVISION” and N is 3, then the function should return the string *TE_EV_SILN’. Likewise for the word “TELEVISION” if N is 4, then the function should return “TEL_VIS_ON’. 22. Write the output displayed on execution of the following Python code: 2 LS=["HIMALAYA’, “NILGIRI", “ALASKA’, “ALPS"] ={} forSin Ls if len(S) % 4 == 0: Djs} = len) for Kin D: print (K,DIK],, sep = “#") 23, Write the Python statement for each of the following tasks using built-in functionymethods only: 1+ (i)To remove the item whose key is “NISHA” from a dictionary named Students. For example, ifthe dictionary Students contains {’ANITA’: 90, “NISHA":76, “ASHA’: 92}, then after removal the dictionary should contain ("ANITA 90, “ASHA": 92} (Gi) To display the number of occurrences of the substring,” is’ in a string named message. For example ifthe string message contains “This is his book” , then the output will be 3. OR (8) A tuple named subject stores the names of different subjects. Write the Python commands to convert the given tuple to alist and thereafter delete the last element of the list. ned 18 | OSWAAL CBSE Sample Question Papers, COMPUTER SCIENCE, lass.1p 27, Consider the table ORDERS given below and write 24, (A) Ms. Veda created a table named Sports in a + (e) EySOL database, containing columns Game_ the output of the SQL queries that follow: 1x3a3 id, P_Age and G_name. 2 7 Tm Tory ‘After creating the table, she realized that the DINO: QTY] RATE] ORDATE ltribute, Category has to be added, Help her to ror [Rice [23 | 120 | 2023-09.19 | qwrite a command to acld the Category column. 102 [purses [13__[120 [2023-1038 | Thereafter, write the command to insert the poss Rice (oe 1107 7 | folvsng recordin the table os See | ove 18 1005 | PULSES 16 [110 _| 2028015 j_ame: Chess 1006 WHEAT [27__[55_| 2024-04-15 on 1oo7___|wateat [25 [60 [2024-04-30 | (B) Write the SQL commands to perform the (i) EP aaa ca aa | following tasks: i {i) View the list of tables in the database, Exam, (i) SELECT ITEM, QTY FROM ORDERS WHERE ORDATE BETWEEN View the structure of the table, Terml. "2023-11-01 ' AND 2023-12-31"; | 25, Ped theoutputofihefolewingendes 2 | ef calton ( (iii) SELECT ORDNO, ORDATE FROM ORDERS WHERE ITEM = ' WHEAT’ AND RATE>=60;. : 28, (A) Write a user defined funetion in Python named print (b,“#"a) showlaLines () which reads contents of a text aaa file named STORY. TXT and displays 3 every sentence ina separate line. 3 =eallon (x,y) Assume that a sentence ends with a full stop (), print x, “@“y) ‘a question mark (2), or an exclamation mark ()- allon (y) For example, ifthe content of file STORY . TXT is print ,“@"y) as follows: Our parents told us that we must eat vegetables a tobe heathy And t turns out our prents were 26, Write the output on execution of the following right! So, what else did our parents tll? Python code: 3 Then the function should display the file's S="Racecar Car Radar” content as follows: ewe (Our parents told us that we must eat vegetables aa tobe healthy. oe And it turns out, our parents were right! So, what else did our parents tell? for Tinx: print(I,end="*") OR (B) Write a function, ¢_words ( ) in Python that else: for Tin W: separately counts and displays the number of print (I, end="#" ) uppercase and lowercase alphabets in a text file, print() Words. tt. 29. Consider the table Projects given below: 1353 Table: Projects Phame Language Startdate Enddate ‘School Management System Python 2023-01-12 2023-0403 P002_| Hotel Management System CHE 2022-12-01 2023-02-02, 7003 _| Blood Bank Python’ 2023-02-11 2023-03-02 PO0t_| Payroll Management System Python 2023-03-12, 2023-06-02, Based on the given table, write SQL queries for the following: (i) Add the constraint, primary key to column P_id in (iii) To delete the table Projects from MySQL database the existing table Projects. along with its data. (ii) To change the language to Python of the project 30. Considera list named Nums which contains random whose id is POO2, integers. 3 Solved Papers 2024 Write the following user defined functions: and perform the specified operation named BigNums. Ps Terations on ( PushBig(: It checks every number from the lst Nums and pushes ll such numbers which have & or more digits into the stack, DigNuma (i) PopBig ( }: It pops the numbers from the stack, BigNums and displays them. The function should als display "Stack Empty” when ea numbers eft thestade sn Neeare no more For example: data: Nam slp, 10025, 167, 54923, 14, 297653, 3198, ‘Then on execution of PushBig (), should store: 10025, 251923, 1297653, 31498, 92765] ‘And on execution of PopBig (), should be displayed: 92765 31498 1297653 254923 10025 Stack Empty Python a stack I the list Num contains the following the stack BigNums the following output SECTION- D. 31. Consider the tables Admin and Transport given 119 «sv file named Peripheral. csv, to store the details. The structure of Peripheral csv i 4 {rid P_name, Price] where Pid is Peripheral device 1D (integer) P_nameis Peripheral device name (String) Price is Peripheral device price (integer) Sangeeta wants to write the following user defined functions: Add_Device () to accept a record from the user and, 10a csv file, Peripheral . csv. {Device ( }: To count and display number of peripheral devices whose price is less than 1000. SECTION- E 33. Infotainment Ltd. is an event management company with its prime office located in Bengaluru. ‘The company is planning to open its new div three different locations in Chennai named as Vajra, ‘Tishula and Sudershana. 1x5=5 You, asa networking expert need to suggest solutions to the questions m part (i) to (v), keeping in mind the distances and other given parameters. (Chennai Division below: 1X4=4 Table: Admin Sid | Siname | Address Stype so01_ [Sandhya [Rohini [Day Boarder 002_| Vedanshi al lar anshi_| Rohtak _| Day Schol Distances between various locations: 003 [Vibhu | Raj Nagar [NULL S004 [Atharva [Rampur | Day Boarder Monte eshele = Tatler Toes “iishula to Sudershana 415m Sa _| Busno | Stop mane Salen tatu | ngaluru Office to Chennai S002, T8510 _| Sarai Kale Khan. ‘Number of computers installed at various locations: soos [15812 _| Sainik Vihar Vajra 120) soos [8810 _ | Kamla Nagar Sudershana 75 Write SQL queries forthe following: “Tishula S () Dispiay the student name and their stop name from Bengaluru Office 250 the tables me ‘Admin and Transport . Display the number of students whose S_type is not known. (iii) Display all details of the students whose name starts with ‘V’ (Gv) Display student id and address in alphabetical order of student name, from the table Admin. 32, Sangeeta is a Python programmer working in a ‘computer hardware company. She has to maintain the records of the peripheral devices. She created a () Suggest and draw the cable layout to efficiently connect various locations in Chennai division for connecting the digital devices. (ii) Which block in Chennai division should host the server ? Justify your answer. (iii) Which fast and effective wired transmission medium should be used to connect the prime office at Bengaluru with the Chennai division ? iv) Which network device will be used to connect the digital devices within each location of Chennai ‘OSWAAL CBSE Sample Question Papers, COMPUTER SCIENCE, Class.19 20 | vision so that they may co other? (v) Aconsiderableam ymumunicate with cach jount of data lossisnaticed between diiferent locations of the Chennai diviston, which fre connected in the network, Suggest a networking Govier that should be installed to refresh the data and feviuce the data loss during transmission {0 and from different locations of Chennai division. Ak (ANG) Differentiate between ‘w" and ‘a’ file modes in Python, 21385 (ii) Consider a binary file, items . dat, containing records stored in the given format: {item _idt fitem_name, amount} } Write a function, Copy_new0 , that copies all records whose amount is greater than 1000 from items, dat to new items dat. oR (B) () Whatis the advantage of using with clause while opening, a data file in Python ? Also give syntax of with clause. Gi) A binary file, EMP DAT has the following structure: [Emp 1d, Name, Salary] where Emp_Id: Employee id Name: Employee Name Salary: Employee Salary Write a user defined function, disp_Detail(), that would read the contents of the file EMP. DAT and display the details of those employees whose salary isbelow 25000. 35. (A)() Define cartesian product with respect to RDBMS. 14 (i) Sunil wants to write a program in Python to upda is 111 in the table named shop in MySQL database named Keeper. : ‘The table shop In MySQL. contains the following «Hem _name: Name of item (String) + Qty: Quanity of item (Integer) «# Price: Price of tem (Integer) Consider the following to establish connectivity between Python and MySQL: + Username: admin + Password: Shopping + Host: localhost OR (B) (i) Giveany two features of SQL. (ii) Sumit wants to write a code in Python to display all the details of the passengers from the table flight in MySQL database, Travel. The table contains the following attributes: F_code: Flight code (String) F_name: Name of flight (String) Source: Departure city of flight (String) Destination: Destination city of flight (String) Consider the following to establish connectivity between Python and MySQL. + Username: root + Password: airplane + Host: localhost ANSWERS SECTION- A 1. True Explanation: ‘The default parameters. must be specified first before the positional parameters in a function definition, 2. Option (A) is correct. Explanation: The DISTINCT clause returns the “unique values from a set of values in a field ofa table. 3. Option (C) is correct. Explanation: (16*5/4°2/5-8) =(16"5/4"0.4~8) 16°1.25°04-8) =80-8 =00 4. Option (A) is correct, Explanation: The variable K can assume the values Possible values for Rin 1* iteration are 0,1, Therefore Signal[R] can have values "RED" or "YELLOW" Possible values for R in 2 iteration are 0, Signal[R] can therefore have value of “RED”. Therefore, only Option (A) is possible. 5. Option (B) is correct. Explanation: count(*) from statement returns the number of rows in a table, which is the cardinality of a table. 6. Option (D) is correct. Explanation: Simple Mail Transfer Protocol (SMTP) an application protocol used to send and receive files between remote computers in a network. 7. Option (D) is correct. Explanation: dict) function follows the following form =dict(. The g=dict() is an invalid python syntax. 8. Option (B) is correct. Explanation: The mystr[:4] returns characters from index 0 to 3 that is “MISS” which is concatenated with "#". In the next part the mystr[-5] slice returns characters from index-5 to the end which is ‘SIPPY. ‘As we know in python indexes start from 0 to n-1 in forward direction and -1....n in backward direction. The final string formed is: ‘MISS#SIPPY’ 9 Option (C) is correct. Explanation: There will be a type error with the statement: print(“15” +3) , 5 “19” is a string and 3 is, an integer which are added here. 10. Option (B) is correct. Explanation: The split() function splits a string on a delimiter character and returns a list of the parts, eventsplit() returns a list. storing [G20', ‘Presidency@2023'] splitting the string on" * print(L[:-2] returns values from the list backwards skipping by 2, giving [Presidency @2023)] 11. Option (C) is correct. ; Explanation: Network bandwidth is measured in Herz. 12, Option (B) is correct. Explanation: The convert function modifies the Value of the local variable ‘a’ that is present as the function’s formal parameter. The value printed ist of the global variable ‘a’ whose value is unchan and is 20. 13, False Explanation: The name of the exception may not be written with the except block. 14. Option (C) is correct. Explanation: Update isa data manipulation command that makes changes to the data of a table. 15. Protocol Explanation: Protocolsare rules that mustbe followed bby network devices in a communication. Other than the base protocol TCP/IP in windows networks there are many application protocols such as: FTP , IRCP POP, Telnet etc 16. Option (C) is correct. Explanation: Eseek(0, parameter is 1. 0: sets the reference point at the beginning of the file 1: sets the reference point at the current file position 2: sets the reference point at the end of the file 17. Option (B) is correct. Explanation: Comma separated values files are like text files that store data in record like pattern separated by comma or other delimiter. ‘The writerow( function writes a single row of data in a csv file. $0 both the statements are true but the reason is not valid for the assertion statement. 18, Option (A) is correct. Explanation: sort) function does not work for strings, hence the statement will give error. Both the assertion and reason statements are true and match for each other. SECTION- B 1) means the reference 19. (a) (i) XML: Extensible Markup Language Gi) PPP: Point to point protocol i) Circuit switching Packet switching Circuit switching | Packet switching breaks data into smaller packets and sends them independently, _ making routing decisions based on establishes a dedicated path for communication. network conditions. (b) (i) Web Hosting: The process of uploading the data and information to a publicly accessible web server, so that they can be accessed by users. around the world, is called web hosting, (i) Two popular web browsers. are: Explorer and Mozilla Firefox 20, Given code: Internet OSWAAL CBSE Sample Question Papers, COMPUTER SCIENCE, Class-12 22 | def EvenOdd0) . #2 is not present after function definition for iin range(3) ("Enter a number") is not present itmum/: #9 tobe used in place of /for remainder print("Even") else: print((Odd") #Indentation not correct EvenOdd() Corrected code def EvenOdd0: for i in range(3) int(input("Enter a number “)) if num%2: print("Even") else: print("Odd") EvenOddo 21, (a) def showGrades(S): for n, marks in Sitems(: perc=sum(marks)3 if perc> =90: printin + *: lif pere> = prini(n + *:* +B") else: printin + *:" + °C") OR +) () def puzzle(wn) mystr="" for iin range(,len(w)): if G+1)n= mystr +=" else: mystr print(mystr) return mystr 22. Output: HIMALAYA#8 ALPS#4 Explanation: In the code ’S' picks each of the list values in the for loop. It then checks for the length of the string item picked in’S’ If the length is divisible by 4, the string item and its length are added in a dictionary as key and value pairs. The contents of the dictionary are then printed. 23, (a) del Students|”NISHA’] (i) message.count(“is") Explanation: The del function with the key of the dictionary can remove a key:value pair from a dictionary. (ii) The count) function counts the number of occurrences of a substring in a string. OR ist(subject) wi] (b) SubLst Subst pop0 Explanation: The list) function converts the tuple toa lst. The pop() function removes the last element from the list. 24, (a) Alter table Sports ADD Category varchar(20); Insert into Sports values("G42","Above 187/"Chess" “Senior”; OR (b) () Use Exam; Show Tabl Describe Term; 300 @ 200 210 # 200 300 @ 210 Explanation: The 1st ca to the callon() function uses the positional values of x=100 , y=200 passed . These valuies calculate the values of a’ ,’0" In the 2nd call to the callon() function only one of the values of ‘y’ is passed into ‘b’ whereas for ‘a’ the default value is used for the calculations. SECTION- C 26, Output: REA'CE*C*ATR* Chatrt RYA"DSATR* Explanation: The code splits the sentence into a list of words L. The loop picks each word of the list, converts it to upper case and compares the word with its reverse . IF both are same the characters of the word are printed separated by”. If the word picked is not a palindrome , the characters of the word are printed separated with “#” 27. (i) ITEM SUM(QTY) RICE 8 PULSES 29 WHEAT 80 wi ITEM ary RICE 35 WHEAT 28 ii) ‘ORDNO ‘ORDATE 1004 2023-12-25, 1007 | 2024-04-30 28. (a) def showInLines(): f=open("STORY.IXT’) sentence="" filetext=freadQ) for ch in filetext: ifch notin” sentence +=ch else: Answers Print(sentence) sentence ="" Print(*NewLine:") OR (b) def ¢_words(): f=open("Words.txt") ucl=0 la=0 data=Creadg for ch in data: if chisalphag and chisupper() ud elif chisalpha( and chislower(): ket=1 Print("No. of lowercase alphabets” Ic) Print("No. of uppercase alphabets” Alter table Projects ADD Primary key(P_id); (ii) Update Projects set Language="Python” where PLid="Po02"; (ii)Drop table Projects; 30. def PushBig0: for n in Nums: s=str(n) ‘flen(s)>=5: Numsappend(n) def PopBig0: ifNum: rint("Stack empty”) else: for n in range(len(Nums)-1/1,-1): print(Nums{n}) else: rint("Stack empty”) SECTION- D ucl) 29. 31. (i) Select AS name, TStop_name from Admin A , Transport T where AS id=TS id; (Gi Select count(*) from Admin where $ type IS NULL; (ii)Select A.*, TBus_no, TStop_Name from Admin A 1 Transport T where AS id=TS idand AS name like "V%"; (iv)Select $id , Address from Admin order by $_ name; 32. import esv def Add_Device0: csvfile =open(‘Peripheral.csv”/'2") cwriter=csv.writer(csvfile) iput(“Input deviceid:")) input(“Input device name:") put("Input device price:")) | 23 devdata[0°id,P_name,??Price] writerswriterow(devdata) sulle closet) def Count_Deviced) c= svflle=open(Teripheral.esv","r") creader=esvrcader(csvlile) for recin creader: I int(ree2}) < 1000: print(‘Devices with price less than 1000:",¢) cesvfile-lose() SECTION- E Cable Layout ‘Chennai Division Vajea ishula| Sudershana| \Vaja division should have the server as it carries the maximum number of computers. (iii) Optical fibre cable should be used for connecting the Bengaluru office with the Chennai division. OFC offers fast and effective connectivity. (iv) Switch isto be used for communication between devices in each division of Chennai. (v) Repeater is needed tobe installed in the Chennai division to reduce data and signal loss. 34. (a) (i) Following are the differences between ‘w’ and “a mode: ‘w’ mode or write mode . It opens the file for writing. If the file already exists the existing contents are erased ‘al mode or append mode. It opens the file for adding more data at the end, preserving the existing contents. (i) import pickle def Copy_new(): fr=open(“items.dat","rb") fw=open(“new_items.dat” "wb") try: while Tru irec=pickle load r) for kin irec: if int(irec{K]{1})> 1000: pickle.dumptirec,fw) except EOFError: pass frclose() fw.close() 33.) oR

You might also like