The document is a preliminary examination paper for Class XII Computer Science, consisting of five sections with various types of questions including multiple choice, short answer, and programming tasks. It covers topics related to Python programming, SQL commands, and file handling, with a total of 70 marks allocated. Each section has specific instructions regarding the number of questions and marks assigned.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
15 views9 pages
Class 12 - CS - Vidyshilp
The document is a preliminary examination paper for Class XII Computer Science, consisting of five sections with various types of questions including multiple choice, short answer, and programming tasks. It covers topics related to Python programming, SQL commands, and file handling, with a total of 70 marks allocated. Each section has specific instructions regarding the number of questions and marks assigned.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9
JANUARY 2025 PRELIMINARY EXAMINATION
TIME: 3 HOURS CLASS XII – COMPUTER SCIENCE (083) MM-70
GENERAL INSTRUCTIONS: • This question paper contains five sections: Sections A to E. • All questions are compulsory. • Section A has 18 questions carrying 01 mark each. • Section B has 07 Very Short Answer type questions carrying 02 marks each. • Section C has 05 Short Answer type questions carrying 03 marks each. • Section D has 03 Long Answer type questions carrying 05 marks each. • Section E has 02 questions carrying 04 marks each. One internal choice is given in Q35 against Part C only. • All programming questions are to be answered using Python Language only. SECTION A Q1 Find the invalid identifier from the following. [1]
a) name b) class c) section d) break
Q2 State true or false: [1] a) -88.0 is the output of the print(3-10**2+99/11) b) Range( ) is also a module function. Q3 What is the output of the following code? [1] a=[1,2,3,4,5] for i in range(1,5): a[i-1]=a[i] for i in range(0,5): print(a[i],end=" ") a) 55123 b) 51234 c) 23451 d) 23455 Q4 Given the Python declaration s1=”Hello”. Which of the following statements will give [1] an error? a) print(s1[4]) b) s2=s1 c) s1=s1[4] d) s1[4]=”Y” Q5 Identify the output of the following Python statement: [1] s=”Good Morning” print(s.capitalise(),s.title( ), end=”!”) a) GOOD MORNING!Good Morning b) Good Morning! Good Morning c) Good morning! Good Morning! d) Good morning Good Morning! Q6 What is the output of the functions shown below? [1] min(max(False,-3,-4),2,7) a) -3 b) -4 c) True d) False Q7 Suppose the context of “Rhymes.txt” is Hickory [1] Dickory Dock The mouse went up the clock What will be the output of the following Python code? f=open(“Rhymes.txt”) l=f.readlines() x=[“the”,”ock”] for i in l: for w in i.split(): if w in x: print(w,end=”*”) a) the* b) the*the* c) Dock*the*clock* d) error Q8 Which of the following statement is not correct? [1] a) We can write content into a text file opened using ‘w’ mode b) We can write content into a text file opened using ‘w+’ mode c) We can write content into a text file opened using ‘r’ mode d) We can write content into a text file opened using ‘r+’ mode Q9 ______ is a protocol that allows to send/upload email message from local computer to [1] an email server. Q10 What will the following code do? [1] dict={“Phy”:94,”Che”:70,”Bio”:82,”Eng”:95} dict.update({“Che”:72,”Bio”:80}) a) It will create new dictionary as dict={“Che”:72,”Bio”:80} and old dict will be deleted b) It will throw an error as dictionary cannot be updated c) 1It will simply update the dictionary as dict={“Phy”:94,”Che”:72,”Bio”:80, “Eng”:95} d) It will not throw any error but it will not do any changes in dict Q11 Command to remove the row(s) from table student is [1] a) drop table student; b) drop from student; c) remove from student; d) delete from student; Q12 Which SQL command is used to add a new attribute in a table? [1] Q13 The following SQL command is which type of join: [1] SELECT customer, cust_id,order,cust_id, name, order_id FROM customer, order; a) Equi-join b) Natural join c) Outer join d) Cartesian product Q14 In order to open a connection with MySQL database from within Python using [1] mysql.connector package, function is used. a) open( ) b) database( ) c) connect( ) d) connected( ) Q15 The aggregate functions can only be used in the select list or ________ clause of a [1] select query. Q16 _________ counts only those rows that contain a value; it ignores all null values in [1] the field. Q17 and 18 are ASSERTION AND REASONING based questions. Mark the correct choice as a) Both A and R are true and R is the correct explanation for A. b) Both A and R are true and R is not the correct explanation for A. c) A is true but R is false. d) A is false but R is true. Q17 Assertion(A): The readline( ) method reads one complete line from a text file. [1] Reason(R): The readline( ) method reads one line at a time ending with a newline(\n). It can also be used to read a specified number (n) of bytes ofdata from a file but maximum up to the newline character(\n) Q18 Assertion(A): Keyword arguments are related to function calls. [1] Reason(R): When you use keyword arguments in a function call, the caller identifies the arguments by the values passed. SECTION B Q19 Rewrite the following Python program after removing all the syntactical errors (if [2] any), underlining each correction: x=input(“Enter a number”) if x % 2=0: print x, “is even” else if x<0: print x, “should be positive” else; print x “is odd” Q20 Why do we need to network our systems? [2] (OR) How is Coaxial cable different from Optical Fibre? Q21 a) Find the output generated by the following code: a=5 [1] b=10 a+=a+b b*=a+b print(a,b) OR b) Answer the following questions from the following code: [1] num_list=[“One”,”Two”,”Three”,”Four”] for c in num_list: print(c) i) What will be the output of the above code? ii) How many times the loop executed? Q22 What is the similarity and difference between UNIQUE and PRIMARY KEY [2] constraints? Q23 a) What is the difference between HTTP and FTP? [1] b) Expand the following: MAC, PPP Q24 Determine the output of the following code fragments: def [2] determine(s): d={“UPPER”:0, ”LOWER”:0} for c in s: if c.isupper( ): d[“UPPER”]+=1 elif c.islower( ): d[“LOWER”]+=1 else: pass print(“Original String:”,s) print(“Upper case count:”, d[“UPPER”]) print(“Lower case count:”, d[“LOWER”]) determine(“These are HAPPY Times”) OR Find and write the output of the following Python code: def fun(s): k=len(s) m=” “ for i in range(0,k): if (s[i].isupper( )): m=m+s[i].lower( ) elif s[i].isalpha( ): m=m+s[i].upper( ) else: m=m+’bb’ print(m) fun(‘school2@com’) Q25 Write the full forms of DDL and DML. Write any two commands of DML in SQL. [2] OR What is the use of GROUP BY clause? Give example. SECTION C Q26 Consider the following tables: CONSIGNOR and CONSIGNEE [3] Table: CONSIGNOR CnorID CnorName CnorAddress City ND01 R.Singhal 24, ABC Enclave New Delhi ND02 Amit Kumar 123, Palm Avenue New Delhi MU15 R Kohli 5/A, South Street Mumbai MU50 S Kaur 27-K, Westend Mumbai Table: CONSIGNEE CneeID CnorID CneeName CneeAddress CneeCity MU05 ND01 Rahul Kishore 5, Park Avenue Mumbai ND08 ND02 P Dhinga 16/J, Moore Enclave New Delhi KO19 MU15 A P Roy 2A, Central Avenue Kolkata MU32 ND02 S Mittal P 245, AB Colony Mumbai ND48 MU50 B P Jain 13, Block D, A Vihar New Delhi Give output for the following SQL queries: a) SELECT A.CnorName, B.CneeName FROM Consignor A, Consignee B WHERE A.CnorID=B.CnorID AND B.CneeCity=’Mumbai’; b) SELECT CneeName, CneeAddress FROM Consignee WHERE CneeCity NOT IN(‘Mumbai’, ‘Kolkata’); c) SELECT DISTINCT CneeCity FROM Consignee; Q27 Write a function Show_words( ) in python to read the content of a text file [3] ‘NOTES.TXT” and display the entire content in capital letters. Example if the file contains: “This is a test file” Then the function should display the output as: THIS IS A TEST FILE OR Write a function countmy( ) in python to read the text file “DATA.TXT” and count the number of times “my” occurs in the file. For example if the file “DATA.TXT” contains: “This is my website. I have displayed my preferences in the CHOICE section” The countmy( ) function should display the output as : “my occurs 2 times” Q28 Consider the following tables WORKER and PAYLEVEL and answer the following [3] parts of this question: Table: WORKER ECODE NAME DESIG PLEVEL DOJ DOB 11 Radhe Shyam Supervisor P001 13-09-2004 23-08-1981 12 Chander Nath Operator P003 22-02-2010 12-07-1987 13 Fizza Operator P003 14-06-2009 14-10-1983 15 Ameen Ahmed Mechanic P002 19-12-2005 13-03-1983 18 Sanya Clerk P002 19-12-2005 09-06-1983 Table PAYLEVEL PLEVEL PAY ALLOWANCE P001 26000 12000 P002 22000 10000 P003 12000 6000 Give the output for the following SQL queries: a) SELECT COUNT(PLEVEL), PLEVEL FROM WORKER GROUP BY PLEVEL; b) SELECT MAX(DOB), MIN(DOJ) FROM WORKER; c) SELECT Name, Pay FROM WORKER W, PAYLEVEL P WHERE W.PLEVEL=P.PLEVEL AND W.CODE<13; Q29 Write a function stats( ) that accepts a filename and reports the file’s longest line. [3] Q30 Write Addnew(Book) and Remove(Book) functions in python to add a new [3] book and remove a book from a List of books, considering them to act as PUSH and POP operations of the data structure Stack. OR Write a function called letter_freq(my_list) that takes one parameter, a list of strings(mylist) and returns a dictionary where the keys are the letters from mylist and the values are the number of times that letter appears in the mylist, e.g.,if the passed list is as: wlist=list(“aaaaabbbbcccdde”) then it should return a dictionary as{‘a’:5,’b’:4,’c’:3,’d’:2,’e’:1} SECTION D Q31 Learn Together is an educational NGO. It is setting up its new campus at Jabalpur [5] for its web-based activities. The campus has four compounds as shown in the diagram below:
Centre to centre distance between various compounds as per architectural drawing
(in m) is as follows: i) Suggest a cable layout of connections between the compounds. ii) Suggest the most suitable place (i.e. compound) to house the server for this NGO. Also, provide a suitable reason for your suggestion. iii) Suggest the placement of the following devices with justification: a) Repeater (b) Hub/Switch iv) The NGO is planning to connect its international office situated in Mumbai, which out of the following wired communication link, will you suggest for a very high- speed connectivity? a) Telephone analog line b) Optical fibre c) Ethernet cable v) Suggest a device / software to be installed in the Jabalpur campus to take care of data security. Q32 a) Write the output of the code given below: [2] def evn(l): enum=” “ for n in range(len(l)): if n%2==0: enum+=l[n] elif n%3==0: enum+=l[n].upper( ) return enum print(evn([‘a’,’b’,’r’,’a’,’c’,’a’,’d’,’a’,’b’,’r’,’a’])) b) The given program is used to connect with MYSQL and show the name of all the [3] database available in MYSQL server. You are required to complete the statements so that the code can be executed properly. import mysql.connector db=mysql.connector.________(i) fill the statement with appropriate method (host=”localhost”,user”root”,password=”smsmb”) cur=db.cursor( ) cur.execute(“_______;”) (ii) command to display all the database name print(cur.________) (iii) method to extract all the required from the cursor OR a) Predict the output of the code given below: a=10 b=20 def change( ): global b a=45 b=56 change( ) print(a) print(b) b) Write a function to find the power of a number. Q33 a) Write a function in Python that counts the number of “Me” or “My” words present [5] in a text file “STORY.TXT”. If the “STORY.TXT” contents are as follows: My first book was Me and My family. It gave me chance to be known to the world. The output of the function should be: Count of Me/My in file: b) Give one point of difference between a binary file and a CSV file. OR a) What are functions? Give its advantages. b) Write a function in Python PUSH(Arr), where Arr is a list of numbers. From this list push all numbers divisible by 5 into a stack implemented by using a list. Display the stack if it has at least one element, otherwise appropriate error message. SECTION E Q34 In a database High sports there are two tables: students and sports with theinstances [4] given below: Table: STUDENTS ADMNO NAME CLASS GRADE RNO ADDRESS PHONE 1211 MEENA 12A D 4 A-26 3245678 1212 VANI 10A D 1 B-25 5456789 1213 MEENA 12B A 1 NULL NULL 1214 KARISH 10B B 3 AB-234 4567890 Table: SPORTS ADMNO GAME COACHNAME GRADE 1215 CRICKET MR.RAVI A 1213 VOLLEYBALL MR.AMANDEEP B 1211 VOLLEYBALL MR.GOVARDHAN A 1212 BASKETBALL MR.TEWARI B Write the SQL queries for the following statements: a) To display name and game of those students whose address is available in students table. b) To delete a column phone from the table students. c) To display names of those students who are studying in class 12 and their corresponding coach names is their admission number. OR (Option for part iii only) c) To count the number of students who play volleyball. Q35 Krishna of class 12 is writing a program to read the details of Sports performance [4] and store in the csv file “games.csv” delimited with a tab character. As a programmer, help him to achieve the task. import csv f=open(“games.csv”,”a”) sobj=csv.________(f.delimiter=’\t’) # Line 1 sobj.writerow([‘Games’,’Competitions’,’Prizes’]) ans=’y’ i=1 while ans==’y’: print(“Record:”i) game= input(“Game Name:”) comp=int(input(“No.of participants:”)) prize=int(input(“Prizes:”)) rec=_________ # Line 2 sobj._________ # Line 3 i+=1 ans=input(“Do you want to continue?(y/n):”) f.________ # Line 4 a) Line 1: To create an object to enable to write in the csv file b) Line 2: To store the data in list c) Line 3: To write a record d) Line 4: To close the file *************************************