0% found this document useful (0 votes)
43 views17 pages

Sample Paper 1

This document outlines the pre-board examination paper for Computer Science for Class XII, including general instructions, question distribution across sections A to E, and various types of questions related to Python programming, SQL, and computer science concepts. The paper consists of 37 questions, with a total of 70 marks and a duration of 3 hours. Each section varies in the number of questions and marks, with specific instructions for programming questions to be answered in Python.
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)
43 views17 pages

Sample Paper 1

This document outlines the pre-board examination paper for Computer Science for Class XII, including general instructions, question distribution across sections A to E, and various types of questions related to Python programming, SQL, and computer science concepts. The paper consists of 37 questions, with a total of 70 marks and a duration of 3 hours. Each section varies in the number of questions and marks, with specific instructions for programming questions to be answered in Python.
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/ 17
Rate Rare dea, aerate GATT SET-1/B KENDRIYA VIDYALAYA SANGATHAN, AHMEDABAD REGION staré yetat: 2024-25 PRE-BOARD EXAMINATION: 2024-25 SUBJECT : COMPUTER SCIENCE(083) TIME : 3 HOURS CLASS :XIL MM :70 ‘ararafaéat/GENERAL INSTRUCTIONS: + This question paper contains 37 questions + All questions are compulsory. However, internal choices have been provided in some questions, Attempt only one of the choices in such questions + The paper is divided into 5 Sections- A, B, C, D and E. + Section A consists of 21 questions (1 to 21). Each question carries 1 Mark. + Section B consists of 7 questions (22 to 28). Each question carries 2 Marks. + Section C consists of 3 questions (29 to 31). Each question carries 3 Marks. + Section D consists of 4 questions (32 to 35). Each question carries 4 Marks. + Section E consists of 2 questions (36 to 37). Each question carries 5 Marks. + All programming questions are to be answered using Python Language only. + In case of MCQ, text of the correct answer should also be written Q@NO SECTION-A(2ixi=21 Marks) MARKS 1 Write the output of following expression: @ 5>10 and not(10<15) 2 Identify the output of the following code snippet: oO T=(100) print(T*2) (A) Syntax error (B) (200,) (C) 200 (D) (100,100) 3 Given s1="Hello”, Which of the following statements will give an error? @ (A) print(s1[4]) (8) s2=s1 (C) st=si[4] (D) si[4]="Y" 4 What is the output of the expression? @ I the Best’ pes.split("t print(p) Page 1 of 10 (A) (AIT, ‘he Bes’, "] (8) CAIL', the Bes', ") (C) (AI, ‘he’, 'Bes', 't'] D) Error 5 State True or False: oO “In a Python program, if @ break statement is given in a nested loop, it terminates the execution of all loops in one go.” 6 Given a Tuple tupi= (10, 20, 30, 40, 50, 60, 70, 80, 90). @ What will be the output of print (tupt [-2: -5])? (A) (80,70,60) QO (C) (60,70,80) (D) Error 7 method is used to delete a given element from the list. @ 8 Which of the following mode in file opening statement results or generates an| (1) error if the file does not exist? (A) a+ (B) re (C) w+ (D) None of the above 9 What will be the output of the following python dictionary operation? wo data = {'A':2000, 'B':2500, 'C':3000, 'A':4000} print(data) (A) {'A:2000, 'B':2500, 'C':3000, 'A':4000} (B) ('A%:2000, 'B':2500, 'C':3000} (C) {'A':4000, 'B':2500, 'C':3000} (D) It will generate an error. 10 | Which of the following python statement will bring the read pointer to 10th] (1) character from the end of a file containing 100 characters, opened for reading in binary mode. (A) File.seek(10,0) (B) File. seek(-10,2) (C) File.seek(-10,1) (D) File.seek(10,2) i [In which datatype the data will consume the same number of bytes as} (1) declared and is right padded? (A) DATE (8) VARCHAR (C) CHAR Page 2 of 10 (D) None of these iz Consider the following statement: SELECT emp_no, name FROM emp designation; Which of the following option will be used to display the employee number and names of similar designations together? (A) FIELD() (8) GROUP BY (C) ORDER BY (D) Both (B) and (C) 13 Tn SQL, which operator is used to check if the column has null value/no value? 14 What will be the output of the following code? v=50 def Change(N): global V VN = NV print(V,N,sep="# Change(20) print(Vv) (A) 20@50#20 (8) 50@20#50 (C) 20#50@20 (D) 50#50#50 15 State whether the following statement is True or False: ‘An exception may be raised even if the program is syntactically correct. @ 16 Fill in the blank: The modem at the sender’s computer end acts as a (A) Model (8) Modulator (C) Demodulator (D) Convertor 7 Which of the following transmission media has the highest bandwidth? (A) Co axial cable (B) Fiber optic cable (C) Twisted pair cable (D) None of these (1) 18 Which of the following aggregate functions ignore NULL values? (A) max() @ Page 3 of 10 (B) count() (C) ava() (D) All of these 19 Which of the following is used to view emails when internet is not available? (A) SMTP (B) POPS (C) PPP (D) VoIP (1) Q20 and Q2i are Assertion(A) and Reason(R) 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 20 ‘Assertion (A): To use a function from a particular module, we need to import the module Reasoning (R): import statement can be written anywhere in the program, before using a function from that module. 21 ‘Assertion (A): COUNT function ignores DISTINCT Reasoning (R): DISTINCT ignores the duplicate values. Q.NO SECTION-B(7x2=14 Marks) MARKS 22 Predict the output of the Python code given below: List = list("Examination") List2 oO for i in List2: ist2.index(i) if j%2==0: List1.remove(i) print(List1) (2) 23 Difference between compile time and run time error, eo) 24 (A)Given is a Python string declaration myexam="@@PRE BOARD EXAMINATION 2024@@" -2)) oR (B)Write the output of the code given below: Write the output of: print(myexam[. my_dict = {"name": "Aman", "age": 26} my_dict{'age'] = 27 my_dict{'address'] = "Delhi" print(my_dict-items()) (2) Page 4 of 10 25 | Find the correct output(s) of the following code. Also write the maximum and | (2) minimum values that can be assigned to variable Y. import random X=random.random() Y=random.randint(0,4) print (int(x),":",¥-+int(x)) (A) 0:0 (B) 1:6 (c) 2:4 (D) 0:3 26 [A programmer has written a code to input a number and check whether it is @ prime or not. However the code is having errors. Rewrite the correct code and underline the corrections made. def prime(): n=int(input("Enter number to check for i in range (2, n//2): if n%6I print("Number is not prime \n") break else: print("Number is prime \n’) 27 __ | (I) A) Write the SQL command to see the list of tables in @ database @ oR 8) Write the SQL command to insert a new record in the table. (11) A) What constraint should be applied on a table column so that NULL is not allowed in that column, but duplicate values are allowed. oR B) What constraint should be applied on a table column so that duplicate values are not allowed in that column, but NULL Is allowed. 28 | (a) Write the full forms of the following: (i) POP (ii) HTTPS @ oR (b) Name the protocol used for : (i)remote login (ii) file transferring NO ‘SECTION-C(3x3=9 Marks) MARKS 29 | Write a method SHOWLINES() in Python to read lines from text file @ *EXAMCS.txt’ and display the lines which do not contain ‘ke’ Example: If the file content is as follows: An apple a day keeps the doctor away. We all pray for everyone's safety. Page 5 of 10 ‘A marked difference will come in our country. ‘The SHOWLINES() function should display the output as: We all pray for everyone's safety. OR Write a function RainCount() in Python, which should read the content of a text file "RAIN.txt” and then count and display the count of occurrence of word rain (case-insensitive) in the file. Example: If the file content is as follows: It rained yesterday It might rain today I wish it rains tomorrow too Tlove Rain The RainCount() function should display the output as: Rain - 2 30 A list contains following record of a customer: [Customer_name, Phone_number, City] Write the following user defined functions to perform given operations on the stack named status: (i) Push_element() - To Push an object containing name and Phone number of customers who live in Goa to the stack. (ii) Pop_element() - To Pop the objects from the stack and display them. Also, display “Stack Empty” when there are no elements in the stack OR Write a function in Python, Push(SItem) where , SItem is a dictionary containing the details of stationary items- {Sname:price}. The function should push the names of those items in the stack who have price greater than 75. Also display the count of elements pushed into the stack. For example: If the dictionary contains the following data: Ditem={"Pen":106,"Pencil":59,"Notebook":80,"Eraser":25} The stack should contain: Notebook Pen The output should be: The count of elements in the stack is 2 31 Predict the output of the following code: s="All The Best” len(s) n m=! @) Page 6 of 10 fori in range(0, n): if (sfi] >= 'a! and s[i] <= 'm’): m =m +5{i]-upper() elif (S{i] >= 'n' and s[i] <= 'z’): m=m4s(i-1] elif (sfi].isupper()): m=m +sfi].lower() else mam+'# print(m) OR Predict the output of the following code: F1="WoNdERFUL" F2="StuDenTs” Fas" for 1 in range(0,len(F2)+1): if FA[I]>="A' and Fi<="F F3=F3+F1[1] elif F1[1]>='N' and F1[T] <= F3=F3+F2[1] else: F3=F3+"*" print(F3) Q.NO SECTION-D(4x4=16 Marks) MARKS 32 | Write the output of the queries (i) to (iv) based on the table, TECH_COURSE @ given below: Table: TECH_COURSE ID [CNAME FEES | STARTDATE [TID (C201_| Animation and VFX | 12000 | 2027-07-02 101 202/00 15000 [2021-11-15 NULL C203_|DcA 10000 [2020-10-01 102 a04_| pore. 9000__|2021-05-15 | 104 (C205 | Nobile Application | 18000 2022-11-01 101 Development (C206 [Digital marketing | 16000.) 2000-07-25 103 A) Write the following queries: (i) To display the details of the courses with names starting with ‘D’. (ii) To display the fees of courses in descending order. (iii) Display the sum of fees of all the courses for which TID is not null. (iv) To display the course name with fees less than 15000 OR B) Write the output of following queries: Page 7 of 10 () SELECT DISTINCT TID FROM TECH_COURSE; (ii) SELECT TID, COUNT(*), MIN(FEES) FROM TECH_COURSE GROUP BY TID HAVING COUNT(TID)> (ili) SELECT CNAME FROM TECH_COURSE WHERE FEES>15000 ORDER BY CNAME; (iv) SELECT AVG(FEES) FROM TECH_COURSE WHERE FEES BETWEEN 15000 AND 17000; 33 Write a program in Python that defines and calls the following user defined functions: a) ADD() - To accept and add data of an employee to a CSV file ‘record.csv’. Each record consists of a list with field elements as empid, name and mobile to store employee id, employee name and employee salary respectively. b) COUNTR() - To count the number of records present in the CSV file named ‘record.csv’ (4) 34 Modern Public School is maintaining fees records of students. The database administrator Aman decided that- = Name of the database -Schoo! * Name of the table - Fees The attributes of Fees are as follows: * Rolino - numeric * Name ~ character of size 20 = Class - character of size 20 © Fees ~ Numeric = Qtr- Numeric Answer the following questions: (i) Identify the attribute best suitable to be declared as a primary key. (ii) Write the degree of the above table if table contains 4 rows. (iii) Insert the following data into the attributes Rolino, Name, Class, Fees and Qtr in fees table. (iv) (A) Aman want to remove the table Fees table from the database School. Which command will he use from the following: a) DELETE FROM Fees; b) DROP TABLE Fees; c) DROP DATABASE Fees; d) DELETE Fees FROM Fees; oR (iv) (8) Now Aman wants to display the structure of the table Fees, i.e, name of the attributes and their respective data types that he has used in the table, (4) Page 8 of 10 Write the query to display the same. 35 ‘A table named student, in school database, has the following structure: RollNo - integer Name - string Class - integer Marks - integer Write the following Python function to perform the specified operation DataDisplay(): To input details of student and store it in the table. The function should then retrieve and displays only those records who have marks greater than 75. Note the following to establish connectivity between Python and MYSQL: Username is root , Password is tiger. Q@NO ‘SECTION-E(2x5=10 Marks) MARKS 36 ‘A binary file “Book.dat” has structure [BookNo, Book Name, Author, Price] i. Write a user defined function CreateFile() to input data for a record and add to Book.dat . ii, Write a function CountRec(Author) in Python which accepts the Author name as parameter and count and return number of books by the given ‘Author are stored in the binary file "Book.dat” (5) 37 Reha Medicos Center has set up its new center in Dubai. It has four buildings as shown in the diagram given below & er, OY Distance between various building are as follows: (6) Page 9 of 10 ‘Accounts to research lab 55m ‘Accounts to store 150m Store to packaging unit 160m Packaging unit to research lab ‘60m, ‘Accounts to packaging unit 125m Store to research lab 180m Number of Computers ‘Accounts oy Research Lab 100 Stor 15 Packaging Unit 60 As a network expert, provide the best possible answer for the following queries: i) Draw the cable layout to efficiently connect various buildings. ii) Suggest the most appropriate location of the server. Justify your choice. ili) Suggest the placement of the following device with justification: a) Repeater b) Hub/Switch iv) Suggest a system (hardware/software) to prevent unauthorized access to or from the network. v) A) Which cable is best suited for above layout. OR B) What type of network (PAN, LAN, MAN, or WAN) will be set up among the computers connected with each other? Page 10 of 10 Rate area dred, aeraTaTs GATT SET-1/B KENDRIYA VIDYALAYA SANGATHAN, AHMEDABAD REGION staré yetat: 2024-25 PRE-BOARD EXAMINATION: 2024-25 MARKING SCHEME SUBJECT : COMPUTER SCIENCE(083) TIME : 3 HOURS CLASS :xIL MM: 70 GENERAL INSTRUCTION: + This question paper contains 37 questions. + All questions are compulsory. However, internal choices have been provided in some questions. Attempt only one of the choices in such questions + The paper is divided into 5 Sections- A, B, C, D and E. + Section A consists of 21 questions (1 to 21). Each question carries 1 Mark. + Section B consists of 7 questions (22 to 28). Each question carries 2 Marks. + Section C consists of 3 questions (29 to 31). Each question carries 3 Marks. + Section D consists of 4 questions (32 to 35). Each question carries 4 Marks. + Section E consists of 2 questions (36 to 37). Each question carries 5 Marks. + All programming questions are to be answered using Python Language only. * Incase of MCQ, text of the correct answer should also be written. @NO SECTION-A(2ixi=21 Marks) MARKS 1 False @ z (© 200 w 3 (D) si[4]= “Y” (@) 4 (A) TAI, ‘he Bes’, "] @ 5 False @ 6 (B) (.) (@) 7 remove() qd) 8 (B) r+ @) 9 (©) (84000, 'B:2500, 'C':3000} w 10 | (B) File. seek(-10,2) @ 1a‘ (C) CHAR Q) 12 (B) GROUP BY (1) 13 TS NULL () Page 1 of 7 14] (©) 20#50020 @ is | True @ 16 | (B) Modulator ion) 17 | (B) Fiber optic cable @ 18 | (D) Allof these @ 19 | (B) POP3 Q) 20 | (A)Both A and R are true and Ris the correct explanation for A wo 21 | (D)Ais False but Ris True @ Q.NO SECTION-B(7x2=14 Marks) MARKS 22 (TE, aT, a, 7, i) @ 23__| Any two correct differences between compile time and run time error @ 24 (A) @40 OTNMX RO R@ (2) oR (B) _ dict_items({(‘name', 'SAM'), (‘age’, 27), (‘address', 'MUMBAI')]) 25 | (A) and(D) are possible outputs @ Maximum:0 Minimum:3 26 | def prime(): @ n=int(input(""Enter number to check :: ")) #bracket mi for iin range (2, n//2): if n%i==0: # = missing print("Number is not prime \n") break #wrong indent else: print("Number is prime \n”) # quote mismatch (4 mark for each correct correction made and underlined) 27___| (I) A) SHOW TABLES @ oR B) INSERT INTO (1I)A) ALTER TABLE DROP PRIMARY KEY; OR B) ALTER TABLE
ADD PRIMARY KEY ( ); (1 mark each for correct answer) 28 | (i) POP - Post Office Protocol @ Page 2of 7 (ii) HTTPS: Hyper Text Transfer Protocol Secure OR (i) Teinet ii) FTP Q.NO ‘SECTION-C(3x3=9 Marks) MARKS 29 def SHOWLINES(): f=open("EXAMCS.txt") for line in f: if ‘ke! not in line: print(line.strip()) f.close() OR def RainCount(): feopen(‘rain.txt!) read() data=data.upper() data=data.split() c=data.count('RAIN') print('Rain -',c) f.close() data: Any other correct code (2 mark for correct function header) (2 mark for correctly opening the file) (2 mark for correctly reading from the file) (% mark for splitting the text into words) (1 mark for correctly displaying the desired output) @) 30 status=[] def Push_element(cust) if cust[2]=="Goa L1=[cust{0],cust{1]] status.append(L1) def Pop_element (): num=len(status) while ten(status)!=0 dek status. pop() print(dele) num=num-1 else: GB) Page 3 of 7 print("Stack Empty") (1.5 marks for correct push_element() and 1.5 marks for correct pop_element()) OR stackitem=[] def Push(Sltem): count=0 for k in SItem if (SItem[k]>=75): stackItem.append(k) count=count+1 print("The count of elements in the stack is : ", count) (1 mark for correct function header 1 mark for correct loop Ye mark for correct If statement 1% mark for correct display of count) 31 | all#tHE#bEes @ oR s*ue'n*s* (deduct ¥2 mark for not printing * #) QNO ‘SECTION-D(4x4=16 Marks) MARKS 32 [A) @ (i) SELECT * FROM TECH_COURSE WHERE CNAME LIKE 'D%’; (ji) SELECT FEES FROM TECH_COURSE ORDER BY FEES DESC; (ili) SELECT SUM(FEES) AS TOTAL_FEES FROM TECH_COURSE WHERE TID IS NOT NULL; (iv) SELECT CNAME FROM TECH_COURSE WHERE FEES <15000; OR 8) Write the output of following queries: @ DISTINCT TID 101 NULL 102 104 103 (ii) TID | COUNT(*) | NIN(FEES) sor [2 12000, Page 4of 7 Gi ‘CNAME Digital marketing ‘Mobile Application Development (iv) 1550.00 (4 x 1 mark for each correct output) 33 import csv def ADD(): fout=open("record.csv","a" newline="\n") wr=csv.writer(fout) empid=int(input("Enter Employee id :: ")) name=input("Enter name :: ") mobile=int(input("Enter mobile number :: ")) Ist= 1/2 mark lempid,name,mobile] wr.writerow(Ist) /2 mark fout.close() def COUNTR(): fin=open("record.cs "newlin \n") data=csv.reader(fin) d=list(data) print(len(d)) fin.close() ADD() COUNTR() (2 mark for importing csv module 1% marks each for correct definition of ADD() and COUNTR() 1% mark for function call statements) (4) 34 Primary Key ~ Rolino li)Degree of table= 5 ili)Insert into fees values(101,’Aman’, XII’,5000); iv)(A) DELETE FROM Fees; oR iv)(B) Desc Fees; (4x1 mark for each correct query) (4) 35 import mysql-connector as mysql def DataDisplay(): con1=mysql.connect(hos! database="school") "localhost" user="root” passwort mycur= con1.cursor() no=int(input("Enter Roll Number: ")) (4) Page 5 of 7 nm=input("Enter Student Name: ") class=int(input("Enter class: ")) marks=float(input("Enter marks: ")) query="INSERT INTO student VALUES ({},'(} 43,3)" query=query.format(no,nm,class,marks) mycur.execute(query) cont.commit() print("Students with marks greater than 75 are : ") mycursor.execute("select * from student where Marks>75") data= mycursor.fetchall() for i in data: print(i) print() (2 mark for correctly importing the connector object) (2 mark for correctly creating the connection object) (2 mark for correctly creating the cursor object) (2 mark for correctly inputting the data) (2 mark for correct creation of first query) (2 mark for correctly executing the first query with commit) (a mark for correctly executing the second query) (4 mark for correctly displaying the data) Q.NO ‘SECTION-E(2x5=10 Marks) MARKS 36 import pickle defcreateFile() fobj=open("Book.dat","ab") BookNo=int(input("Book Number : ")) Book_name=input("Name : Author = input("Author:" ) Price = int(input("Price : ")) BookNo,Book_Name,Author, Price] pickle, dump(rec,fobj) fobj.close() defCountRec(Author): fobj=open("Book.dat","rb") num = 0 try: while True rec=pickle.load(fobj) () Page 6 of 7 except: fobj.close() return num. Any other correct code (1 mark of import pickle and function def) (1 mark for input) (1/2 mark for opening file in append mode and 1/2 mark for using dump) (1/2 mark for opening file in read mode and 1/2 mark for using load) (1 mark for checking the condition and updating the value) (1 mark for checking the condition and displaying data correctly) 37 1) Layout- ii)The most appropriate location of the server would be Research Lab, as this building contains the maximum number of computers. (iii) a) For layout, since the cabling distance between Accounts to Store is quite large, so a repeater would ideally be needed along their path to avoid loss of signals during the course of data flow in this route. For layout2, since the cabling distance between Store to Research Lab is quite large, so a repeater would ideally be placed, b) In both the layouts, a Hub/Switch each would be needed in all the buildings to interconnect the group of cables from the different computers in each building, (iv) Firewall (v) A) Twisted Pair cable / Ethernet cable OR B) LAN (1 mark for correct answer) 6) Page 7 of 7

You might also like