Empowering Students with AI-Powered Assessments & Intelligent Learning
CBSE(NCERT) · Grade 12 · Computer Science

CBSE(NCERT) GRADE 12 COMPUTER SCIENCE 2026 SET1

40 questions from this Grade 12 Computer Science paper. Log in as a Grade 12 student to view solutions.

🔒 Login / Register to Download PDF
Q1 short answer 1 mark
State True or False: In Python, data type of 74 is same as the data type of 74.0.

Solution hidden

Log in to view solution →
Q2 mcq 1 mark
Identify the output of the following code snippet: s = "the Truth" print(s.capitalize())
  • A. The truth
  • B. THE TRUTH
  • C. The Truth
  • D. the Truth

Solution hidden

Log in to view solution →
Q3 mcq 1 mark
Which of the following expressions in Python evaluates to True?
  • A. 2 > 3 and 2 < 3
  • B. 3 > 1 and 2
  • C. 3 > 1 and 3 > 2
  • D. 3 > 1 and 3 < 2

Solution hidden

Log in to view solution →
Q4 mcq
open("pqr.dat","________") Which of the following is the correct file mode to open the file in read only mode ?
  • A. a
  • B. rb
  • C. r+
  • D. rb+

Solution hidden

Log in to view solution →
Q11 short answer 1 mark
State whether the following statement is True or False : In Python, Logical errors can be handled using try……except……finally statement.

Solution hidden

Log in to view solution →
Q12 mcq 1 mark
A table has two candidate keys, one of which is chosen as the primary key. How many alternate keys does this table have ?
  • B. 1
  • C. 2
  • D. 3

Solution hidden

Log in to view solution →
Q13 mcq 1 mark
Which of the following SQL command can change the degree of the existing relation ?
  • A. DROP TABLE
  • B. ALTER TABLE
  • C. UPDATE…SET
  • D. DELETE

Solution hidden

Log in to view solution →
Q14 mcq 1 mark
What will be the output of the query ? SELECT MACHINE_ID, MACHINE_NAME FROM INVENTORY WHERE QUANTITY <= 100;
  • A. All columns of INVENTORY table with quantity greater than 100
  • B. ID and name of machines with quantity less than 100 from INVENTORY table
  • C. All columns of INVENTORY table with quantity greater than or equal to 100
  • D. ID and name of machines with quantity less than or equal to 100 from INVENTORY table.

Solution hidden

Log in to view solution →
Q15 mcq 1 mark
A relation in MySQL database consists of 2 tuples and 3 attributes. If 2 attributes are deleted and 4 tuples are added, what will be the cardinality of the relation ?
  • A. 4
  • B. 5
  • C. 6
  • D. 7

Solution hidden

Log in to view solution →
Q16 mcq 1 mark
Which aggregate function in SQL returns the smallest value from a column in a table ?
  • A. MIN()
  • B. MAX()
  • C. SMALL()
  • D. LOWER()

Solution hidden

Log in to view solution →
Q17 mcq 1 mark
With respect to computer networks, which of the following is the correct expanded form of RJ 45 ?
  • A. Radio Jockey 45
  • B. Registered Jockey 45
  • C. Radio Jack 45
  • D. Registered Jack 45

Solution hidden

Log in to view solution →
Q18 mcq 1 mark
Which network device serves as the entry and exit point of a network, as all data coming in or going out of a network must first pass through it in order to use routing paths ?
  • A. Modem
  • B. Gateway
  • C. Switch
  • D. Repeater

Solution hidden

Log in to view solution →
Q19 short answer 1 mark
Expand the term XML.

Solution hidden

Log in to view solution →
Q20 mcq 1 mark
Assertion (A) : $[1,2,3]+'123'$ is an invalid expression in Python. Reason (R) : In Python, a list cannot be concatenated with a string.
  • A. Both Assertion (A) and Reason (R) are true and Reason (R) is the correct explanation for Assertion (A).
  • B. Both Assertion (A) and Reason (R) are true and Reason (R) is not the correct explanation for Assertion (A).
  • C. Assertion (A) is true, but Reason (R) is false.
  • D. Assertion (A) is false, but Reason (R) is true.

Solution hidden

Log in to view solution →
Q21 short answer 1 mark
Assertion (A) : The PRIMARY KEY constraint in SQL ensures that each value in the c

Solution hidden

