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

Class 12 Sample Paper

Uploaded by

drarohitkarumaka
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views

Class 12 Sample Paper

Uploaded by

drarohitkarumaka
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

ST.

MARY’S ARCADIAN SCHOOL


CLASS – XII SUBJECT – Computer Science
CH NAME- SAMPLE PAPER

Section
–A
Q01. State True or False (1)
“Tuple is datatype in Python which contain data in key-value pair.”

Q02. Which of the following is not a keyword? (1)


(A) eval (B) assert
(C) nonlocal (D) pass

Q03. Given the following dictionaries (1)


dict_student = {"rno" : "53", "name" : ‘Rajveer Singh’}
dict_marks = {"Accts" : 87, "English" : 65}
Which statement will merge the contents of both dictionaries?
(A) dict_student + dict_marks (B) dict_student.add(dict_marks)
(C) dict_student.merge(dict_marks) (D) dict_student.update(dict_marks)
Q04. Consider the given expression: (1)
not ((True and False) or True)

Which of the following will be correct output if the given expression is evaluated?
(A) True (B) False
(C) NONE (D) NULL
Q05. Select the correct output of the code: (1)
>>> s='[email protected]'
>>> s=s.split('kv')
>>> op = s[0] + "@kv" + s[2]
>>> print(op)
(A) mail2@kvsangathan (B) mail2@sangathan.

(C) mail2@kvsangathan. (D) mail2kvsangathan.


Q06. Which functions is used to close a file in python? (1)
(A) close (B) cloose()
(C) Close() (D) close()

Page1|7
Q07. Fill in the blank: (1)
command is used to change table structure in SQL.
(A) update (B) change
(C) alter (D) modify
Q08. Which of the following commands will remove the entire database from MYSQL? (1)
(A) DELETE DATABASE (B) DROP DATABASE
(C) REMOVE DATABASE (D) ALTER DATABASE
Q09. Which of the following statement(s) would give an error after executing the following (1)
code?D={'rno':32,'name':'Ms Archana','subject':['hindi','english','cs'],'marks':(85,75,89)}
#
S1 print(D)
#
S2
D['subject'][2]='IP' #S3
D['marks'][2]=80 #S4
print(D) #S5
(A) S1 (B) S3
(C) S4 (D) S3 and S4
Q10. Fill in the blank: (1)
is a non-key attribute, whose values are derived from the primary key of some other
table.
(A) Primary Key (B) Candidate Key
(C) Foreign Key (D) Alternate Key
Q11. The correct syntax of seek() is: (1)
(A) seek(offset [, reference_point]) (B) seek(offset, file_object)
(C) seek.file_object(offset) (D) file_object.seek(offset [, reference_point])

Q12. Fill in the blank: (1)


The SELECT statement when combined with clause, returns records without repetition.
(A) DISTINCT (B) DESCRIBE
(C) UNIQUE (D) NULL

Q13. Fill in the blank: (1)


is a communication methodology designed to deliver both voice and multimedia
communications over Internet protocol.
(A) SMTP (B) VoIP
(C) PPP (D) HTTP

Page2|7
Q14. What will the following expression be evaluated to in Python? print ( round (100.0 / 4 + (3 + (1)
2.55) , 1 ) )
(A) 30.0 (B) 30.55
(C) 30.6 (D) 31

Q15. Which function is used to display the total number of records from a table in a database? (1)
(A) total() (B) total(*)
(C) return(*) (D) count(*)

Q16. In order to open a connection with MySQL database from within Python using mysql.connector (1)
package, function is used.
(A) open (B) connect
(C) database() (D) connectdb()

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. str1= “Class” + ”Work” (1)
ASSERTION: Value of str1 will be “ClassWork”.
REASONING: Operator ‘+’ adds the operands, if both are numbers & concatenates the string if
both operands are strings.

Q18. Assertion: CSV (Comma Separated Values) is a file format for data storage which looks (1)
like atext file.
Reason (R): The information is organized with one record on each line and each field is
separated
by semi-colon.
Section–
B

