CBSE Class XII Computer Science - Practice Test
Students

Academic Programs

AI-powered learning for grades 8-12, aligned with major curricula

Professional

Professional Courses

Industry-relevant training in Business, Technology, and Design

Games

Interactive Games

Fun games to boost memory, math, typing, and English skills

CBSE Class XII Computer Science - Practice Test

2025-07-14

Duration

15 min

Questions

35

Marking

Negative

Test Currently Unavailable

This mock test may have expired, be pending approval, or still be processing. Please check back later or contact support.

Questions Preview

Which of the following is an invalid identifier to be used in Python?

A
per%marks
B
_for
C
While
D
true

What is the correct way to add an element to the end of a list in Python?

A
list.add(element)
B
list.append(element)
C
list.insert(element)
D
list.extend(element)

What will be the output of print("Welcome To My Blog"[2:6] + "Welcome To My Blog"[5:9])?

A
Lcomme
B
lcomme T
C
lcomme To
D
lcomme

Which of the following statements is false?

A
A try-except block can have more than one except statement
B
One block of except statement cannot handle multiple exceptions
C
The finally block is always executed
D
When 1 == "1" is executed, no exception is raised

Which of the following statement(s) would give an error during the execution of the code with dictionary R = {'pno':52,'pname':'Virat', 'expert':['Badminton','Tennis'] ,'score':(77,44)}?

A
print(R) #Statement 1
B
R['expert'][0]='Cricket' #Statement 2
C
R['score'][0]=50 #Statement 3
D
R['pno']=50 #Statement 4

Which pickle module method is used to write a Python object to a binary file?

A
save()
B
serialize()
C
store()
D
dump()

Given dictionaries dict_student = {"rno" : "53", "name" : 'Rajveer Singh'} and dict_marks = {"Accts" : 87, "English" : 65}, which statement will append the contents of dict_marks in dict_student?

A
dict_student + dict_marks
B
dict_student.add(dict_marks)
C
dict_student.merge(dict_marks)
D
dict_student.update(dict_marks)

Which of the following is not a component of the math module in Python?

A
ceil()
B
mean()
C
fabs()
D
pi

What will be the output of the following code? L=["One , Two", "Three", "Four"]; print(len(L)/2*len(L[0]))

A
6.5
B
13
C
13.5
D
6.0

What does PPP stand for in networking?

A
Point-to-Point Protocol
B
Peer-to-Peer Protocol
C
Public Private Partnership
D
Personal Privacy Protocol

Which SQL operator performs pattern matching?

A
BETWEEN operator
B
LIKE operator
C
EXISTS operator
D
= operator

Which Python function is used for displaying only one result set from SQL table in a database?

A
fetch1()
B
fetchno()
C
fetchall()
D
fetchone()

Which of the following file opening mode in Python, generates an error if the file does not exist?

A
a
B
r
C
w
D
w+

The correct syntax of seek() is:

A
file_object.seek(offset [, reference_point])
B
seek(offset [, reference_point])
C
seek(offset, file_object)
D
seek.file_object(offset)

Which of the following statements is false?

A
SMTP and POP protocols are used in email communication
B
URL of a page is not always the same as its domain name
C
HTTPS is safer than HTTP
D
Interlinking of collection of webpages is called Internet

_ protocol provides access to services hosted on a remote computer.

A
FTP
B
PPP
C
Telnet
D
SMTP

Assertion (A): For changes made to a variable defined within a function to be visible outside the function, it should be declared as global. Reasoning (R): Variables defined within a function are local to that function by default, unless explicitly specified with the global keyword.

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

Assertion (A): A binary file in python is used to store collection objects like lists and dictionaries that can be later retrieved in their original form using pickle module. Reasoning (R): Binary files are just like normal text files and can be read using a text editor like Notepad.

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

Which of the following is an advantage of circuit switching?

A
Guaranteed bandwidth and low latency
B
Efficient use of network resources
C
Supports variable data rates
D
Cost effective for short communications

Identify the syntax error in the following code: num1, num2 = 10, 45; While num1 % num2 == 0; num1+= 20; num2+= 30; Else: print('hello')

