50% found this document useful (2 votes)
2K views

Computer Science Xii Model Test Paper 1

This document contains a model test paper for Class XII Computer Science with 5 sections (A-E). Section A contains 18 multiple choice questions worth 1 mark each. Section B contains 7 short answer questions worth 2 marks each. Section C contains 5 short answer questions worth 3 marks each. Section D contains 3 long answer questions worth 5 marks each. Section E contains 2 questions worth 4 marks each, with 1 internal choice in question 34c. All programming questions must be answered using Python.

Uploaded by

Namratha Murugan
Copyright
© © All Rights Reserved
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
50% found this document useful (2 votes)
2K views

Computer Science Xii Model Test Paper 1

This document contains a model test paper for Class XII Computer Science with 5 sections (A-E). Section A contains 18 multiple choice questions worth 1 mark each. Section B contains 7 short answer questions worth 2 marks each. Section C contains 5 short answer questions worth 3 marks each. Section D contains 3 long answer questions worth 5 marks each. Section E contains 2 questions worth 4 marks each, with 1 internal choice in question 34c. All programming questions must be answered using Python.

Uploaded by

Namratha Murugan
Copyright
© © All Rights Reserved
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/ 10

MODEL TEST PAPER–1

CLASS XII
COMPUTER SCIENCE (083)
Maximum Marks: 70 Time Allowed: 3 hrs

General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A has 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
5. Section C has 05 Short Answer type questions carrying 03 marks each.
6. Section D has 03 Long Answer type questions carrying 05 marks each.
7. Section E has 02 questions carrying 04 marks each. One internal choice is given in Q34 against part c only.
8. All programming questions are to be answered using Python Language only.

SECTION – A
1. State True or False: “Keywords can be used as identifiers in Python.” (1)
2. Which of the following is an invalid identifier in Python? (1)
(a) Roll_No (b) Salary
(c) Account No (d) EmpID
3. Which of the following will delete key-value pair for key = “Red” from a dictionary D1? (1)
(a) delete D1(“Red”) (b) del.D1(“Red”)
(c) del D1[“Red”] (d) del D1
4. What will be the output of the following statement: (1)
print(3-10**2+99/11)
(a) 80 (b) 81
(c) -81 (d) 81.0
5. What will be the output of the following code? (1)
Str1= ‘My name is digital’
Str2=Str1[3:7]
strlen = len(Str2)
print(strlen)
(a) 4 (b) 14
(c) 24 (d) 34
6. Which of the following functions is used to write data in the binary mode? (1)
(a) write (b) output
(c) dump (d) send
7. Fill in the blank: (1)
______ keyword is used to display non-repeated values in MySQL.
(a) Unique (b) Remove
(c) Distinct (d) All
8. Which of the following commands will change row(s) of the table from MySQL database? (1)
(a) REPLACE TABLE (b) CHANGE TABLE
(c) UPDATE (d) ALTER TABLE

Model Test Paper–1 A.1


9. Which of the following statement(s) would give an error after executing the following code? (1)
tup = (20,30,40,50,80,79)
print(tup) #Statement 1
print(tup[3]+50) #Statement 2
print(max(tup)) #Statement 3
tup[4]=80 #Statement 4
(a) Statement 1 (b) Statement 2
(c) Statement 3 (d) Statement 4
10. Fill in the blank: (1)
_________ is a table constraint that will prevent the entry of duplicate rows.
(a) Primary Key (b) NULL
(c) Unique (d) Distinct
11. Which of the following is the correct syntax of file object ‘fobj’ to write sequence data type using writelines()
function? (1)
(a) file.writelines(sequence)
(b) fobj.writelines()
(c) fobj.writelines(sequence)
(d) fobj.writeline()
12. Fill in the blank: (1)
HAVING clause is used in combination with ____________ clause.
(a) GROUP BY (b) Where
(c) IN (d) Order By
13. The network that connects many organizations spread over one or more countries or continents is
known as: (1)
(a) WWW (b) LAN
(c) PAN (d) WAN
14. Which statement consists of a logical operator? (1)
(a) a+b**c (b) a >b:
(c) a and b not c (d) 2 in a
15. Which of the following function can work with NULL values in a database? (1)
(a) avg() (b) sum()
(c) count(*) (d) total(*)
16. Which command is used for counting the number of rows in a database? (1)
(a) row (b) rowcount
(c) count() (d) row_count
Q17 and 18 are Assertion and Reason-based questions. Mark the correct choice:
(i) Both A and R are true and R is the correct explanation for A
(ii) (ii) Both A and R are true and R is not the correct explanation for A
(iii) A is True but R is False
(iv) A is False but R is True
17. Assertion (A): Function can take input values as parameters, execute them and return output (if required)
to the calling function with a return statement. (1)
Reason (R): A function in Python can return multiple values.
18. Assertion (A): Pickle in Python is primarily used in serializing and deserializing a Python object structure.
Reason (R): pickle.dump() method is used to write the object in file and pickle.load() method is used to read
the object from pickled file. (1)
A.2 Computer Science–XII
SECTION – B
19. Shristi has written a Python program to add all the numbers of the list. Her code is having errors. Rewrite
the correct code and underline the corrections made. (2)
define sum(numbers):
total = 0
for x in numbers
total += x
returns total
print(sum([4, 6, 3, 5, 6]))
20. What is the use of Modem and Router in a network? (2)
OR
Write two points of difference between Star topology and Bus topology.
21. (a) Given is a Python string declaration: (2)
mySubject = "Computer Science with Python"
(i) Write the output of: print(mySubject[-27:-10:2])
(b) Write the output of the code given below:
>>>a=[10,20,30,40,50,60,70]
>>> a[3:5]=[100,1000]
>>> a[3:5]=[10000]
>>> print(a)
22. What is the difference between ‘Primary Key’ and ‘Foreign Key’? Can a table have multiple Primary keys or
Foreign keys? (2)
23. (a) What is the use of VoIP? (1)
(b) Write the full form of: (i) POP (ii) XML (1)
24. Write the output of the given code: (2)
def Display(l):
L2=[]
for n in l:
if n % 2 == 0:
l2.append (n)
return l2
print(Display([100, 228, 333, 432, 509, 60, 787, 800, 967]))
OR
Predict the output of the Python code given below:
t1=(10,20,"book",30,9.5,"item",[12,13],(3,4),30,5,30)
print(t1.index(20))
print( t1.index(30))
print(t1.count(30))
print(t1[–8:–4])
25. Write any two aggregate functions in SQL with an appropriate example. (2)
OR
Write two commands each of DDL and DML commands in SQL.