Page3|7
Q19. Vivek has written a code to input a number and check whether it is even or odd number. His (2)
codeis having errors. Rewrite the correct code and underline the corrections made.
Def
checkNumber
(N):status =
N%2 return
#main-code
num=int( input(“ Enter a number to check
:))k=checkNumber(num)
if k = 0:
print(“This is EVEN
number”)else:
print(“This is ODD number”)
Q20. Write two points of difference between Bus topology and star topology. (2)
OR
Write two points of difference between XML and HTML.

Q21. (A) Given is a Python string declaration: (2)


message='FirstPreBoardExam@2022-
23' Write the output of: print(message[ : : -
3].upper())

(B) Write the output of the code given below:


d1={'rno':25, 'name':'dipanshu'}
d2={'name':'himanshu',
'age':30,'dept':'mechanical'}d2.update(d1)
print(d2.keys())
Q22. Explain the use of ‘Foreign Key’ in a Relational Database Management System. Give example (2)
to
support your answer.
Q23. (A) Write the full forms of the following: (2)
(i) HTTP (ii) FTP
(B) What is the use of TELNET?
Q24. Predict the output of the Python code given below: data=["L",20,"M",40,"N",60] (2)
times=0 alpha="" add=0

for c in range(1,6,2): times = times + c


alpha = alpha + data [c-1] + "@" add = add + data[c]
print (times, add, alpha)
Page4|7
OR

Predict the output of the Python code given below: L=[1,2,3,4,5]


Lst=[]
for i in range(len(L)): if i%2==1:
t=(L[i],L[i]**2) Lst.append(t)
print(Lst)
Q25. Differentiate between order by and group by clause in SQL with appropriate example. (2)

OR

Categorize the following commands as DDL or DML:


INSERT, UPDATE, ALTER, DROP
Section
–C
Q26. Write the output of the queries (i) to (vi) based on the table given below: (3)

(i) Select BRAND_NAME, FLAVOUR from CHIPS where PRICE <> 10;
(ii) Select * from CHIPS where FLAVOUR=”TOMATO” and PRICE > 20;
(iii) Select BRAND_NAME from CHIPS where price > 15 and QUANTITY < 15;
(iv) Select count( distinct (BRAND_NAME)) from CHIPS;
(v) Select price , price *1.5 from CHIPS where FLAVOUR = “PUDINA”;
(vi) Select distinct (BRAND_NAME) from CHIPS order by BRAND_NAME desc;

Q27. Write a function countINDIA() which read a text file ‘myfile.txt’ and print the (3)
frequencyof the words ‘India’ in it (ignoring case of the word).
Example: If the file content is as follows:

INDIA is my country. I live in India. India has many

states.The countIndia() function should display the

output as:
Frequency of India is 3

OR

Page5|7
Write a function countVowel() in Python, which should read each character of a text file
“myfile.txt” and then count and display the count of occurrence of vowels (including small
cases

and upper case). Example:


If the file content is as follows:
INDIA is my country. I live in India. India has many states.
The countVowel() function should display the output as: Total number of vowels are
: 20

Q28. (A) Consider the following tables BOOKS and ISSUED in a database named (3)
“LIBRARY”. Write SQL commands for the statements (i) to (iv).
Table: BOOKS
Table: ISSUED
(i) Display book name and author name and price of computer type books.
(ii) To increase the price of all history books by Rs 50.
(iii) Show the details of all books in ascending order of their prices.
(iv) To display book id, book name and quantity issued for all books which have been issued.
(B) Write the command to view all tables in a database.

Q29. Write a function lenFOURword(L), where L is the list of elements (list of words) (3)
passed as argument to the function. The function returns another list named
‘indexList’ that stores the indices of all four lettered word of L.
For example:

If L contains [“DINESH”, “RAMESH”, “AMAN”, “SURESH”, “KARN”]


The indexList will have [2, 4]