Log in to view solution →
Q21 mcq 1 mark
Assertion (A) : The PRIMARY KEY constraint in SQL ensures that each value in the column(s) is unique and cannot be NULL. Reason (R) : Candidate keys are not eligible to become a primary key.
  • A. Both Assertion (A) and Reason (R) are true and Reason (R) is the correct explanation for Assertion (A).
  • B. Both Assertion (A) and Reason (R) are true and Reason (R) is not the correct explanation for Assertion (A).
  • C. Assertion (A) is true, but Reason (R) is false.
  • D. Assertion (A) is false, but Reason (R) is true.

Solution hidden

Log in to view solution →
Q22 long answer 3 marks
A stack named FruitStack, implemented using list, contains records of some fruits. Each record is represented as a dictionary with keys 'Name', 'Origin', 'Price', and 'Expiry'. A sample record is given here: {'Name':'Apple','Origin':'France','Price':120,'Expiry':'12-08-2025'} Write the following user-defined functions in Python to perform the specified operations on FruitStack: (i) push_fruit(FruitStack, Fruit): This function takes the stack FruitStack and a new record Fruit as arguments and pushes the record stored in Fruit onto FruitStack if the Price is less than 100. (ii) pop_fruit(FruitStack): This function pops the topmost record from the stack and returns it. If the stack is already empty, the function should display 'UNDERFLOW'. (iii) display(FruitStack): This function displays all the elements of the stack starting from the topmost element. If the stack is empty, the function should display 'EMPTY STACK'.

Solution hidden

Log in to view solution →
Q23 long answer 3 marks
Write a Python program to accept 10 integers from the user. If the entered number is a three-digit even integer, push it onto a stack. After all inputs are taken, pop all the three-digit even integers from the stack and display them. For example, if the user enters 12, 31, 320, 457, 6, 92, 924, 220, 1, 218, then the stack should contain: 320, 924, 220, 218 and the output of the program should be: 218 220 924 320

Solution hidden

Log in to view solution →
Q24 short answer 3 marks
Write the output of the following code: def Exam2026(given): new=[] for ch in given[1:-1]: if ch.isupper(): new.reverse() elif ch not in new: new.append(ch) elif ch in new: new.pop() print(new) Exam2026("Gold–24Medals")

Solution hidden

Log in to view solution →
Q25 mcq 2 marks
What possible output(s) from the given options will NOT be displayed when the following code is executed? Also, mention for how many iterations the for loop in the given code will run?
  • A. 3–4–5–4–
  • B. 2–2–4–5–
  • C. 4–3–3–5–
  • D. 5–1–2–4–

Solution hidden

Log in to view solution →
Q26 short answer 2 marks
The function given below is written to accept a string s as a parameter and return the number of vowels appearing in the string. The code has certain errors. Observe the code carefully and rewrite it after removing all the logical and syntax errors. Underline all the corrections made. def CountVowels(s): c=0 for ch in range(s): if 'aeiouAEIOU' in ch: c=+1 return(ch)

Solution hidden

Log in to view solution →
Q27 long answer 2 marks
Ms. Zoya is a Production Manager in a factory which packages mineral water. She decides to create a table in a database to keep track of the stock present in the factory. Each record of the table will have the following fields: W_Code – Code of the item (type – CHAR(5)) W_Description – Description of the item (type – VARCHAR(20)) B_Qty – Balance quantity of the item (type – INTEGER) U_Price – Unit Price of the item (type – FLOAT) The name of the table is W_STOCK. (i) (a) Write an SQL command to create the above table (W_Code should be the primary key). OR (b) Can U_Price be the primary key of the above table? Justify your answer. (ii) (a) Assuming that the table W_STOCK is already created, write an SQL command to add an attribute E_Date (of DATE type) to the table. OR (b) Assuming that the table W_STOCK is already created, write an SQL command to remove the column B_Qty from the table.

Solution hidden

Log in to view solution →
Q28 short answer 2 marks
(a) List one advantage and one disadvantage of Bus topology. OR (b) What is protocol in the context of computer networks? Which protocol is used to transmit the web pages over the internet?

Solution hidden

Log in to view solution →
Reading Passage

A csv file "States.csv" contains some data about all the states of India. Each record of the file contains the following data :  Name of the State  Capital of the State  Population of the State  Official Language of the State For example, a sample record in the file is : ['Andhra Pradesh','Amaravati',52221000,'Telugu'] Write a Python program which reads the data from this file and appends all those records where population is more than 10000000 into another csv file 'More.csv'. Note : "States.csv" also contains the Header row. The Header row should NOT be copied to "More.csv".

Q28 short answer 4 marks
Write a Python program which reads the data from this file and appends all those records where population is more than 10000000 into another csv file 'More.csv'.

Solution hidden

