12th Standard CBSE Syllabus & Materials
12th Standard CBSE
CBSE 12th Biology Sexual Reproduction in Flowering Plants Important Questions And Answers Study Material - QB365 Set B
NEW12th Standard CBSE
CBSE 12th Biology Sexual Reproduction in Flowering Plants Important Questions And Answers Study Material - QB365 Set A
NEW12th Standard CBSE
CBSE 12th Biology Sexual Reproduction in Flowering Plants Assertion and Reason Study Material - QB365 Set D
NEW12th Standard CBSE
CBSE 12th Biology Sexual Reproduction in Flowering Plants Assertion and Reason Study Material - QB365 Set C
NEW12th Standard CBSE
CBSE 12th Biology Sexual Reproduction in Flowering Plants Assertion and Reason Study Material - QB365 Set B
NEW12th Standard CBSE
CBSE 12th Biology Sexual Reproduction in Flowering Plants Assertion and Reason Study Material - QB365 Set A

Published on: 25/10/2025
Download CBSE Class 12th Standard CBSE Computer Science question papers, sample papers, important questions, and previous year solved papers in PDF format. Get free study materials, NCERT solutions, and exam preparation resources for Class 12th Standard CBSE Computer Science
Questions + Answers key
Take MCQ Computer Science Test

SECTION-A Multiple Choice Question
1.
All keywords in Python are in _____.
lower case
UPPER CASE
Capitalized
None of the mentioned
2.
Which of the following is an invalid statement?
abc = 1,000,000
a, b, c = 1000,2000,3000
a,b,c = 1000,2000,3000
a, b, c = 1000, 2000, 3000
3.
Which of the following is not a complex number?
k = 2 + 3j
k = complex(2,3)
k = 2 + 31
k = 2 + 3J
4.
Which of these in not a core data type?
Lists
Dictionary
Tuples
Class
5.
What will be the output of the following code?
x = "abcdef"
i = "i''
while i in x:
print(i, end=" ")
a b c d e f
abcdef
i i i i i...
No output
6.
Identify the valid declaration of L:
L = [1,23, 'hi', 6]
list
dictionary
array
tuple
7.
What is the output of "hello" +1+2+3 ?
hello123
hello
Error
hello6
8.
Each table comprises of _____ and ____
rows, columns
data, information
database, table
None of these
9.
The design of the database is known as what?
Attribute
database scheme
obstruction
database oriented
10.
A RDBMS must comply with at least ____ rules.
4
5
6
7
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
SECTION-C (3 Marks)
22.
Explain the two strategies employed by Python for memory allocation.
23.
Write a program to input some numbers repeatedly and print their sum. The program ends when the user says no more to enter (normal termination). The program aborts if a negative number is entered.
24.
Write output of the following codes.
(i) a=8
while (a > 0):
print ("Gotcha!")
a = a-3
if a == 5:
break
else:
print ("Going out!")
(ii) i = 0
while i < 6:
j = 0
while j < i:
print ("*")
j=j+1
i=i+1
print()
(iii) score = 40
while score> 1:
score = (score/2)-1
print (score)
25.
How many times will the given loops iterate.
(i) j=0
while (j < 50):
print ("Hello World")
j=j+1
(ii) j=25
while (25<=j<=30):
print ("Temp variable =",j)
j=j+1
(iii) #Assume Boolean variable b is not known.
b= True
sum=0
while b:
sum=sum+5
print (sum)
if (b or not b):
break
26.
Write a output for SQL queries
(i) to
(ii),which are based on the table: STUDENT given below:
| ROLL NO | NAME | CLASS | DOB | GENDER | CITY | MARKS |
| 1 | NANDHA | X | 06-06-1995 | M | AGRA | 551 |
| 2 | SAURABH | XII | 07-05-1993 | M | MUMBAI | 462 |
| 3 | SONAL | XI | 06-05-1994 | F | DELHI | 400 |
| 4 | TRISLA | XII | 08-08-1995 | F | MUMBAI | 450 |
| 5 | STORE | XII | 08-10-1995 | M | DELHI | 369 |
| 6 | MARISLA | XI | 12-12-1994 | F | DUBAI | 250 |
| 7 | NEHA | X | 08-12-1995 | F | MOSCOW | 377 |
| 8 | NISHANT | X | 12-06-1995 | M | MOSCOW | 489 |
(i) SELECT COUNT(*), CIty FROM STUDENT GROUP BY CITY HAVING COUNT(*) >1;
(ii) SELECT MAX(DOB),MIN(DOB) FROM STUDENT
(iii) SELECT NAME,GENDER FROM STUDENT WHERE CITY="Delhi";
27.
Take input of age of 3 people by user and determine oldest and youngest among them.
SECTION-B (2 Marks)
28.
What are Python modules?
29.
Define pow() method.
30.
Explain randrange().
31.
Find and write the output of the following Python
TXT = ["20", "50", "30", "40"]
CNT=3
TOTAL = 0 '"
for C in [7,5,4,6]:
T = TXT[CNT]
TOTAL = float (T) + C
print (TOTAL)
CNT-=1
32.
Find the output from the following code:
t=tuple()
t = t +('Python',)
print (t)
print len(t)
t1=(10,20,30)
print (len(t1))
33.
How many times is the following loop executed?
for a in range(100.10.-10):
print(a)
34.
How many times is the following loop executed?
i = 100
while(i <=200):
print(i)
i + =20
35.
Write a program to print the pyramid.
1
22
333
4444
55555
36.
Find errors in the following codes and write the correct codes. Underline correction in each case.
(i) a = 10
while (a < 100):
print (a)
print ("Over!")
(ii) while x < 10:
print (x)
x = x+2
(iii) for p in range (3)
for q in range (3)
print (p" q)
else:
print ("outer loop ends")
37.
Give a suitable example of a table with sample data and illustrate primary and candidate keys in it.
38.
A table CUSTOMER has 10 columns but no row. Later, 10 new rows are inserted and 3 rows are deleted in the table. What is the degree and cardinality of the table CUSTOMER?
39.
A table STUDENT has 3 columns and 10 rows and another table STUDENT1 has the same number of columns and 15 rows. 5 rows are common in both the tables. If we take union, what is the degree and cardinality of the resultant tabla?
40.
Observe the table CLUB given below:
| Member ID | Member Name | Address | Age | Fee |
| MOODl M0002 M0003 M0004 |
Sumit Nisha Niharika Sachin |
New Delhi Gurgaon New Delhi Faridabad |
20 19 21 18 |
2000 3500 2100 3500 |
(i) What is the cardinality and degree of the given table?
(ii) If a new column ContactNo has been added and three more members have joined the club then how these changes will affect the degree and cardinality of the table.
41.
What is join in SQL?
SECTION - D (4 Marks Answer is any 4)
42.
Write a program to input n numbers and to search any number from the list.
43.
Write a program to search input any customer name and display customer phone number if the customer name exist in the list.
44.
Given an array: 89,20,31,56,20. Sort this array in ascending order using
i) Bubble Sort (ii) Insertion sort
45.
Write SQL queries for (i) to (iv), which are based on the table: STUDENT
| ROLL NO | NAME | CLASS | DOB | GENDER | CITY | MARKS |
| 1 | NANDHA | X | 06-06-1995 | M | AGRA | 551 |
| 2 | SAURABH | XII | 07-05-1993 | M | MUMBAI | 462 |
| 3 | SONAL | XI | 06-05-1994 | F | DELHI | 400 |
| 4 | TRISLA | XII | 08-08-1995 | F | MUMBAI | 450 |
| 5 | STORE | XII | 08-10-1995 | M | DELHI | 369 |
| 6 | MARISLA | XI | 12-12-1994 | F | DUBAI | 250 |
| 7 | NEHA | |||||
| 8 | NISHANTH |
(i) To display the records from table STUDENT in alphabetical order as per the name of the student.
(ii) To display Class, DOB and City whose marks is between 450 and 551.
(iii) To display Name, Class and total number of students who have scored more than 450 marks, class wise.
(iv) To increase marks of all students by 20 whose class is "XII".
46.
What is Join? Also, define the different kind of SQL Join.
SECTION-E (5 Marks Answer is any 2)
47.
Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii),
which are based on the tables.
Table: CUSTOMER
| CNO | CNAME | ADDRESS |
| 101 | Richa Jain | Delhi |
| 102 | Surbhi Sinha | Chennai |
| 103 | Lisa Thomas | Bangalore |
| 104 | ImranAIi | Delhi |
| 105 | Roshan Singh | Chennai |
Table: TRANSACTION
| TRNO | CNO | AMOUNT | TYPE | DOT |
| T 001 | 101 | 1500 | Credit | 2017-11-23 |
| T002 | 103 | 2000 | Dedit | 2017-05-12 |
| T003 | 102 | 3000 | Credit | 2017-06-10 |
| T003 | 103 | 12000 | Credit | 2017-09-12 |
| T005 | 101 | 1000 | Dedit | 2017-09-05 |
(i) To display details of all transactions of TYPE Credit from table TRANSACTION.
(ii) To display the CNO and AMOUNT of all Transactions done in the month of September 2017 from table TRANSACTION.
(iii) To display the last date of transaction (DOT) from the table TRANSACTION for the customer having CNO as 103.
(iv) To display all CNO, CNAME and DOT (date of transaction) of those CUSTOMERS from tables CUSTOMER and TRANSACTION who have done transactions more than or equal to 2000.
(v) SELECT COUNT(*), AVG (AMOUNT) FROM TRANSACTION WHERE DOT> = '2017-06-01';
(vi) SELECT CNO, COUNT("), MAX (AMOUNT) FROM TRANSACTION GROUP BY CNO HAVING COUNT (")> 1;
(vii) SELECT CNO, CNAME FROM CUSTOMER WHERE ADDRESS NOT IN ('DELHI' 'BANGALORE');
(viii) SELECT DISTINCT CNO FROM TRANSACTION;
48.
Write SQL queries for (a) to (g) on the basis of table ITEMS and TRADERS:
Table: ITEMS
| CODE | INAME | QTY | PRICE | COMPANY | TCODE |
|
1001 |
DIGITAL PAD 12i LED SCREEN 40 CAR GPS SYSTEM DIGITAL CAMERA 12X PEN DRIVE 32GB |
120 70 50 160 600 |
11000 38000 21500 8000 1200 |
XENITA |
T01 T02 T03 T01 T02 T03 |
TRADERS
| TCODE | TNAME | CITY |
|
T01 |
ELECTRONIC SALES |
MUMBAI DELHI CHENNAI |
(a) To display the details of all the items in ascending order of item names (i.e., INAME).
(b) To display item name and price of all those items, whose price is in the range of 10000 and 22000 (both values inclusive).
(c) To display the number of items, which are traded by each trader. The expected output of this query should be: T01 2 T02 2 T03 1
(d) To display the price, item name and quantity (i.e., qty) of those items which have quantity more than 150.
(e) To display the names of those traders, who are either from DELHI or from MUMBAI.
(f) To display the names of the companies and the names of the items in descending order of company names.
(g) Obtain the outputs of the following SQL queries based on the data given in tables ITEMS and TRADERS above.
(hI) SELECT MAX (PRICE), MIN (PRICE)FROM ITEMS;
(h2) SELECT PRICE"QTY FROM ITEMS WHERE CODE=1004;
(h3) SELECT DISTINCT TCODE FROM ITEMS;
(h4) SELECT INAME, TNAME FROM ITEMS I, TRADERS T
WHERE I.TCODE=T.TCODE AND QTY<100;
49.
Consider the following tables STOCK and DEALERS and answer (a) and (b) parts of this question:
Table: STOCK
| ITEM NO | ITEM | DCODE | QTY | UNITPRICE | STOCK DATE |
|
5005 |
102 102 101 101 102 102 103 |
100 150 125 200 210 60 160 |
16 20 14 22 5 10 8 |
31-03-10 01-01-10 14-02-10 01-01-09 19-03-09 12-12-09 23-01-09 |
Table: DEALERS
| DCODE | DNAME |
| 101 103 102 |
RELIABLE STATINONERS CLASSIC PLASTICS CLEAR DEALS |
(a) Write SQL commands for the following stat~ments :
(i) To display the details of all Items in the STOCK table in ascending order of StockDate.
(ii) To display ltemNo and Item name of those items from STOCK table whose UnitPrice is more than Rupees 10.
(iii) To display the details of those items whose dealer code (Dcode) is 102 or quantity in STOCK (Qty) is more than 100 from the table Stock.
iv) To display maximum UnitPrice of items for each dealer individually as per Dcode from the table STOCK
(b) Give the output of the following SQL queries:
(i) SELECT COUNT(DISTINCT Dcode) FROM STOCK;
(ii) SELECT Qty"' UnitPrice FROM STOCK WHERE ItemNo=5006;
(ill) SELECT Item, Dname FROM STOCK S, DEALERS D WHERE S.Dcode=D.Dcode AND ltemNo =5004;
SECTION-A Multiple Choice Question
1.
(d)
None of the mentioned
2.
(b)
a, b, c = 1000,2000,3000
3.
(c)
k = 2 + 31
4.
(d)
Class
5.
(d)
No output
6.
(a)
list
7.
(c)
Error
8.
(a)
rows, columns
9.
(b)
database scheme
10.
(c)
6
11.
(a)
12.
(d)
13.
(d)
14.
(d)
15.
(d)
16.
(a)
17.
(d)
18.
(d)
19.
(c)
20.
(d)
21.
(a)
SECTION-C (3 Marks)
22.
Python uses two strategies for memory allocation
(i) Reference counting
(ii) Automatic garbage collection
Reference Counting: works by counting the number of times an object is referenced by other in the system. When an object's reference count reaches zero, Python coilects it automatically.
Automatic Garbage Collection: Python schedules garbage collection based upon a threshold of object allocations and object deallocations. When the number of allocations minus the number of deallocations are greater than the threshold number, the garbage collector is run and the unused blocks of memory is reclaimed.
23.
count = sum = 0
ans = 'y'
while ans == 'y':
n = int(input ("Enter a number"))
if n < 0:
print ("Negative number")
break
else:
sum + = n
count + = 1
ans = input("want to enter more number?
(y/n)")
else:
print ("you have entered all your numbers")
print ("Sum of numbers is", sum)
24.
(i) Gotcha!
(ii) *
* *
* * *
* * * *
* * * * *
(iii) 19.0
8.5
3.25
25.
(i) 50 times.
(ii) 6 times
(iii) 1 time
26.
(i) 2 Mumbai
2 Delhi
2 Moscow
(ii) MAX(DOB) MIN(DOB)
07-05-1993
08-12-1995
(iii) NAME GENDER
Sonal F
Store M
27.
print ( "Enter first age" )
first = input ()
print ( "Enter second age" )
second = input ()
print ( "Enter third age")
third = input ()
if first >= second and first >= third
print ( " Oldest is ",first )
elif second >= first and second >= third :
print ( "Oldest is ",second )
elif third >= first and third >= second :
print ( "Oldest is ",third )
else ;
print ( "All are equal " )
SECTION-B (2 Marks)
28.
Modules are Python .py files that consist of Python code. Any Python file can be referenced as a module. Modules can define functions, classes and variables that you can reference in other Python py files via the Python command line interpreter.
29.
pow() method offers to compute the power of a number and hence can make task of calculating power of a number easier. In this, ow types to calculate power.
(i) pow(x, y)
(ii) pow(x, y, mod)
30.
Randrange() method returns a random selected element from the range created by the start, stop and step arguments. The value of start is 0 by default. Similarly, the value of step is 1 by default.
31.
47.0
35.0
54.0
26.0
32.
(Python")
1
3
33.
9 times.
34.
6 times
35.
for i in range(1,6):
for j in range(1,.i+1):
print(i,)
print()
36.
(i) The given loop is infinite loop as the value of a is not changing. There can be lots of possible corrections, one is given below:
a = 10
while (a < 100):
print (a)
a + = 10
print ("Over!")
(ii) The given code is wrong as value of x is not initialized. There can be lots of possible corrections, one is given below:
x=0
while x < 10:
print (x)
x = x+2
(iii) is missing in for statements
for p in range (3):
for q in range (3):
print (p *q)
else:
print ("outer loop ends")
37.
A table may have more than one such attribute/ group of attributes that identifies a row/tuple uniquely, all such attribute(s) are known as candidate keys. Out of the candidate keys, one is selected as primary key.
38.
Degree = 10 (No. of columns)
Cardinality = 10 - 3 = 7 (no. of rows)
39.
Degree: 3
Cardinality: 10 + 15- 5 = 20
40.
(i) Cardinality: 4
Degree: 5
(ii) Cardinality: 7
Degree: 6
41.
A join is a query that combines rows from two or more tables. In a join query, more than one tables are listed in FROM clause. The function of combining data from multiple tables is called joining. Joins are used when we have to select data from two or more tables
SECTION - D (4 Marks Answer is any 4)
42.
n=input("Enter no. of values")
num-[]
flag=0
for i in range(n):
number=input(''Enter the number")
num.append(number)
search = input("Enter number to be searched")
for i in range(n):
if num[i]==search:
print (search, "found at position" ,i)
flag=1
if flag==0:
print (search,"not found in list")
43.
def printlist(s):
i=0
for i in range(len(s)):
print (i,s[i])
i = 0
phonenumbers =['9840012345','9840011111',' 9845622222','9850012345', '9884412345 ']
flag=0
number = raw_input("Enter the phone number to be searched")
number = number.stript)
try:
i = phonenumbers.index(number)
if i >= 0:
flag=1
except ValueError:
pass
if(flag !=0):
print ("\nphone number found i phonebook at index", i)
else:
print ("\nphone number not found ir phonebook")
print (,,\nPHONEBOOK")
printlist(phonenumbers)
44.
i)Bubble Sort
20,89,31,56,20
20,31,89,56,20
20,31,56,20,89
20,31,20,56,89
20,20,31,56,89
(ii)20,89,31,56,20
20,31,89,56,20
20,31,56,89,20
20,31,56,20,89
20,20,31,56,89
45.
(i) SELECT * FROM STUDENT ORDER BYNAME;
(ii) SELECT CLASS,DOB,CITY FROM STUDENT WHERE MARKS BETWEEN 450 AND 551
(iii)SELECT NAME,CLASS ,COUNT(*) FROM STUDENT GROUP BYCLASS HAVING MARKS>450;
(iv) UPDATE STUDENT SETMARKS= MARKS+20 WHERE class="XII";
46.
A join is a query that combines rows from two or more tables. In a join query, more than one tables are listed in FROM clause. The function of combining data from multiple tables is called joining.
Joins are used when we have to select data from two or more tables. Joins are used to extract data from two tables, when we need a relationship between certain columns in these tables There are different kind of SQL joins:
1. Equi-Join:
Equi join is a simple SQL join condition that uses equal sign as a comparison operator.
Syntax
SELECT column 1, column2, column3
FROM Table1,Table2
WHERE Table1. column 1 = Table2.column1;
2. Self Join
A self join is a join where we join a particular table to itself. Here in this case, it is necessary to ensure that the join statement defines an ALIAS name for both the copies of the tables to avoid column ambiquity.
3. Non- Equi join:
Non-equi join is used to return the result from two or more tables, where exact join is not possible. the SQL non - equi join uses comparison operators instead of, the equal sign like >, <, > =, < = alongwith conditions.
Syntax
SELECT*FROM Tablel, Table2
WHERE Tablel. column> Table2.column;
4. Natural Join:
The natural join is a type of equi join and is structured in such a way that, columns with same name of associated tables will appear once only.
Syntax
SELECT*FROM Table1
NATURALJOIN Table2;
SECTION-E (5 Marks Answer is any 2)
47.
(i) SELECT" FROM TRANSACTION WHERE TYPE ="Credit";
(ii) SELECT CNO,AMOUNT FROM TRANSACTION WHERE (MONTH (DOT) = "September" AND YEAR(DOT) =2017);
(iii) SELECT MAX (DOT) FROM TRANSACTION WHERE CNO="103":
(iv) SELECT CNO, CNAME, DOT FROM CUSTOMER.C, TRANSACTION.T
C.CNO=T.CNO AND
AMOUNT> =2000;
(v) 4 4375
(vi) 101 2 1500
103 2 12000
(vii) 102 Surbhi Sinha
105 Roshan Singh
(viii) 101
103
102
48.
(a) SELECT"FROM ITEMSORDER BYINAME ASC;
(b) SELECT INAME, PRICE FROM ITEMS. WHERE PRICE> = 10000 AND PRICE =<22000
(c) SELECT TCODE, COUNT (CODE) FROM ITEMSGROUP BYTCODE;
(d) SELECTPRICE, INAME, QTY FROM 1fEMS WHERE QTY> 150;
(e) SELECTTNAME FROM TRADERS WHERE (CITY = "DELHI") OR (CITY"MUMBAI");
(f) SELECT COMPANY, INAME FROM ITEMS ORDER BYCOMPANYDESC;
(g) (h1) 38000 1200
(h2) 1075000
(h3) T01
T02
T03
(h4)
| LED SCREEN 40 | DISP HOUSE INC |
| CAR GPS SYSTEM | ELECTRONICS SALES |
49.
(a )(i) SELECT*FROM STOCK ORDER BYStockDate;
(ii) SELECT ItemNo, Item FROM STOCK WHERE UnitPrice> 10;
(iii) SELECT "'FROM DEALERS, STOCK WHERE (DEALERSDcode="102" OR STOCKQty > 100 and DEALERS. DCODE = STOCKDCODE);
(iv) SELECT MAX (UnitPrice) FROM DEALERS, STOCK ORDER BY STOCKDcode WHERE DEALERS.Dcode = STOCK.Dcode;
(b)(i) 3
(ii)4400
(iii)
| ITEM | DNAME |
| ERASER BIG | CLEAR DEALS |
(iv) 01-01-09
12th Standard CBSE Syllabus & Materials
12th Standard CBSE
CBSE 12th Standard Biology Sexual Reproduction in Flowering Plants Sample Question Papers Study Material - QB365 Set 1
NEW12th Standard CBSE
CBSE 12th Chemistry d- and f- Block Elements Important Questions And Answers Study Material - QB365 Set B
NEW12th Standard CBSE
CBSE 12th Chemistry d- and f- Block Elements Important Questions And Answers Study Material - QB365 Set A
NEW12th Standard CBSE
CBSE 12th Chemistry Chemical Kinetics Important Questions And Answers Study Material - QB365 Set B
NCERT Books
Syllabus
Exam Pattern
Sample Question Papers
Previous year Question Papers
Important Notes
MCQ Practice test
NCERT Exemplers
Case study Questions
Image Based Questions
Passage based Questions
HOT Questions
Value Based Questions
Model Questions Papers
NCERT ( Book Back ) Questions
Assertion and Reason
Important Questions And Answers
CBSE 12th Standard CBSE Subjects
CBSE Standards