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

Document 23

Uploaded by

tamtadhruv30
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)
12 views

Document 23

Uploaded by

tamtadhruv30
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/ 8
CLASS: XII SESSION: 2022-23 COMPUTER SCIENCE (083) SAMPLE QUESTION PAPER (THEORY) SECTION A gate TUE or False q 4 spython treats uppercase and lowercase letters equally.” 1 which of the following is an invalid datatype in Python? 1 1 @ fooat (b) _ integer o oe (4) complex ‘ wnat type of error is returned by following code Al pict={2" * ‘Apple’, ‘B': ‘Banana’, ‘C’: ‘Cat'} print (Dict [0}) @) KeyError (b) KeyNotFoundError () NotFoundError (d) — SyntaxError 4, Consider the given expression:True and False or not True Which of the folowing will be correct output if the given expression is evaluated? 1 (a) The (b) False () NONE (d@) NULL 4, Select the correct output of the code: a= ‘We all are 2022 batch hardworking students” a= asplit(‘0’) | b= a0) +S" + alt] print (b) 41 (a) Error (>) We all are 2$ 22 batch hardworking students (©) We all are $ batch hardworking students (@) We all are 2022 $ batch hardworking students veri of the following mode in file writing statement results orgenerates an ror? 1 99 Xil-Computer Science 6 bh 8. Which of the following comm 9 10, 12, o * (a) None of the above 7. Fillin the biank ns present in database in g disused 10 $08 3 ‘Ay comma (o) display fables (0 ee sing ves ofa ands wit enange exstd atrbutes 1 (2) show tables (©) describe tables ‘elation? DELETE TABLE (6) UPDATE TABLE (b) DROP TABLE (a) ALTER TABLE Which of the folowing statement(s) would a8 97 &*7OF after executing thy {following code? 1 30 # Statement 1 for ¢ in range(0.): # Statement 2 it # Statement 3 # Statement 4 Elseif c%5==0: # Statement 5 print (c+3) # Statement 6 else print(c+10) # Statement 7, (@) Statement 3 (b) Statement 4 (©) Satement 5 (d) Statement § and 7 Fil inthe blank Js atbute, whose values are used as a key, in place of Primary Key (2) Domain (b) Foreign Key 4 (c Candidate Key (4) None “mode” ) file_object=open(‘flename’, ‘mode" ) (6) open=file_object('fiename’) mode") (8) _file_object open="fiename’ "mode" Fill in the blank: 1 Xil-Computer Science gre SELECT statement when combine in cefault order. wih order by clause, retuns records ee (© Desc 1 (@)_ Bath (@) and (6) sci ‘the protocol that is used fh ion (a) and (by (a) Tenet ©) sw lent to server. 1 (TOPAP _ 3 wll the folowing expres wr +3442 15 — be evaluated to in Python? 1 8 oon i 7 - 's used 10 display the pattem matching for atibutes of relation 1 (@ IS NULL tir wrear rel tke (Equals to ‘After execution of SQL insert statement, in command is need to wie, make changer soreness wien (a) Alter ® R (c) Update (@) commit 1 t7 and 18 are ASSERTION AND REASONING based questions. Mark the correct 7. 18. choice as (@) Both A and R are true and R is the correct explanation for A (®) Both A and R are true and R is not the correct explanation for A (c) Ais True but R is False (@) Ais false but R is Tue Assertion ): Access mode ‘a’ opens a file for appending Reason (R): The file pointer is at the end of the file if the fle exists 1 ‘Assertion (A): Bult in function are user defined functions which are created by the user Reason (R): print() and input () are built in functions 1 SECTION B 101 Xil-Computer Science a | Explain the Use of 4 GING example to support f@) ‘ritton @ code fo input a number And 1 Rewrite the correc ‘et exam update act rei) PrN ahoL exam tema) TOTAL = 0 for © in (7,6.4.9) T= TxTICNT] TOTAL = float(T) +.¢ 102 Key’ in @ Relational Database Man ‘Your anawer, Write the ful forma of the following: WAP (i) VoIP NagomentSyatem, 2 2 Xi-Computer Science Men Whee and ayy ee 0. n ba, oR Calagorize the folowing cone, CREATE, UPDATE, ALTER, Dlr POL or DM: ee ty Table: Bank Account Name ype ce Sevrgn Parthodas Curent Miron Curent i ‘Table: Branch Code Gly a) Doth a2 Mumba 403 Nagpur How many rows and columns willbe there inthe cartesian product ofthe above tables. 103 Xt-Computer Science : .oM Employee: rade FR SELECT DSTNCT SUING) FROM Employee SELECT Gos CON cOUNTIGade PT: WHERE (uy SELECT Enane FROM EPOVR® Goso>=7O0 ORDER BY EME (w) SELECT AVG(Gross) FROM Employee Gross BETWEEN 4000 AND 7000; 27. Wite a user defined faneion to depay the total number Of Words presen, 3 Le ee Soe em pee can tc rset Sans ‘The countwords() function should display the output as: aes OR Write in pyton to count the number lines in a text fle ‘Ci farting wih an alphabet Wor ‘H! myvt IF the file contents are as follows: in the fe ; ‘A text fle “Quotes. Tt” has the following data written in it; | ‘Whose woods these are | t XllkComputer Science vis House iI the vilage though, jot see me stopping her je will "© To watch hi pit output of the function should he: ” "O88 fil up with snow. worw:t worn: 2 the outputs forthe folowing quetieg \RHOOL 2nd ADMIN given below “ZA (to Gy) based on the relations TABLE : ScHooL TABLE : ADMIN DESIGNATION | VICE PRINCIPAL COORDINATOR COORDINATOR HOD ‘SENIOR TEACHER SENIOR TEACHER, MALE, oD ‘SELECT SUBJECT, count(*) FROM School GROUP BY SUBJECT; ‘SELECT MAX(003), MIN(DOJ) FROM SCHOOL; ‘SELECT TEACHERNAME, DESIGNATION FROM SCHOOL S, ADMIN A WHERE S.CODE = ACODE AND EXPERIENCE > 10; SELECT TEACHERNAME, SUBJECT FROM SCHOOL S, ADMIN A WHERE S.CODE= A.CODE AND DESIGNATION =HOD’; (b) Write the command to view all databases in mySq\ 105, Xil-Computer Science 28, 30, Write a funetion in Python. which accepis a list LSt Of numbers. ay, ‘odd number and even numbers separately in (WO lIStS and din). 3) Allist contains following record of @ Student [Stud no, name, Fee) Write te ftoning user dened functions 10 Perform given gg fon the stack named EMP: on, + Push_elementto push an object containing Stud_no ang 9, 4 an, y theme 3 5000 to the stac me ‘student who are paying fee more than Ck Stug. © oF = Pop_element(}10 pop the objets from the stack and display y ‘Also isola ‘Stack Emply' when there are elements in pg Mem, For example ‘ack, If the lists of student details: “Angelia”, 4000) 11003, “Amrit 7000) ‘The stack should contain [1001,"John*, 5500] [1003, “amnt”,7000] ‘Stack Empty 4) Saransh has created a dictionary containing names and Salary as key value pairs of few Employees. White a program, with separate usc, defined functions to perform the following operations: Push the keys (name of the empl where the corresponding value ( Pop and display the deleted elements, For example: If the sample content of the dictionary is as follows: Re(“Aman*:15000, “Raman’:20000, “BOB™:9000, “PAWAN":7000, “ANUT:9000,"Mukesh’:8000} The output from the program should be: Aman Raman SECTION D 106 XuleComputer Science f the dictionary into a stack eater than 10000, Ih continuation ofthe above, he following number of computers (mea ees have panned to instal te in each oftheir oftana Production 110 Media 2a Finance a Research 6 |, Suggest the most sultabe place (e. Branch) to instal the server of te organization with a suitable reason, fi, Suggest an ideal layout for connecting all branches of Hygerabad i. Production, Media, Research and Finance. Also wite the type of Topology. land which wired transmission media out of Ethemet cable \wire/Optical Fibre should company use for very fast data transmission? 107 XiLComputer Science #Statement 2 _—__# Statement 3 jed successfully’) ane nett th tia, acon add n ea Veo Coney OR one ge 2g predict the output of the code given below: ont bem a “got change(otd_S): Ct ce co Lm Length = len(old_S) en nen = 2 ey for i in range(0, Length): a if (old_Sli] >= ‘A and old_S[i) <= ‘2: one new_S = new_S +old_Sfil.lower() ine ont elif old_Sfilislowerd): eo ving 100070 i tRe t20 Gary new_$ = new_S + old_Sfil.upper() elif old_Sfi) 0: et 8) gon ete ing = Hrd = 60 getty between Python and MYSay. new_S=new_$#"@" oe ate: te ne ok Y : ee named Game, new_S-new $+" rn 2S be accented print(new_$) ar ves oe moe Hite old_S="Welcome$T0$2021" eee enenes cae cote cnet 5) rte tig 8D OT ect fp) The cade given below reads the folowing record from the ‘able named satement 1 ~ 1 7 a ‘command that inserts the record in the Player and displays only those records who have Score greater than ‘Satement 2-1 e700 75:1d ~ integer Name — string Game — string Score — integer fale Sucet recat permanenty in the database Note the following to establish connectivity between Python and MYSQL: aera > oa Username is root igre 36 Password is 0) comecttosacaloe user="00",password="iger, | The table exis 1YSQL database name Game. Write the following missing statements to complete the code: ‘Statement 1 — to form the cursor object Statement 2 — to execute the query that extracts records of those players whose Scores are greater than 60. Statement 3- to read the complete result of the query (records whose ‘Scores are greater than 60) into the object named data, from the table 109 Xil-Computer Science atobase="Game) ‘#Statement 1 (0:00 format(id, name, game) 108 XileComputer Science of recads present in the CSV fig a CONTR) - To cat fe maT raed OR le and a ane pot of erence beween a text fi ov fle ey 4 te en deine tees: © ads) To acept and add deta of @ mobile user to a CSV fie “pote cov. Each ed ens ofa Ist wth elements as id, name, b.s0, bil 1 sore id, name, mobile number and mobile ba respec, (@) sarc To splay the records of the person having mobile bil is ‘more tan 1000, Grad x B c ‘and cardinality of the above table? 1 following record into the table Id - 5, S.Name - Sangeeta, Score - 75, Grade B b. Increase the Score of the students by 2% whose name ends with “S OR (Option for part ii onty) ay Wiite the statements to: a, _ Delete the record of students securing ‘D’ Grade. b. Add a column DofB in the table with datatype as date. ‘Ajay has written a code for operation on a binary file “stud.dat” with dat ‘2 2s admnno, name and fee. The file contains 15 records. 4 He now has to update a record-based on the admnno entered by the user and update the fee. The updated record is then to be written in the file ‘temp.dat. The records which are not to be updated also have to be written to the file temp.dat. If the admnno is not found, an appropriate message should to be displayed. ‘As a Python expert, help him to complete the following code based on the requirement given above: SSSot(input(Enter admnno to update their fee::“)) ¢ While True: tty. ~~ #Saatement 3 # rec{‘admnno’}==sid found=True rec{fee}int(input(‘Enter new fee:: *)) Pickle. #Statement 4 else: Pickle dump(rec.fout) except break # found—=true: a Print("The fee of student admnno *,admnno,” has been Updated.» Print("No student with such admnno is not found") fincloseg) fout closet) o Which module should be imported in the (©) Write the correct statement temp.dat (Statement 2) (@) Which statement should binary file, stud. dat Fill in the blank in Statement 4 to write the updated data in the fle, temp.dat Program? (Statement 1) required to open a temporary file named Azy fil in Statement 3 to read thedata from the 112 Xi-Computer Science

You might also like