Model Test Paper–1 A.3


SECTION – C
26. (a) Consider the following tables – CARDEN and CUSTOMER: (1+2)
Table: CARDEN Table: CUSTOMER
Code CarName Charges Code CarName
501 A-Star 18 1001 Hemant Sahu
503 Indigo 16 1002 Raj Lal
502 Innova 15 1003 Feroza Shah
509 SX4 14 1004 Ketan Dhar
What will be the output of the following statement?
SELECT * FROM CARDEN, CUSTOMER;
(b) Write the output of the queries (i) to (iv) based on the table, STOCK given below:
Table: STOCK
ItemNo Item Dcode Qty UnitPrice StockDate
5005 Ball Pen 0.5 102 100 16 2010-03-31
5003 Ball Pen 0.25 102 150 20 2010-01-01
5002 Gel Pen Premium 101 125 14 2010-02-14
5006 Gel Pen Classic 101 200 22 2009-01-01
5001 Eraser Small 102 210 5 2009-03-19
5004 Eraser Big 102 60 10 2009-12-12
5009 Sharpener Classic 103 160 8 2009-01-23
Table: DEALERS
Dcode DName
101 Reliable Stationers
103 Classic Plastics
102 Clear Deals
(i) SELECT Dcode, MAX(UnitPrice) FROM STOCK GROUP BY Dcode;
(ii) SELECT COUNT(DISTINCT Dcode) FROM STOCK;
SELECT
(iii) Qty*UnitPrice FROM STOCK WHERE ItemNo=5006;
(iv) SELECT MIN(StockDate) FROM STOCK;
27. Write a user-defined function Count_H_T() in Python that displays the number of lines starting with ‘H’ and
‘T’ in the file “Poem.txt”. Example, if the file contains: (3)
Here we go round the mulberry bush,
The mulberry bush,
The mulberry bush.
Here we go round the mulberry bush
On a cold and frosty morning.
The line count should be 4.
OR
Write a function Replace_Space() in Python which should read each character of a text file “MYFILE.TXT”
and then replace all spaces from text with dash (-).
Example:
If the file content is as follows:
The relative paths are relative to current working directory.
The Replace_Space() function should display the output as:
The-relative-paths-are-relative-to-current-working-directory.
A.4 Computer Science–XII
28. (a) Write the outputs of the SQL queries (i) to (iv) based on the relations MOBILEMASTER & MOBILESTOCK
given below: (3)
Table: MOBILEMASTER
M_Id M_Company M_Name M_Price M_Mf_Date
MB001 Samsung Galaxy 4500 2013-02-12
MB003 Nokia N1100 2250 2011-04-15
MB004 Micromax Unite3 4500 2016-10-17
MB005 Sony XperiaM 7500 2017-11-20
MB006 Oppo SelfieEx 8500 2010-08-21
Table: MOBILESTOCK
S_Id M_Id M_Qty M_Supplier
S001 MB004 450 New Vision
S002 MB003 250 Praveen Gallery
S003 MB001 300 Classic Mobile Store
S004 MB006 150 A-one Mobiles
S005 MB003 150 The Mobile
S006 MB006 50 Mobile Centre
(i) SELECT M_Company, M_Name, M_Price,M_Qty FROM MOBILEMASTER MM,
MOBILESTOCK MS, WHERE MM.M_ID= MS.M_ID;
(ii) SELECT MAX(M_Price) FROM MOBILEMASTER WHERE M_Name LIKE "S%";
(iii) SELECT M_Supplier, M_Qty FROM MOBILESTOCK WHERE M_Id ="MB003";
(iv) SELECT M_Company FROM MOBILEMASTER WHERE M_Price BETWEEN 3000 AND
5000;
(b) Write a command to open an existing database ‘Stock’.
29. Write the definition of a method COUNTNOW(PLACES) to find and display those place names in which there
are more than five characters after storing the name of places in a dictionary. (3)
For example, if the dictionary PLACES contains:
{'1': "DELHI", '2': "LONDON", '3': "PARIS", '4': "NEW YORK", '5': "DUBAI"}
The following output should be displayed:
LONDON NEW YORK
30. A list contains the following record of a Hostel: [Hostel_No, Total_Students, Total Rooms] (3)
Write the following user defined functions to perform given operations on the stack named ‘Hostel’:
(i) Push_element() - To push an object containing Hostel_No and Total Students along with Total Rooms
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.
For example:
If the lists of Hostel details are:
[1,2000,1000]
[2, 1500,800]
[3,5000,2000]
The output should be:
[1,2000,1000]
[2, 1500,800]
[3,5000,2000]
Stack Empty

