Class 12 Computer Science Sample Paper Set 10
Class 12 Computer Science Sample Paper Set 10
Join School of Educators' exclusive WhatsApp, Telegram, and Signal groups for FREE access
to a vast range of educational resources designed to help you achieve 100/100 in exams!
Separate groups for teachers and students are available, packed with valuable content to
boost your performance.
Additionally, benefit from expert tips, practical advice, and study hacks designed to enhance
performance in both CBSE exams and competitive entrance tests.
Don’t miss out—join today and take the first step toward academic excellence!
COMPUTER SCIENCE
All questions are compulsory. However, internal choices have been provided in some questions. Attempt only one
of the choices in such questions.
Section A
1. State true or false: [1]
The value of the expressions 4/(3*(4-2)) and 4/3*(4-2) is the same.
2. Fill in the blank: [1]
________ clause is used with SELECT statement to display data in a sorted form with respect to a specified
column.
a) HAVING b) WHERE
c) ORDER BY d) DISTINCT
3. Which command is used to display the name of existing databases? [1]
a) rstrip() b) lstrip()
a) s.__getitem__(i) b) s.getitem(i-1)
c) s.__getitem__(i-1) d) s.getitem(i)
9. Which of the following is not a valid datatype in SQL? [1]
a) DECIMAL b) DATE
c) STRING d) CHAR
10. What will be the output of the following code? [1]
fn = file ("poem.txt","r")
size = len(fn.read())
print fn.read(5)
11. State true or false: [1]
A python function may return multiple values.
12. Which data structure is used for implementing recursion? [1]
a) List b) Queue
c) Array d) Stack
13. What is data inconsistency? [1]
14. A ________ is a network point that acts as an entrance to another network. [1]
a) Hub b) Repeater
c) Gateway d) Bridge
15. What will be the output of the following code snippet? [1]
rec = {"Name" : "Python", "Age" : "20", "Addr" : "ND", "Country" : "USA"}
id1 = id(rec)
del rec
rec= {"Name" : "Python", "Age":"20", "Addr" : "N2", "Country" : "USA"}
id2 = id(rec)
print(id1 == id2)
a) False b) 1
c) True d) Exception
16. The operation whose result contains all pairs of tuples from the two relations, regardless of whether their [1]
attribute values match.
a) Trojan b) Worm
a) Both A and R are true and R is the correct b) Both A and R are true but R is not the
explanation of A. correct explanation of A.
a) Both A and R are true and R is the correct b) Both A and R are true but R is not the
explanation of A. correct explanation of A.
a) Both A and R are true and R is the correct b) Both A and R are true but R is not the
explanation of A. correct explanation of A.
25. A resultset is extracted from the database using the cursor object (that has been already created) by giving the [2]
following statement.
Mydata = cursor.fetchone()
i. How many records will be returned by fetchone() method?
ii. What will be the datatype of Mydata object after the given command is executed?
26. Write a function in Python that displays the book names having 'Y' or 'y' in their name from a text file [2]
'Bookname.txt'.
Example:
If the file 'Bookname.txt' contains the names of following books:
One Hundred Years of Solitude
The Diary of a Young Girl
On the Road
After execution, the output will be:
One Hundred Years of Solitude
The Diary of a Young Girl
OR
Write a Python program to check whether entered string is palindrome or not.
27. What is the output produced by following code? [2]
obj = open("New.txt", "w")
obj.write("A poem by Paramhansa Yogananda")
obj.write("Better than Heaven or Arcadia")
obj.write("I love thee, O my India !")
obj.write("And thy love I shall give")
obj.write("To every brother nation that lives.")
obj.close()
obj1 = open("New.txt", "r")
s1 = obj1.read(48)
print(sl)
obj1.close()
OR
Write a program to search the name and address of person having age more than 30 in the data list of person.
28. Make Python program and ask a question to user. [2]
Hint: What is your lucky number and print that number?
Section C
29. Write the definition of a function Sum3(L) in Python, which accepts a list L of integers and displays the sum of [3]
all such integers from the list L which end with the digit 3.
For example, if the list L is passed
[123, 10, 13, 15, 23]
then the function should display the sum of 123, 13, 23, i.e. 159 as follows:
Sum of integers ending with digit 3 = 159
OR
Find the errors in code given below:
i. def minus(total, decrement)
output = total - decrement
print(output)
return (output)
ii. define check()
N = input ('Enter N:')
i=3
answer = 1 + i * * 4/N
Return answer
iii. def alpha(n, string = 'xyz', k = 10) :
return beta(string)
return n
def beta (string)
return string == str(n)
print(alpha("Valentine's Day"):)
print(beta (string = 'true'))
print(alpha(n=5, "Good-bye") :)
30. Write the output (i-iii) for the following SQL commands. [3]
Table : FASHION
class Book
{
char Bno[20];
protected:
float Price;
public:
void GetB();
void ShowB();
};
class Member
{
char Mno[20];
protected:
char Name[20];
public:
void GetM();
void ShowM();
};
class Library : public Member, private Book
{
char Lname[20];
public:
void GetL();
void ShowL();
};
void main()
{
Library L;
}
i. Which type of Inheritance out of the following is illustrated in the above example?
- Single Level Inheritance, Multilevel Inheritance, Multiple Inheritance
ii. Write the names of all the data members, which are directly accessible by the member function GetL() of
class Library.
iii. Write the names of all the member functions, which are directly accessible by the member function
ShowL() of class Library.
iv. Write the names of all the members, which are directly accessible by the object L of class Library declared
in the main() function.
OR
Write a function that receives an octal number and prints the equivalent number in other number bases i.e., in
decimal, binary, and hexadecimal equivalents.
Section D
32. Write Push (contents) and Pop (contents) methods in Python to add numbers and remove numbers considering [4]
them to act as Push and Pop operations of stack.
OR
Write a program to print a string in reverse order.
33. A binary file "Book.dat" has structure [BookNo, Book_Name, Author, Price], [4]
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"
34. Consider the following tables STUDENT and STREAM. Write SQL commands for the statements (i) to (v). [4]
TABLE: STUDENT
STRCDE STRNAME
1 SCIENCE+COMP
2 SCIENCE+BIO
3 SCIENCE+ECO
4 COMMERCE+MATHS
5 COMMERCE+SOCIO
6 ARTS+MATHS
7 ARTS+SOCIO
TABLE: ISSUED
Book_Id Quantity_Issued
F0001 3
T0001 1
C0001 5
Product client
ProductName ClientName
Manufacturer City
Price P_ID
Block A to Block B 50 m
Block C to Block D 25 m
Number of Computers
Block A 25
Block B 50
Block C 125
Block D 10
COURSE
i. Display the Trainer Name, City & Salary in descending order of their Hiredate.
ii. To display the TNAME and CITY of Trainer who joined the Institute in the month of December 2001.
iii. To displayTNAME, HIREDATE, CNAME, STARTDATE from tables TRAINER and COURSE of all those
courses whose FEES is less than or equal to 10000. (iv) To display number of Trainers from each Ans. city.
iv. SELECT TID. TNAME, FROM TRAINER WHERE CITY NOT IN ('DELHT', 'MUMBAI');
v. SELECT DISTINCT TID EROM COURSE;
vi. SELECT TID, COUNT(*), MIN (FEES) FROM COURSE. CROUP BY TID HAVING COUNT(*)>1;
vii. SELECT COUNTS), SUM(FEES) FROM COURSE WHERE STARTDATE< '2018-09- 15';
OR
Answer the questions (i) to (v) on the basis of the following tables SHOPPE and ACCESSORIES.
TABLE: SHOPPE
Id SName Area
TABLE: ACCESSORIES
No Name Price Id
i. To display Name and Price of all the Accessories in ascending order of their Price.
ii. To display Id and SName of all Shoppe located in Nehru Place.
iii. To display Minimum and Maximum Price of each Name of Accessories.
iv. To display Name, Price of all Accessories and their respective SName, where they are available.
v. To display name of accessories whose price is greater than 1000.