CBSE 2026 results are out, Mukul scored a perfect 100/100 in Computer ScienceSee all toppers →
CBSE Class 12 Computer Science · Practical viva

CBSE Class 12 Computer Science Practical Viva Questions, with Answers

The viva carries marks in the CBSE Class 12 Computer Science practical, and it is the part students prepare least. Below are 33 questions examiners actually ask, grouped by topic, each with a short answer you can say out loud.

Python functions and scope

1. What is the difference between a parameter and an argument?
Answer: A parameter is the name in the function definition. An argument is the actual value passed when the function is called.
2. What does a function return if there is no return statement?
Answer: It returns None.
3. What is the difference between a local and a global variable?
Answer: A local variable exists only inside the function where it is created. A global variable is defined outside all functions and can be read anywhere in the file.
4. What does the global keyword do?
Answer: It lets a function change a variable that belongs to the global scope, instead of creating a new local one.
5. What is a default argument?
Answer: A parameter given a value in the definition, so the caller may leave it out. Default arguments must come after non-default ones.
6. Why can a list be changed inside a function but an integer cannot?
Answer: A list is mutable, so the function works on the same object. An integer is immutable, so assigning to it inside the function creates a new object.

File handling

1. Name the three types of files in the syllabus.
Answer: Text files, binary files and CSV files.
2. What is the difference between read() and readline()?
Answer: read() returns the whole file, or a given number of characters, as one string. readline() returns one line at a time.
3. What does readlines() return?
Answer: A list where each element is one line of the file, including its newline character.
4. What is the difference between the w and a modes?
Answer: w truncates the file, so existing content is lost. a appends, so writing continues at the end of what is already there.
5. Why is a with block preferred for opening files?
Answer: It closes the file automatically, even if an error happens inside the block.
6. Which module is used for binary files, and which two functions?
Answer: The pickle module, using dump() to write and load() to read.
7. What is the difference between a text file and a binary file?
Answer: A text file stores readable characters and is line-based. A binary file stores the object as bytes, cannot be read in a text editor, and keeps the data type intact.
8. What does the seek() function do?
Answer: It moves the file pointer to a given byte position. tell() reports where it is.

Stacks

1. What does LIFO mean?
Answer: Last In, First Out. The item pushed most recently is the first one popped.
2. Which list methods implement push and pop?
Answer: append() pushes to the top, and pop() without an index removes from the top.
3. What is underflow?
Answer: Trying to pop from an empty stack. Overflow is pushing to a stack that is already full, which matters when the stack has a fixed size.
4. Give two real uses of a stack.
Answer: Undo in an editor, and the browser back button. Also expression evaluation and function call handling.

Data structures and algorithms

1. What is the difference between a linear search and a binary search?
Answer: Linear search checks each element in turn and works on any list. Binary search repeatedly halves a sorted list, so it is far faster but needs the list sorted.
2. Is a dictionary ordered, and can its keys repeat?
Answer: From Python 3.7 a dictionary keeps insertion order. Keys must be unique and immutable; values may repeat.
3. What is the difference between a list and a tuple?
Answer: A list is mutable and uses square brackets. A tuple is immutable and uses parentheses, so it can be a dictionary key.

Databases and SQL

1. What is a primary key?
Answer: A column, or set of columns, whose value uniquely identifies each row. It cannot be NULL and cannot repeat.
2. What is the difference between a primary key and a candidate key?
Answer: Every column that could uniquely identify a row is a candidate key. The one chosen is the primary key; the others are alternate keys.
3. What is a foreign key?
Answer: A column in one table whose values must exist as the primary key of another table. It is what links the two tables.
4. What is the difference between DDL and DML?
Answer: DDL defines structure: CREATE, ALTER, DROP. DML works on the rows: INSERT, UPDATE, DELETE and SELECT.
5. What is the difference between WHERE and HAVING?
Answer: WHERE filters individual rows before grouping. HAVING filters groups after GROUP BY has run, so it can use aggregate functions.
6. What is the difference between COUNT(*) and COUNT(column)?
Answer: COUNT(*) counts every row. COUNT(column) counts only the rows where that column is not NULL.
7. Name the module used to connect Python to MySQL.
Answer: mysql.connector. You create a connection, then a cursor, then execute() the query, and commit() for any change to the data.
8. What does the DISTINCT keyword do?
Answer: It removes duplicate values from the result of a SELECT.

Networking

1. What is the difference between a hub and a switch?
Answer: A hub sends incoming data out of every port. A switch learns which device is on which port and sends the data only there, so it is faster and more secure.
2. What is the difference between LAN, MAN and WAN?
Answer: LAN covers one building, MAN covers a city, WAN covers countries. The internet is the largest WAN.
3. What is a URL made of?
Answer: The protocol, the domain name, and the path to the resource on that server.
4. What is the difference between a web server and a web browser?
Answer: A web server stores pages and sends them when asked. A browser is the program on the user's device that requests and displays them.

Want the full set?

More questions, the practical file format and the topics examiners come back to — sent on WhatsApp.

Get it on WhatsApp Book a free demo class

Written by Kajal Ma'am (MCA), teaching computer subjects since 2004.

Please read: these are practice questions written by Kwickprep to help you revise. They are not past examination papers and not a CBSE publication. Questions asked in your school’s viva or examination may differ, and the syllabus can change between sessions — the board’s own document at cbseacademic.nic.in is always the final word. Tell us if you spot a mistake and we will correct it.

{ }

Frequently asked questions

How many programs are needed in the CBSE Class 12 CS practical file?+
As per CBSE, the report file should contain a minimum of 15 Python programs and 5 sets of SQL queries. The practical is 30 marks (lab test 12, report file 7, project 8, viva 3).
Are these programs part of the CBSE syllabus?+
Yes, these are standard CBSE Class 12 Computer Science (083) practical concepts: stacks, file handling, recursion, searching, dictionaries and Python-MySQL connectivity. Every program here has been run and its output verified.
Can I get the full practical file and viva questions?+
Yes, request the full pack (15+ programs, the CBSE practical-file format and likely viva questions) on WhatsApp, free. Kajal Ma'am's team can also guide you through your own file.

Want to ace your boards?

See a real class before you decide. No pressure, no payment.

Book Free Demo on WhatsApp

Studying outside India?

We coach CBSE, IGCSE & international students across the globe, one-to-one, in your local time zone.

Visit International →