Q30. A list contains following record of a student: (3)


[StudentName, Class, Section, MobileNumber]
Write the following user defined functions to perform given operations on the stack
named ‘xiia’:

(i) pushElement() - To Push an object containing name and mobile number of students
who belong to class xii and section ‘a’ to the stack
(ii) popElement() - To Pop the objects from the stack and display them. Also, display

Page6|7
“Stack Empty” when there are no elements in the stack.
For example:
If the lists of students details are:
[“Rajveer”, “99999999999”,”XI”, “B”]
[“Swatantra”, “8888888888”,”XII”, “A”]
[“Sajal”,”77777777777”,”VIII”,”A”]
[“Yash”, “1010101010”,”XII”,”A”]

The stack “xiia” should contain [“Swatantra”, “8888888888”]


[“Yash”, “1010101010”]

The output should be:


[“Yash”, “1010101010”]
[“Swatantra”, “8888888888”] Stack Empty

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 25. Also display the count of elements pushed into the stack.
For example:
If the dictionary contains the following data:

Ditem = {“Rubber”:5, "Pencil":5, "Pen":30, "Notebook": 60, "Eraser":5, “Watch”: 250}


The stack should contain
Pen
Notebook
Watch
The output should be:
The count of elements in the stack is 3
Section
–D

Page7|7
Q31. Aryan Infotech Solutions has set up its new center at Kamla Nagar for its office and web based (5)
activities. The company compound has 4 buildings as shown in the diagram below:

Orbit
Building
Sunrise
Jupiter
Building
Building

Oracle
Buildig

Distance between various buildings.


Jupiter Building to Orbit Building 50 Mtrs
Orbit Building to Oracle Building 85 Mtrs.
Oracle Building to Sunrise Building 25 Mtrs.
Sunrise Building to Jupiter Building 170 Mtrs.
Jupiter Building to Oracle Building 125 Mtrs.
Orbit Building to Sunrise Building 45 Mtrs.

Number of Computers in each of the buildings is follows:


Jupiter Building 30
Orbit Building 150

Page8|7
Oracle Building 15
Sunrise Building 35

i) Suggest a cable layout of connections between the buildings.


ii) Suggest the most suitable place (i.e. building) to house the server of this organisation with
asuitable reason
iii) Suggest the placement of the following devices with justification:
a. Internet Connecting Device/Modem
b. Switch
iv) The organisation is planning to link its sale counter situated in various parts of the same
city,which type of network out of LAN, MAN or WAN will be formed? Justify your answer.
v) What do your mean by PAN? Explain giving example.
Q32 (A) Write the output of the code given below: (2+3
. )
def
printMe(q,r=2):
p=r+q**3
print(p)

#main-
codea=10
b=5
printMe(a,
b)
printMe(r=4,q=2)

(B) The code given below inserts the following record in the table Student:

Note the following to establish connectivity between Python and MySQL:


* Username is root
* Password is toor@123
* The table exists in a “stud” database.
* The details (RollNo, Name, Clas and Marks) are to be accepted from the
user.Write the following missing statements to complete the code:
Statement 1 – to form the cursor object

Page9|7
Statement 2 – to execute the command that inserts the record in the table Student.
Statement 3 - to add the record permanently in the database
import mysql.connector as mysql
def sqlData():
con1=mysql.connect(host="localhost",user="root", password="toor@123",
database="stud")mycursor = #Statement 1
rno=int(input("Enter Roll Number :: "))
name=input("Enter name :: ")
clas=int(input("Enter class :: "))
marks=int(input("Enter Marks :: "))
querry="insert into student values({},'{}',{},{})".format(rno,name,clas,marks)
#Statement 2
# Statement 3
print("Data Added successfully")

OR
(A) Predict the output of the code given below:
s="C++VsPy"
m=""
for i in range(0, len(s)):
if (s[i] >= 'a' and s[i] <= 'm'):
m = m +s[i].upper()
elif (s[i] >= 'n' and s[i] <= 'z'):
m = m +s[i-1]
elif (s[i].isupper()):
m = m + s[i].lower()
else:
m = m +'&'
print(m)

