CBSE Class 12 Computer Science — NCERT Solutions
CBSE Class 12 Computer Science NCERT solutions, chapter by chapter — 211 textbook questions solved across 12 chapters. Follows the CBSE syllabus.
About these solutions
211 NCERT textbook questions for CBSE Class 12 Computer Science, solved step by step across 12 chapters. Each chapter page has every exercise: half the solutions are open to read and the rest are free with a Super Tutor account.
Exception Handling in Python
9 questions solved
- Exercise · 9 questions
Q1.“Every syntax error is an exception but every exception cannot be a syntax error.” Justify the statement.
A syntax error is detected when the rules of the programming language are not followed while writing the program. Such errors are also called parsing errors. The text says that syntax errors are also handled as exceptions, so every syntax error is an exception.
But many exceptions occur after the program has started executing, even when the program is syntactically correct. Examples are ZeroDivisionError when dividing by zero, NameError when a variable is not defined, and IOError when a file cannot be opened. These are exceptions, but not syntax errors. So, every exception cannot be a syntax error.
Q2.When are the following built-in exceptions raised? Give examples to support your answers.
- ImportError is raised when the requested module definition is not found. Example: trying to
importa module that does not exist. - IOError is raised when the file specified in a program statement cannot be opened. Example: trying to open a file with a wrong name or from a wrong location.
- NameError is raised when a local or global variable name is not defined. Example: using a variable before assigning any value to it.
- ZeroDivisionError is raised when the denominator in a division operation is zero. Example:
10/0.
File Handling in Python
20 questions solved
- Exercise · 20 questions
Q1(a).text file and binary file
Text file vs binary file:
- A text file consists of readable characters such as alphabets, numbers, and symbols. Its contents are stored as ASCII/Unicode byte values and can be opened in a text editor.
- A binary file stores data as bytes that do not represent readable characters. It may contain images, audio, video, executable files, etc., and needs specific software to read or write it.
Q1(b).readline() and readlines()
- readline() reads one complete line from a file. If a number is given, it reads up to that many bytes, but not beyond the newline character.
- readlines() reads all lines from a file and returns them as a list of strings.
Stack
11 questions solved
- Exercise · 11 questions
Q1a.Stack is a linear data structure
A stack is a linear data structure because its elements are arranged in a sequence.
Q1b.Stack does not follow LIFO rule
A stack follows the LIFO rule, so the statement is incorrect.
Queue
14 questions solved
- Exercise · 14 questions
Q1(a).____________ is a linear list of elements in which insertion and deletion takes place from different ends.
A queue is a linear list of elements in which insertion and deletion take place from different ends.
Sorting
6 questions solved
- Exercise · 6 questions
Q1.Consider a list of 10 elements:
numList = [7, 11, 3, 10, 17, 23, 1, 4, 21, 5].
Display the partially sorted list after three complete passes of Bubble sort.
Use Bubble Sort on the list
.
- Pass 1: largest element moves to the end.
Result:
- Pass 2: next largest moves to its position.
Result:
- Pass 3: next largest moves to its position.
Result:
So after three complete passes, the partially sorted list is:
.
Searching
9 questions solved
- Exercise · 9 questions
Q1.Using linear search determine the position of 8, 1, 99 and 44 in the list:
[1, -2, 32, 8, 17, 19, 42, 13, 0, 44]
Draw a detailed table showing the values of the variables and the decisions taken in each pass of linear search.
Use linear search, so compare the key with elements from left to right.
List:
For key = 8
| Pass | Index | Element | Decision |
|---|---|---|---|
| 1 | 0 | 1 | |
| 2 | 1 | -2 | |
| 3 | 2 | 32 | |
| 4 | 3 | 8 | , found |
Position found = 4
For key = 1
| Pass | Index | Element | Decision |
|---|---|---|---|
| 1 | 0 | 1 | , found |
Position found = 1
For key = 99
| Pass | Index | Element | Decision |
|---|---|---|---|
| 1 | 0 | 1 | |
| 2 | 1 | -2 | |
| 3 | 2 | 32 | |
| 4 | 3 | 8 | |
| 5 | 4 | 17 | |
| 6 | 5 | 19 | |
| 7 | 6 | 42 | |
| 8 | 7 | 13 | |
| 9 | 8 | 0 | |
| 10 | 9 | 44 |
Search is unsuccessful.
For key = 44
| Pass | Index | Element | Decision |
|---|---|---|---|
| 1 | 0 | 1 | |
| 2 | 1 | -2 | |
| 3 | 2 | 32 | |
| 4 | 3 | 8 | |
| 5 | 4 | 17 | |
| 6 | 5 | 19 | |
| 7 | 6 | 42 | |
| 8 | 7 | 13 | |
| 9 | 8 | 0 | |
| 10 | 9 | 44 | , found |
Position found = 10
Understanding Data
13 questions solved
- Exercise · 13 questions
Q1.Identify data required to be maintained to perform the following services:
Required data to be maintained are:
- Declare exam results and print e-certificates: student name, roll number, marks/grades, result status, certificate details.
- Register participants in an exhibition and issue biometric ID cards: participant name, contact details, exhibition registration details, and biometric data such as fingerprint/iris data.
- Search for an image by a search engine: image-related data/metadata such as image type, size, resolution, tags, and other identifying information.
- Book an OPD appointment with a hospital in a specific department: patient name, contact details, hospital/department name, date, time, and appointment number.
So, different services require different kinds of structured data to be stored and maintained.
Database Concepts
34 questions solved
- Exercise · 34 questions
Q1.Give the terms for each of the following:
a) Database — a collection of logically related records.
b) Meta-data — the file/description of the data stored in the database.
c) Primary key — the attribute that can uniquely identify tuples in a relation.
d) NULL — the special value used when actual data is unknown.
e) Alternate key — an attribute that can uniquely identify tuples but is not chosen as the primary key.
f) DBMS — software used to create, manipulate, and maintain a relational database.
Structured Query a Language (SQL)
50 questions solved
- Exercise — Structured Query Language (SQL) · 50 questions
Q1a.Define RDBMS. Name any two RDBMS software.
RDBMS (Relational Database Management System):
An RDBMS is a type of Database Management System (DBMS) that stores data in the form of related tables (relations). Each table consists of rows (records/tuples) and columns (attributes/fields). The relationships between tables are established using keys (Primary Key and Foreign Key).
Two popular RDBMS software:
- MySQL
- Oracle
Computer Networks
15 questions solved
- Exercise · 15 questions
Q1.Expand the following:
- ARPANET — Advanced Research Projects Agency Network
- MAC — Media Access Control
- ISP — Internet Service Provider
- URI — Uniform Resource Identifier
Data Communication
13 questions solved
- Exercise · 13 questions
Q1.What is data communication? What are the main components of data communication?
Data communication refers to the exchange of data between two or more networked or connected devices. The data may be text, image, audio, video, or multimedia.
The main components of data communication are:
- Sender — the device that sends data.
- Receiver — the device that receives data.
- Message — the data or information being exchanged.
- Communication medium — the path or link through which the message travels.
- Protocols — the rules that must be followed for successful communication.
Security Aspects
17 questions solved
- Exercise · 17 questions
Q1.Why is a computer considered to be safe if it is not connected to a network or Internet?
A computer is considered safe when it is not connected to a network or the Internet because it is then isolated from outside connections. Without a link to external devices or computers, it is not exposed to security threats coming from the network, so illegitimate access or misuse becomes much harder.
Get chapter-wise help for CBSE Class 12 Computer Science
Super Tutor gives you chapter summaries, revision notes, practice quizzes and flashcards, organised around the CBSE syllabus. Free to start.
Try Super Tutor freeFrequently Asked Questions
Where can I find CBSE Class 12 Computer Science NCERT Solutions?
This page has NCERT solutions for 12 chapters of CBSE Class 12 Computer Science for the board exams 2027. Each chapter links to its own page with the full set.
How should I prepare for CBSE Class 12 Computer Science board exams?
Go through the syllabus first, then work chapter by chapter: learn the ideas, practise questions, and revise with notes and flashcards. Leave time at the end to revise every chapter once more under timed conditions.
Are the CBSE Class 12 Computer Science NCERT Solutions free?
Half of the solutions on each chapter page are open to read. The rest are free with a Super Tutor account — signing up is free and needs no card.
Browse NCERT Solutions by Chapter
12 chapters
More Computer Science Resources
CBSE Class 12
Practice Quiz
Test yourself with quick quizzes
Important Questions
Exam-style questions with answers
Revision Notes
Key concepts and quick revision points
Formula Sheet
The formulas of each chapter in one place
Chapter Summary
Understand each chapter at a glance
Concept Maps
Diagrams showing how topics connect
Study Plan
Week-by-week preparation schedule
Flashcards
Quick-fire cards for active recall practice
Syllabus
Chapter list and the topics in each