0% found this document useful (0 votes)
161 views15 pages

Cbse Class 12 Computer Science Question Paper 2023

Uploaded by

ZACK & CYRUS
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)
161 views15 pages

Cbse Class 12 Computer Science Question Paper 2023

Uploaded by

ZACK & CYRUS
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/ 15
El Series HFG1E = = tea. Roll No. |] COMPUTER SCIENCE Time allowed : 3 hours Maximum Marks : 70 Please check that this question paper contains 15 printed pages. QP. Code given on the right hand side of the question paper should be ‘written on the title page of the answer-book by the candidate. Please check that this question paper contains 35.questions. Please write down the serial number of the question in the answer- book before attempting it. 15 minute time has been allotted to read this question paper, The # question paper will be distributed at 10.15 a.m, From 10,15 a.m. to 10.90 & a.m., the candidates will read the question paper.only and will not write any answer on the answer-book during this period, General Instructions : () This question paper contains five sections, Section A to E. (ii) AU questions are compulsory. (tit) Section A have 18 questions carrying 1 mark each. (iv) Section B has 7 Very Short Answer type questions carrying 2 marks each, (v) Section C has 5 Short Answer type questions carrying 3 marks each. (vi) Section D has 3 Long Answer type questions carrying 5 marks each. (vii) Section E has 2 questions carrying 4 marks each. One internal choice is given in Q. 34 and 35, against Part (iii) only. (viii) All programming questions are to be answered using Python Language only. SECTION-A 1. State True or False. “Identifiers are names used to identify a variable, function in a program”. 2. Which of the following is a valid keyword in Python ? (a) false Doe (© non_local (@)_ none 3. Given the following Tuple Tup= (10, 20, 30, 50) ; ; Which of the following statements will result in an error ? (a) print (Tup[0]) 1 OF eae (2,3) (©). print (Tup{1:2]) ) print (len(Tup) ) Consider the given expressio1 5<10 and 12>7 or not 7>4 Which of the following will be the correct output, if the given expression is 2 (b) False 6. Which of the f i followin, file ? ig mode keeps the file offset Position at the end of the (a) x+ ® as a 7. Fillin the blank, lank 1 r function is used to arrange the elements of a list in ascending order. A sort () (b) arrange () (c) ascending() (d) asort() 8. Which of the following operators will return either True or False ? 1 (a) += OY = Opes @) += 9. Which of the following statement(s) would give an error after executing the following code ? Stud=("Murugan":100, "Mithu":95} # Statement 1 print (Stud[95]) # Statement 2 Stud ("Murugan") =99 # Statement 3 ‘ 4 5 print (Stud.pop ()) Statement int (Stud) # Statement Statement 2 Statement 3 (c) Statement 4 (a) Statements 2 and 4 10. Fill in the blank. 7 1 ___is a number of tuples in a relation. (a), Attribute (®) Degree ( Domain @_“erdinality 1, The syntax of seek( ) +5 + , file abject.seek (offset (, reference Po-nt]) eo the default value of perenne rks 2 0 (b) Ae @ 3 1 12, Fill in ed with SELECT statement to display data in a sorted claus —, ified column. Form with respect to a specifics (Uo) ORDER BY ie ee (d) DISTINCT ( P.T.O. 91 13, Fill in the blank : (V2 is used for point-to-point communication or unicast commeition such as radar and satellite. x (a) INFRARED WAVES (b) BLUETOOTH (©) MICROWAVES one 14, What will the following expression be evaluated to in Python ? print (44+3*5/3- 5%2) Mes - oho ceva © 10.2 @ 10.0% 15. Which function returns the sum of all elements of a list ? (@) count () sum() ; () total() a) add() F ive 16. fetchall() method fetches all rows in a result and returns a: (@) Tuple of lists List of tuples (c) List of strings @) Tuple of a Q. 17 and 18 are ASSERTION (A) end REASONING (R) asediquctions. Mark the correct choice as (a) Both (A) and (R) are true and Gis the correct explana (A). (b) Both (A) and (R) are true and (R) is not the correct explanation for’ (A). (©) (A) is true but (R) is false. (4) (A) is false but (R) is true. 17. Assertion (A) : To use a function ra a Daxticular Riedie we need to import the module, Reason (R) : import statement can be written ee e rogram, before using a function from that module, a : 18. Assertion (A); A stack is a LIFO structure, Reason (R) + Any new element pushed into the positioned at the index after the last existing te ti ay — " Dr » | = 20, 21. Ba)” Write the full forms of the Bact 24, (a) 91 — in code written below has syntactical rect code and underline the corrections made. }\max=L (0) * forainL: if'a > max max=a return max |) (a) Differentiate between wired and wireless transmission. OR (b) Differentiate between URL and domain name with the help appropriate example. (a) Given is a Python list declaration : Listofnames=["Aman"," Write the output of : Print (Listofnames (-1:-4:-1}) (b) Consider the following tuple declaration : tupl=(10,20, 30, (10,20, 30) , 40) Write the output of : print (tupl.index (20) ) Ankit", "Ashish", "Rajan", "Rajat"] Explain’ the! concept of “Alternate Key” in a Relational Database Management System with an appropriate example. following i) HTML \ ree 2's: a& G) TCP eeaom's Conts oN protec 9 (©) Whatis the need of Protocols) © rotaco J Write the outyiut of the code given below : def short_aub (1st,nj ; for i in range (0,n) ‘i Af len (1st) >4; 5 dst (i]=lst [iltise (ij else: Ast (i}=lst{iy subject=['CS', 'HINDI',"PHystcs 0, ‘CHEMISTRY, "MATHS *) short_sub(subject, 5) print (subject) OR ‘ P.T.O. ) 25. (a) b) —quW«~ Write the output of the code gi a =30 def call (x) : global a if at2=-0; xtsa else: x! a return x x=20 4 print (call (35) ,end=" ) print (call (40),end= " ‘ 91 (b) Write the output of the queries (i) to (iv) based on the table, WORKER given below : TABLE: WORKER [wip |FNAME |L_NAME _| CITY STATE. 102 | SAHIL KHAN. | KANPUR UTTAR { a PRADESH (jo4__|SAMEER|PARIKH- | ROOP NAGAR_| PUNJAB — (105 MARY JONES DELHI DELHI 7 | 106 MAHIR el SHARMA _| SONIPAT HARYANA 107 | ATHARVA~| BHARDWAJ DELHI DELHI / 108 |VEDA ~|SHSRMA | KANPUR UTTAR * PRADESH @ = SELECT F_NAME, CITY FROM WORKER ORDER BY STATE — DESC; q (i) SELECT Viegen™ (CITY) FROM WORKER;—> Ph Gi) SELECT F_NAME, STATE FROM WORKER WHERE L_NAME LIKE '_HA®'; Gv) SELECT CITY /COUNT(*) FROM WORKER GROUP BY CITY; (@) Write the definition of a Pytho ‘unction named LongLines( ) which reads the contents of a tex! file named 'LINSS.TXT" and displays those lines from the fil which have at least 10 words in it. For example, if the content of * ES. TXT! is as follows : Once upon a time, there was a woodeutter He lived in a little house in a beautiful, green wood. One day, he was merrily chopping some wood. He saw a little girl skipping through the woods, whistling happily. ‘The girl was followed by a big gray wolf. ‘Then the function should display output as: He lived in a little house in a beautiful, green wood. H wa little girl ens ht ee skipping through the woods, whistling OR <2 ee P.T.O, (b) Write a function count_Dwords() in Python to count the words ending with a digit in a text file "Details.txt". Example: If the file content is as follows : On seat2 VIP1 will sit and On seat1 VVIP2 will be sitting Output will be: Number of words ending with a digit are 4 28, (a) Write the outputs of the SQL queries (i) to (iv) based on the relations COMPUTER and SALES given below : Table : COMPUTER PROD_ID | PROD_NAME PRICE [COMPANY [TYPE P00 MOUSE 200 | LOGITECH | INPUT | Poo2 LASER PRINTER | 4000 | CANON __| OUTPUT 003 KEYBOARD 500 | LOGITECH. | INPUT POO JOYSTICK’ 1000 [IBALL ~__| INPUT P005 SPEAKER 1200__ | CREATIVE _| OUTPUT 006 DESKJET PRINTER |4300__|CANON | OUTPUT Table: SALES PRODD |QTYSOLD | QUARTER P002 4 1 P003 2 2 POOL 3 2 Poot [2 1 G) SELECT MIN(PRICE), MAX (PRICE) FROM COMPUTER; Gi) SELECT company, COUNT(*) FROM COMPUTER GROUP BY COMPANY. HAVING COUNT (COMPANY) > 1; Gii) SELECT PROD NAME, QTY SOLD FROM COMPUTER C, SALES. § WHERE C.PROD_1D=S.PROD_ID AND TYPE =.JINPUT*; (iv) SELECT PROD NAME, COMPANY, QUARTER PROM COMPUTER Cy SALES $ WHERE C.PROD_ID=s, PROD_ID; (b) Write the command to view al] databases, 0 “<> - ibers. Thereafter, it i eae Place() in Python, which accey " pts a list L of increments all even numbers by 1 and decrement a function EORe d numbers by 1, put data of the list is : 30, 40,35,55) lex_name, Room Type] the following user defined functions to perform given ions on the stack named 'Hotel' : ush_Cust() — To Push customers’ names of those customers who are staying in ‘Delux’ Room Type. Pop_Cust() — To Pop the names of customers from the stack and display them. Also, display “Underflow” when there are no customers in the stack. g For example : If the lists with customer details are as follows : ["Siddarth", "Delux"] ["Rahul", "Standard"] ["Jerry", "Delux"] The stack should contain Jerry Siddharth The output should be: Jerry Siddharth Underflow OR , Write a function in Python dictionary containing details o! {Car_Name: Maker). , The function should push the name of car manufactured by ‘TATA’ (including all the possible cases like Tata, TaTa, etc.) to the stack. 3 For example: ‘ If the dictionary contains the following data: Vehicle={"Santro”: "Hyundai", "Nexon": ‘The stack should contain Safari Nexon "4 Cie ae mad ‘ehicle) where, Vehicle is a wPATA", "Safari": "Tata"} 31. 91 SECTION -D in Delhi is planning to set up a ickdev, an IT based firm, located in Del . n weet ee its four branches within a city with its Marketing department in Kanpur. As a network professional, give solutions to the questions (i) to (v), after going through the branches locations and other details which are given below: | DELHI BRANCH KANPUR BRANCH | [BRANCH A BRANCH B MARKETING DEPT. | | BRANCH C BRANCH D Distance between various branches is as follows : Branch A to Branch B | Branch A to Branch © Branch A to Branch D 80m Branch B to Branch C Branch B to Branch D Branch C to Branch D Delhi Branch to Kanpur Number of computers in each of Branch B | Branch D 116 Suggest the most suitable place branch with a suitable reason, Gi) the branches ; 0 install the server for the Delhi Gi) Gi) g Gv) b) Suggest an ideal layout for connecting all these branches within Delhi, ; 1 Which device will you suggest, that should be placed in each of these branches to efficiently connect all the computers within these branches ? o Delhi firm is planning to connect to its Marketing department in Kanpur which is approximately 300 km away. Which type of network out of LAN, WAN or MAN will be formed ? Justify your answer. 1 Suggest a protocol that shall be needed to provide help for transferring of files between Delhi and Kanpur branch. 1 \What possible output(s) are expected to be displayed on screen at the time of execution of the following program ; import random M=[5,10,15,20,25,30] for i in range(1,3)+ first=random.xrandint (2,5)- 1 Sec=random.randint (3,6)- 2 third=random.randint (1,4) print (M[first],/M[{sec) ,Mithiz =e") gf woresns @)y 5% 20#25#25 5H 20% Gi) 30#20#20 Gy) 10#15425% 20825425 #204108 2 ‘The code given below deletes the recor! ‘vom the table employee which contains the following record struct": E_code - String E_name - String Sal - Integer city - String : Note the following to establish connectivity between Python and MySQL : © Username is root } Password is root ‘The table exists in a MySQL database named emp. F The details (E_code,E_name,Sal,City) are the attributes of the table. ’ Eo P.T.O. given below reads the following records from the table and displays only those records who have employees ity Delhi’ + The table exists in a MySQL database named emp. * The details (E_code,E_name,Sal,City) are the attributes of the table. Write the following statements to complete the code : Statement 1— to import the desired library. Statement 2— to execute the query that fetches records of the employees coming from city ‘Delhi’. Statement 3— to read the complete data of the query (rows whose city is Delhi) into the object named details, from the table employee in the database. 3 import as mysql # Statement 1 def display(): mydb=mysql. connect (host="localhost", user="root", passwd="root", database="emp") mycursor=mydb .cursor () # Statement 2 etal Le: le 2 ee # Statement 3 for i in details: print (4) ———— Ll 33. 34, (@) ) —— Vrite one difference between CSV and text files. d Waite on ean in Python that defines and calls the following user ctions | nea cRER ADD(): It takes the values from the user and adds the details to a csv file ‘courier.csv'- Each record consists of h'list with field elements as cid, s_name, Source, Sestination to store Courier ID, Sender name, Source and destination address respectively. ie F (i) COURTER_SEARCH() : Takes the destination as the input and displays all the courier records going to that destination. OR Why it is important to close a file before exiting ? Write a program in Python that defines and calls the following user defined functions : () Add_Book0 : Takes the details of the books and adds them to a csv file ‘Book.csv’. Each record consists of a list with field elements as book_ID, B_name and pub to store book ID, book name and publisher respectively. (ii) Search_Book( : Takes publisher name as input and counts and displays number of books published by them. SECTION -E The school has asked their estate manager Mr. Rahul to maintain the data of all the labs in a table LAB. Rahul has created a table and entered data of 5 labs. - LABNO [LAB NAME _| INCHARGE: 1001 | CHEMISTRY | Daisy _ area me fen L002 BIOLOGY _| Venky 20 iar L003 MATH Preeti 15, T 1,004 LANGUAGE | Daisy 36 IT L005 COMPUTER | Mary Kom _| 37 I Based on the data given above answ i the fol GY Identify the columns which mabe rade wing ques' f ee (#) Write the degree and cardinality 0 i cables pesiate ner : : (#) Write the statements to : f the table, & (e) Insert a new row ith i ee with appropriate data. the Y ean capacity of all the labs by 10 students which are on OR (Option for part (iii) only) (iii) Write the statements to (@) Add a constraint PRIMARY KEY Delete the table LAB, (b) to the column LABNO in the table, on BD. 91 i k to write a 5 is a programmer, who has recently been given a tas Be eB atin nad write bin( ) to create a binary file called mae file.dat containing customer information — customer number (¢_no), name (c_name), quantity (qty), price (price) and amount (amt) of each customer. : f The function accepts customer number, name, quantity and price. Thereafter, it displays the message ‘Quantity less than 10..... Cannot SAVE’, if quantity entered is less than 10. Otherwise the function calculates amount as price * quantity and then writes the record in the form of a list into the binary file. import pickle def write bin(): bin_file= while True: cnorint (input ("enter customer number") ) input ("enter customer name") nt (input ("enter qty") ) nt (input ("enter price) ) #Statement 2 print ("Quantity less than 10, else: 3 amt=price » qty #Statement 1 -Cannot SAVE") ¢_detail={c_no,c_name #Statement 3 FAsELNPUC(E DOI Your wishycoPentacteer , records y/n™) ig; ans.lower()=='n'; #Statement 4 #Statemen: #Statemens < (Write the correct statement to open a file ‘Guat writing the data of the customer. x ii) Which statement should Shreyas All ; 0 ean quantity is less than 10. | Sttement 2 to check (iii) Which statement should Shreyas fill | the binary file and in Stat, user does not wish to enter raty, price, amt) in Statem ement 4 to stop further rocessi more records, ea OR {Option for part (iii) only) ii) What should Shreyas fill in Statemor’e named Cust_file.dat and in Statemoct to close the binary file write data in binary file ? 6 to call a function to ee ae 1

You might also like