A
While should be while (lowercase)
B
Missing colon after While condition
C
Else should be else (lowercase)
D
All of the above

What will be the output when a function dispBook(BOOKS) displays names in uppercase of books whose name starts with a consonant, given BOOKS = {1:"Python", 2:"Internet Fundamentals", 3:"Networking", 4:"Oracle sets", 5:"Understanding HTML"}?

A
PYTHON, NETWORKING
B
PYTHON, NETWORKING, UNDERSTANDING HTML
C
INTERNET FUNDAMENTALS, ORACLE SETS
D
All book names in uppercase

What will be the output of the following code? L = [5,10,15,1]; G = 4; def Change(X): global G; N=len(X); for i in range(N): X[i] += G; Change(L); for i in L: print(i,end='$')

A
5$10$15$1$
B
9$14$19$5$
C
1$6$11$-3$
D
Error

Which Python statement is used to delete an element 'Mumbai':50 from Dictionary D?

A
del D['Mumbai']
B
D.remove('Mumbai')
C
D.delete('Mumbai')
D
D.pop('Mumbai':50)

What is the difference between % (percentage) and _ (underscore) characters used with the LIKE operator in SQL?

A
% matches any sequence of characters, _ matches exactly one character
B
_ matches any sequence of characters, % matches exactly one character
C
Both match any sequence of characters
D
Both match exactly one character

If SELECT count(Department) and SELECT count(*) from Employee table are producing different results, what may be the possible reason?

A
Department column contains NULL values
B
Table has duplicate records
C
Department column has different data types
D
Table is empty

What will be the output of SELECT * FROM BOOK NATURAL JOIN MEMBER; when tables BOOK and MEMBER share a common column CODE?

A
All records from both tables
B
Only matching records based on CODE column
C
Cross product of both tables
D
Error because tables are incompatible

What will be the output of SELECT FID, MIN(FEES), MAX(FEES) FROM COURSES GROUP BY FID; from the COURSES table?

A
FID with minimum and maximum fees for each faculty
B
Overall minimum and maximum fees
C
Error because of GROUP BY clause
D
All faculty IDs with same min and max values

A function COUNT() reads from 'Gratitude.txt' and displays count of letter 'e' in each line. If line 1 contains 'Gratitude is a humble heart's radiant glow,', what should be the count?

A
2
B
3
C
4
D
5

In the RESULT table with columns ADNO, ROLLNO, SNAME, SEM1, SEM2, DIVISION, which columns can be considered as candidate keys?

A
ADNO only
B
ROLLNO only
C
ADNO and ROLLNO
D
SNAME and DIVISION

Given a Stack implementation for student IDs who scored ≥80 in TS3, if Stu_dict ={5:(87,68,89), 10:(57,54,61), 12:(71,67,90), 14:(66,81,80), 18:(80,48,91)}, which IDs will be pushed to the stack?

A
[5, 12, 14, 18]
B
[5, 10, 12, 18]
C
[12, 14, 18]
D
[5, 18]

A function maxsalary() reads from 'record.csv' containing employee data (E_code, E_name, Scale, Salary) and should display the row with maximum salary. What approach should be used?

A
Read all rows, find max salary, display that row
B
Sort the CSV file first, then read last row
C
Use SQL MAX function
D
Read first row only

A function expensiveProducts() reads from binary file 'INVENTORY.DAT' with structure (ProductID, ProductName, Quantity, Price) and displays products with price > Rs. 1000. What module is required?

A
csv module
B
pickle module
C
json module
D
os module

For Fun Media Services Ltd network in Mumbai with buildings ADMIN(110 computers), DECORATORS(75), MEDIA(12), FOOD(20), which building should host the server?

A
ADMIN - highest number of computers
B
MEDIA - central location
C
FOOD - closest to all buildings
D
DECORATORS - balanced location

What is the difference between seek() and tell() functions in Python file handling?

A
seek() sets file position, tell() returns current position
B
tell() sets file position, seek() returns current position
C
Both set file position
D
Both return current position

In MySQL-Python connectivity, to establish connection with database 'STORE', which parameter is missing in mysql.connect(host='localhost', user='root', password='____', database='STORE')?

A
admin
B
root
C
tiger
D
localhost