(B) The code given below reads the following record from the table named student and
displaysonly those records who have marks greater than 90:

Integer String Integer Integer

P a g e 10 |
7
Note the following to establish connectivity between Python and MySQL:
* Username is root
* Password is toor@123
* The table exists in a “stud” database.
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 students whose marks are greater
than 90.
Statement 3- to read the complete result of the query (records whose marks are greater than 90)
into the object named data, from the table student in the database.
import mysql.connector as mysql
def sql_data():
con1=mysql.connect(host="localhost",user="root",password="toor@123",
database="stud")mycursor= #Statement 1
print("Students with marks greater than 90 are : ")
#Statement 2
data= #Statement
3for i in data:
print(i)
print()

Q33. What is the advantage of using a csv file for permanent storage? (5)
Write a Program in Python that defines and calls the following user defined functions:
(i) ADD() – To accept and add data of a teacher to a CSV file ‘teacher.csv’. Each record consists
of a list with field elements as tid, name and mobile to store teacher id, teacher name and
teachermobile number respectively.
(ii) COUNTRECORD() – To count the number of records present in the CSV file
named‘teacher.csv’.
OR
Give any one point of difference between a binary file and a csv file.
Write a Program in Python that defines and calls the following user defined functions:

P a g e 11 |
7
(i) add() – To accept and add data of an employee to a CSV file ‘employee.csv’. Each record
consists of a list with field elements as eid, name and salary to store employee id, employee
nameand employee salary respectively.
(ii) search()- To display the records of the employee whose salary is more than 40000.
Section
–E
Q34. Layna creates a table STOCK to maintain computer stock in vidyalaya. After creation of (1+
thetable, she has entered data of 8 items in the table. 1+
2)

Based on the data given above answer the following questions:


(i) Identify the most appropriate column, which can be considered as Primary key.
(ii) If three columns are added and 5 rows are deleted from the table stock, what
will bethe new degree and cardinality of the above table?
(iii) Write the statements to:
(a) Insert the following record into the table
Stockid - 201, dateofpurchase – 18-OCT-2022, name –
neckphoneMake – BoAT, price - 500
(b) Decrease the price of stock by 5% whose were purchased in year
2020OR (Option for part iii only)
(iii) Write the statements to:
(a) Delete the record of stock which were purchased before year 2015.
(b) Add a column STATUS in the table with datatype as char with 1 characters
Q35. Vishnu is a Python programmer. He has written a code and created a binary file record.dat with (1+
studentid, subjectcode and marks. The file contains 10 records. 1+
He now has to update a record based on the studentid id entered by the user and update the 2)
marks.
The updated record is then to be written in the file temp.dat. The records which are not to be

P a g e 12 |
7
updated also have to be written to the file temp.dat. If the student id is not found, an
appropriatemessage should to be displayed.
As a Python expert, help him to complete the following code based on the requirement
givenabove:
import #Statement 1
def
update_data
():rec={}
fin=open("record.dat","rb")
fout=open(" ")
#Statement 2found=False
sid=int(input("Enter student id to update his marks ::
"))while True:
try:
rec =
#Statement 3if rec["studentid"]==sid:
found=True
rec["marks"]=int(input("Enter new marks :: "))
pickle. #Statement 4
else:
pickle.dump(rec,fout)
except:
break
if found==True:
print ("The marks of studentid ", sid ," has been updated.")
else:
print("No student with such id is not
found")fin.close()
fout.close()
(i) Which module should be imported in the program? (Statement 1)
(ii) Write the correct statement required to open a temporary file named temp.dat. (Statement 2)
(iii) Which statement should Aryan fill in Statement 3 to read the data from the binary
file,record.dat and in Statement 4 to write the updated data in the file, temp.dat?

P a g e 13 |
7

You might also like