Model Test Paper–1 A.5


OR
Write a program to implement a Stack for book_details (book name : book price) where book name is a key
and book price is value. Write a function in Python, Push(book_details) where book_details is a dictionary
containing the details of books– {book_name : book_price}. The function should push the names of those
books in the stack which have price greater than 500. Also display the count of books pushed into the stack.
For example: If the dictionary contains the following data: books={"Python":560,"Java":450,"MySQL":330,"Web
Development":725}
The stack should contain Python and Web Development.
The output should be: The count of books in the stack is 2.
SECTION – D
31. Sony has set up its Branch at Srinagar for its office and web-based activities. It has four zones of buildings
as shown in the diagram: (5)
Zone Zone
Z Y

Zone Zone
X U
Branch-to-branch distance is:
Zone X to Zone Z 40 m
Zone Z to Zone Y 60 m
Zone Y to Zone X 135 m
Zone Y to Zone U 70 m
Zone X to Zone U 165 m
Zone Z to Zone U 80 m
Number of Computers:
Zone X 50
Zone Z 130
Zone Y 40
Zone U 15
(a) Suggest the most suitable cable layout or Networking Topology of connections between the zones.
(b) Suggest the most suitable place (i.e., Zone) to house the Server of this organization. Give a suitable
reason with justification.
(c) Suggest the placement of the following devices with justification:
(i) Repeater (ii) Hub/Switch
(d) Which is the most economic type of cable for the selected topology?
(e) Suggest a device/software to be installed in each branch to take care of data security.
32. (a) Write the output of the code given below: (2+3)
Val = 100
def display(N):
global Val
Val = 100
if N%2==0:
Val = Val ** N
else:
Val = Val * N
print(Val, end="$")
display(2)
print(Val)

A.6 Computer Science–XII


(b) The code given below inserts the following record in the table Fun_City:
Ticket_Id – integer
Name – string
Ticket_Price – integer
No_Of_Tickets – integer
Total_Amount – integer
Note the following to establish connectivity between Python and MySQL:
• Username is root
• Password is Ticket
• The table exists in a MySQL database named Amusement.
• The details (Ticket_Id, Name, Ticket_Price, No_of_Tickets) are to be accepted by the user.
Write the following missing statements to complete the code:
Statement 1 – To form the cursor object
Statement 2 – Write a command to execute the query
Statement 3 – Write a command to save data permanently in the database.
import mysql.connector as mysql
def sql_data():
con=mysql.connect(host="localhost",user="root", password="Ticket",
database="Amusement")
mycursor=_________________ #Statement 1
Ticket_No=int(input("Enter Ticket Number :: "))
Name=input("Enter Name :: ")
Ticket_Price= input("Enter Ticket Price :: ")
No_Of_Tickets=int(input("Enter No of tickets :: "))
Total_Amount= Ticket_Price * No_Of_Tickets
query="Insert into Fun_City values({},'{}',{},{})".format(Ticket_No,
Name, Ticket_Price, No_Of_Tickets, Total_Amount)
____________________ #Statement 2
______________________ #Statement 3
print("Data Added successfully")
OR
(a) Predict the output of the code given below:
def Change(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+'$'
print(m)
Change('IPv6 128-bit')

Model Test Paper–1 A.7


(b) The code given below reads the following record from the table named Employee and displays only
those records who have a Salary greater than 75000:
• EmpNo – integer
• EmpName – string
• Designation – string
• Salary – integer
Note the following to establish connectivity between Python and MySQL:
• Username is root
• Password is sales_emp
• The table exists in a MySQL database named “Office”.
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 employees whose salaries are
greater than 75000.
• Statement 3 – To read the complete result of the query (records whose salaries are greater than
75000) into the object named data from the table employee in the database.
import mysql.connector as mysql
def SQL_Office():
con=mysql.connect(host="localhost",user="root", password="sales_emp",
database="Office")
mycursor=_______________ #Statement 1
print("Employees with salaries greater than 75000 are : ")
_______________ #Statement 2
data=__________________ #Statement 3
for i in data:
print(i)
print()
33. What is the function of csv.writer() function? (5)
Write a program in Python that defines and calls the following user-defined functions:
(i) AddRecord() – To accept and add data of Mobile phones to a CSV file ‘Mobile_Phones.csv’. Each record
consists of a list with field elements as ModelNo, MobileName, Manufacturer and Price to store model
number, mobile name, manufacturer and price respectively.
(ii) Find() – To search the records of mobiles manufactured by Apple present in the CSV file named
‘Mobile_Phones.csv’.
OR
What is the benefit of using “with open()” method over “open()” method while opening a file?
Write a program in Python that defines and calls the following user-defined functions:
(i) Add_Item() – To accept and add data of stationery items to a CSV file ‘Stationery.csv’. Each record
consists of a list with field elements as Item_Id, Item_name and Item_price to store item id,
item_name and item_price.
(ii) Count() – To count the total number of stationery items in the CSV file.

A.8 Computer Science–XII


SECTION – E
34. Krishna, working as a computer professional in a hospital, creates a table OPD to store records of patients
registered in the OPD section. A sample of the records is given below: (1+1+2)
Table: OPD
Reg No Name Age Department Dateof_Reg Charges Gender Room No
R0123 Arpita 62 Gen. Physician 2022-01-21 500 M 10
R0124 Jai 22 ENT 2022-10-12 300 M 15
R0125 Kamal 32 Orthopaedic 2022-02-19 500 M 11
R0126 Arun 12 Paediatrician 2022-07-11 500 M 12
R0127 Neha 30 ENT 2022-01-12 300 F 15
R0128 Neetu 16 ENT 2022-09-24 300 F 15
R0129 Ankit 29 Cardiology 2022-02-20 800 F 20
Based on the data given above, answer the following questions:
(i) If the table “OPD” is to be linked with another table “Registration” in the same database named
“Hospital”, then identify the most appropriate column which can be used as a Foreign key in the
“Registration” table.
(ii) What is the cardinality and degree of the given table?
(iii) Write the statements to:
(a) Insert the following record into the table: RegNo–R130, Name–Naman, Age–30, Department–
ENT, Dateof_Reg–2022-10-10, Charges–700, Gender–M.
(b) Increase the OPD Charges of the ENT department by ` 200.
OR (Option for part iii only)
(iii) Write the statements to:
(a) Delete the column RoomNo from the table OPD.
(b) Add a new column Panel_Discount in the table with datatype as Varchar with 50 characters.
35. Vedansh is a Python programmer working in a school. For the Annual Sports Event, he has created a binary
file ‘Result.dat’ with Student_Id, St_Name, Game_Name and Result to store the results of students in
different sports events. After the event has been completed, he now wants to display the records of those
students who won the game, which is inserted in the Result field with ‘Won’ and ‘Loss’ data. As a Python
expert, help him complete the following code based on the requirement given above: (1+1+1+1)
import ___________ #Statement1
rec=[]
while True:
Student_Id=int(input(("Enter Student Id:")))
St_name=input("Enter name:")
Game_Name=input("Enter Salary:")
Result= input(“Enter Result:”)
data=[Student_Id, St_Name, Game_Name,Result]
rec.append(data)
Choice=input("Wish to enter more records: Y/N")
if Choice.upper()=='N':
break
f1=____________________#Statement2
pickle.dump(rec,f1)
print("Record added:")

Model Test Paper–1 A.9


fout=open("Result.dat",'rb')
res=________________ #Statement 3
count=0
for i in res:
if __________________: #Statement 4
st_id=i[0]
st_name=i[1]
game=i[2]
result=i[3]
count+=1
print(st_id,st_name,game,result)
print("Total students are", count)
fout.close()
(i) Write a statement to import the module. (Statement 1)
(ii) Write a statement to open a binary file in write mode. (Statement 2)
(iii) Write the correct statement required to load the file. (Statement 3)
(iv) Write a statement to check if result field contains ‘Won’ or ‘won’. (Statement4)

A.10 Computer Science–XII

You might also like