Skip to main content
·13 chapters

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.

1
  • 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 import a 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.
2

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.
3

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.

4

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.

5

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
[7,11,3,10,17,23,1,4,21,5][7, 11, 3, 10, 17, 23, 1, 4, 21, 5].

  • Pass 1: largest element moves to the end.

Result: [7,3,10,11,17,1,4,21,5,23][7, 3, 10, 11, 17, 1, 4, 21, 5, 23]

  • Pass 2: next largest moves to its position.

Result: [3,7,10,11,1,4,17,5,21,23][3, 7, 10, 11, 1, 4, 17, 5, 21, 23]

  • Pass 3: next largest moves to its position.

Result: [3,7,10,1,4,11,5,17,21,23][3, 7, 10, 1, 4, 11, 5, 17, 21, 23]

So after three complete passes, the partially sorted list is:
[3,7,10,1,4,11,5,17,21,23][3, 7, 10, 1, 4, 11, 5, 17, 21, 23].

6

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: [1,−2,32,8,17,19,42,13,0,44][1,-2,32,8,17,19,42,13,0,44]

For key = 8

PassIndexElementDecision
1011≠81 \neq 8
21-2−2≠8-2 \neq 8
323232≠832 \neq 8
4388=88 = 8, found

Position found = 4

For key = 1

PassIndexElementDecision
1011=11 = 1, found

Position found = 1

For key = 99

PassIndexElementDecision
1011≠991 \neq 99
21-2−2≠99-2 \neq 99
323232≠9932 \neq 99
4388≠998 \neq 99
541717≠9917 \neq 99
651919≠9919 \neq 99
764242≠9942 \neq 99
871313≠9913 \neq 99
9800≠990 \neq 99
1094444≠9944 \neq 99

Search is unsuccessful.

For key = 44

PassIndexElementDecision
1011≠441 \neq 44
21-2−2≠44-2 \neq 44
323232≠4432 \neq 44
4388≠448 \neq 44
541717≠4417 \neq 44
651919≠4419 \neq 44
764242≠4442 \neq 44
871313≠4413 \neq 44
9800≠440 \neq 44
1094444=4444 = 44, found

Position found = 10

7

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.

8

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.

  • 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:

  1. MySQL
  2. Oracle
10

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
11

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:

  1. Sender — the device that sends data.
  2. Receiver — the device that receives data.
  3. Message — the data or information being exchanged.
  4. Communication medium — the path or link through which the message travels.
  5. Protocols — the rules that must be followed for successful communication.
12

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 free

Frequently 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.

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.

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

Other CBSE Class 12 Subjects