Log in to view solution →
Q29 long answer 3 marks
(a) Write a Python function which is present in a text file named "Space.txt" and counts the number of digits present in it and returns them. For example, if the file contains: Space exploration has unlocked incredible advancements in technology and science. Since the first moon landing in 1969, space agencies have sent probes to Mars, Jupiter and beyond. The ISS, orbiting Earth at about 400 km, serves as a hub for research. With missions planned for 2030, humanity’s cosmic journey continues! Then the function should return 11. OR (b) Write a Python function which is present in a text file named Space.txt and displays those words from it in which the letter 'e' appears less than two times. For example, if the file contains: Space exploration has unlocked incredible advancements in technology and science. Since the first moon landing in 1969, space agencies have sent probes to Mars, Jupiter and beyond. The ISS, orbiting Earth at about 400 km, serves as a hub for research. With missions planned for 2030, humanity’s cosmic journey continues! Then the function should display: incredible advancements science. agencies serves research.

Solution hidden

Log in to view solution →
Q29 short answer
Note : "States.csv" also contains the Header row. The Header row should NOT be copied to "More.csv".

Solution hidden

Log in to view solution →
Reading Passage

Assume that you are the Manager of the Loans department of a Finance House. To keep track of the loans you have created two tables : CUSTOMERS and LOANS. The sample data in these tables is given below : Table: CUSTOMERS Table: LOANS Note : The tables may contain more records than shown here. The management of the Finance House needs certain reports from you.

Q30 short answer
Write the queries to extract the following data to create the reports : Number of records from LOANS table where Rate of Interest (RoI) is above 7.0.

Solution hidden

Log in to view solution →
Q31 short answer
Names of the customers whose loan amount ( L_Amt) is above 1000000.

Solution hidden

Log in to view solution →
Q32 short answer
(b) Considering the table STOCK as given above, write the output on execution of the following queries :

Solution hidden

Log in to view solution →
Q32 short answer
C_ID, C_Name and Terms of all those records where Loan Date (L_Date) is after 31st December, 2024.

Solution hidden

Log in to view solution →
Q33 short answer
Details of all the loans in the descending order of RoI.

Solution hidden

Log in to view solution →
Q34 long answer 4 marks
Assume that you are the Manager of the Loans department of a Finance House. To keep track of the loans you have created two tables : CUSTOMERS and LOANS. The sample data in these tables is given below :

Solution hidden

Log in to view solution →
Q34 short answer
C_ID and average term for each C_ID from the LOANS table.

Solution hidden

Log in to view solution →
Q34 short answer
The management of the Finance House needs certain reports from you. Write the queries to extract the following data to create the reports: (i) Number of records from LOANS table where Rate of Interest (RoI) is above 7.0. (ii) Names of the customers whose loan amount (L_Amt) is above 1000000. (iii) C_ID, C_Name and Terms of all those records where Loan Date (L_Date) is after 31st December, 2024. (iv) (a) Details of all the loans in the descending order of RoI. OR (b) C_ID and average term for each C_ID from the LOANS table.

Solution hidden

Log in to view solution →
Q35 long answer 4 marks
Peter has created a table named Account in MySQL database, SCHOOL, having following structure :

Solution hidden

Log in to view solution →
Reading Passage

Peter has created a table named Account in MySQL database, SCHOOL, having following structure :  Stud_id – integer  Sname – string  Class – string  Fees – float

Q35 short answer 4 marks
Help him in writing a Python program to display records of those students whose fees is less than 5000. Note the following to establish connectivity between Python and MySQL :  Username – admin  Password – root  Host – localhost

Solution hidden

Log in to view solution →
Q35 short answer 4 marks
Peter has created a table named Account in MySQL database, SCHOOL, having following structure: Stud_id – integer Sname – string Class – string Fees – float Help him in writing a Python program to display records of those students whose fees is less than 5000. Note the following to establish connectivity between Python and MySQL: Username – admin Password – root Host – localhost

Solution hidden

Log in to view solution →
Q38 mcq
For the academic purpose, the University will provide its own 24 × 7 FM channel within the University Campus. Which communication medium, out of the following, is used by FM ?
  • A. Radio Waves
  • B. Micro Waves
  • C. Infrared Waves

Solution hidden

Log in to view solution →
Q39 short answer
The students will be attending a lot of online academic sessions and workshops. These will involve audio-visual communication. Write the full name of the protocol which will be used for such a communication through the internet.

Solution hidden

Log in to view solution →
Q40 short answer
Where should a repeater be installed in Amritsar University campus to boost the signal between blocks ? Justify your answer.

Solution hidden

Log in to view solution →