Jharkhand Board Class 12 Computer Science — NCERT Solutions
Jharkhand Board Class 12 Computer Science NCERT solutions, chapter by chapter — 196 textbook questions solved across 12 chapters. Follows the JAC syllabus.
About these solutions
196 NCERT textbook questions for Jharkhand Board 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 — Exception Handling in Python · 9 questions
Q1."Every syntax error is an exception but every exception cannot be a syntax error." Justify the statement.
Given concept: Relationship between syntax errors and exceptions in Python.
Justification:
Part 1 — Every syntax error is an exception:
In Python, syntax errors are treated as a special type of exception called SyntaxError. When the Python interpreter encounters code that violates the grammatical rules of the language (e.g., missing colon, incorrect indentation), it raises a SyntaxError exception. Thus, every syntax error is indeed an exception.
Example:
if x = 5: # SyntaxError: invalid syntax
print(x)Here Python raises: SyntaxError: invalid syntax
Part 2 — Every exception cannot be a syntax error:
Exceptions are a much broader category. Many exceptions occur at runtime (during execution) even when the code is syntactically correct. These are called runtime exceptions or logical exceptions and have nothing to do with syntax rules.
Examples:
ZeroDivisionError— occurs when a number is divided by zero (syntax is correct).ValueError— occurs when a function receives an argument of the correct type but inappropriate value.NameError— occurs when a variable is used before being defined.
a = 10
b = 0
print(a / b) # ZeroDivisionError — syntax is perfectly correctConclusion: Since syntax errors form only a subset of all possible exceptions, every syntax error is an exception, but every exception cannot be a syntax error. Hence the statement is justified.
Q2.When are the following built-in exceptions raised? Give examples to support your answers.
a) ImportError
b) IOError
c) NameError
d) ZeroDivisionError
a) ImportError
When raised: ImportError is raised when the import statement fails to find the module being imported, or when a name cannot be imported from a module.
Example:
import mathematics # No such module existsOutput:
ModuleNotFoundError: No module named 'mathematics'(Note: ModuleNotFoundError is a subclass of ImportError.)
Another example:
from math import squareroot # 'squareroot' does not exist in mathOutput:
ImportError: cannot import name 'squareroot' from 'math'b) IOError
When raised: IOError (also known as OSError in Python 3) is raised when an input/output operation fails. Common causes include trying to open a file that does not exist, or lacking permission to read/write a file.
Example:
f = open("nonexistent_file.txt", "r") # File does not existOutput:
FileNotFoundError: [Errno 2] No such file or directory: 'nonexistent_file.txt'(Note: FileNotFoundError is a subclass of IOError/OSError.)
c) NameError
When raised: NameError is raised when a local or global variable (name) is referenced but has not been defined or assigned any value.
Example:
print(total) # 'total' has not been defined anywhereOutput:
NameError: name 'total' is not definedd) ZeroDivisionError
When raised: ZeroDivisionError is raised when the second operand (divisor/denominator) in a division or modulo operation is zero.
Example:
a = 10
b = 0
result = a / b # Division by zero
print(result)Output:
ZeroDivisionError: division by zeroFile Handling in Python
21 questions solved
- Exercise · 21 questions
Q1.Differentiate between:
- Text file: contains human-readable characters; can be opened by any text editor.
- Binary file: contains non-human-readable data in bytes; needs specific programs to access it.
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.
Stack
10 questions solved
- EXERCISE — Chapter 3: Stack (Computer Science Class 12) · 10 questions
Q1.State TRUE or FALSE for the following cases:
a) Stack is a linear data structure
b) Stack does not follow LIFO rule
c) PUSH operation may result into underflow condition
d) In POSTFIX notation for expression, operators are placed after operands
Given: Statements about Stack data structure.
Concept: Recall the fundamental properties of Stack.
a) TRUE — Stack stores elements in a linear (sequential) order; elements are arranged one after another.
b) FALSE — Stack strictly follows the LIFO (Last-In-First-Out) principle, meaning the last inserted element is the first to be removed.
c) FALSE — PUSH operation inserts an element onto the stack. It may result in overflow (when the stack is full), NOT underflow. Underflow occurs during the POP operation when the stack is empty.
d) TRUE — In POSTFIX (Reverse Polish) notation, operators are placed after their operands. For example, in infix becomes in postfix.
Q2a.Find the output of the following code:
```
result=0
numberList=[10,20,30]
numberList.append(40)
result=result+numberList.pop()
result=result+numberList.pop()
print("Result=", result)
```
Given: Python code using a list as a stack.
Concept: append() pushes an element to the top (end) of the list; pop() removes and returns the topmost (last) element.
Step-by-step execution:
| Step | Operation | List / Variable State |
|---|---|---|
| 1 | result = 0 | result = 0 |
| 2 | numberList = [10, 20, 30] | numberList = [10, 20, 30] |
| 3 | numberList.append(40) | numberList = [10, 20, 30, 40] |
| 4 | numberList.pop() returns 40 | result = 0 + 40 = 40; numberList = [10, 20, 30] |
| 5 | numberList.pop() returns 30 | result = 40 + 30 = 70; numberList = [10, 20] |
| 6 | print("Result=", result) | Prints Result= 70 |
Output:
Result= 70Queue
14 questions solved
- EXERCISE — Chapter 4: Queue · 14 questions
Q1a.Fill in the blank: _______________ is a linear list of elements in which insertion and deletion takes place from different ends.
Answer: Queue
Explanation: A Queue is a linear data structure in which insertion takes place at one end (called the Rear) and deletion takes place at the other end (called the Front). Because insertion and deletion happen at different ends, it follows the FIFO (First In First Out) principle.
Sorting
6 questions solved
- EXERCISE — Chapter: Sorting (Class 12 Computer Science) · 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.
Given: numList = [7, 11, 3, 10, 17, 23, 1, 4, 21, 5]
Concept: In Bubble Sort, in each pass we compare adjacent elements and swap them if they are in the wrong order. After pass , the largest elements are placed at the end in their correct positions.
Pass 1:
Start: [7, 11, 3, 10, 17, 23, 1, 4, 21, 5]
- Compare 7, 11 → no swap → [7, 11, 3, 10, 17, 23, 1, 4, 21, 5]
- Compare 11, 3 → swap → [7, 3, 11, 10, 17, 23, 1, 4, 21, 5]
- Compare 11, 10 → swap → [7, 3, 10, 11, 17, 23, 1, 4, 21, 5]
- Compare 11, 17 → no swap → [7, 3, 10, 11, 17, 23, 1, 4, 21, 5]
- Compare 17, 23 → no swap → [7, 3, 10, 11, 17, 23, 1, 4, 21, 5]
- Compare 23, 1 → swap → [7, 3, 10, 11, 17, 1, 23, 4, 21, 5]
- Compare 23, 4 → swap → [7, 3, 10, 11, 17, 1, 4, 23, 21, 5]
- Compare 23, 21 → swap → [7, 3, 10, 11, 17, 1, 4, 21, 23, 5]
- Compare 23, 5 → swap → [7, 3, 10, 11, 17, 1, 4, 21, 5, 23]
After Pass 1: [7, 3, 10, 11, 17, 1, 4, 21, 5, 23]
Pass 2:
Start: [7, 3, 10, 11, 17, 1, 4, 21, 5, 23]
- Compare 7, 3 → swap → [3, 7, 10, 11, 17, 1, 4, 21, 5, 23]
- Compare 7, 10 → no swap → [3, 7, 10, 11, 17, 1, 4, 21, 5, 23]
- Compare 10, 11 → no swap → [3, 7, 10, 11, 17, 1, 4, 21, 5, 23]
- Compare 11, 17 → no swap → [3, 7, 10, 11, 17, 1, 4, 21, 5, 23]
- Compare 17, 1 → swap → [3, 7, 10, 11, 1, 17, 4, 21, 5, 23]
- Compare 17, 4 → swap → [3, 7, 10, 11, 1, 4, 17, 21, 5, 23]
- Compare 17, 21 → no swap → [3, 7, 10, 11, 1, 4, 17, 21, 5, 23]
- Compare 21, 5 → swap → [3, 7, 10, 11, 1, 4, 17, 5, 21, 23]
- Compare 21, 23 → no swap → [3, 7, 10, 11, 1, 4, 17, 5, 21, 23]
After Pass 2: [3, 7, 10, 11, 1, 4, 17, 5, 21, 23]
Pass 3:
Start: [3, 7, 10, 11, 1, 4, 17, 5, 21, 23]
- Compare 3, 7 → no swap → [3, 7, 10, 11, 1, 4, 17, 5, 21, 23]
- Compare 7, 10 → no swap → [3, 7, 10, 11, 1, 4, 17, 5, 21, 23]
- Compare 10, 11 → no swap → [3, 7, 10, 11, 1, 4, 17, 5, 21, 23]
- Compare 11, 1 → swap → [3, 7, 10, 1, 11, 4, 17, 5, 21, 23]
- Compare 11, 4 → swap → [3, 7, 10, 1, 4, 11, 17, 5, 21, 23]
- Compare 11, 17 → no swap → [3, 7, 10, 1, 4, 11, 17, 5, 21, 23]
- Compare 17, 5 → swap → [3, 7, 10, 1, 4, 11, 5, 17, 21, 23]
- Compare 17, 21 → no swap → [3, 7, 10, 1, 4, 11, 5, 17, 21, 23]
After Pass 3: [3, 7, 10, 1, 4, 11, 5, 17, 21, 23]
Final Answer: After three complete passes of Bubble Sort, the partially sorted list is:
Searching
11 questions solved
- Activity 6.3 · 1 question
- Activity 6.4 · 1 question
- Exercise · 9 questions
Q6.3.Consider the numList [17, 8, -4, 7, 0, 2, 19]. Sort it using the sort() function of Python's Lists. Now apply binary search to search for the key 7. Determine the number of iterations required.
Step 1 – Sort the list using sort():
Original list:
After sorting:
Indices:
Step 2 – Apply Binary Search for key = 7:
Given: , ,
Iteration 1:
Key found at index 3 (Position 4).
Number of iterations required = 1
Since 7 happens to be the middle element of the sorted list, binary search finds it in just 1 iteration.
Understanding Data
10 questions solved
- EXERCISE — Chapter 7: Understanding Data · 10 questions
Q1.Identify data required to be maintained to perform the following services:
a) Declare exam results and print e-certificates
b) Register participants in an exhibition and issue biometric ID cards
c) To search for an image by a search engine
d) To book an OPD appointment with a hospital in a specific department
Given: Various services that require data maintenance.
Concept: Data is a collection of facts, numbers, characters and symbols needed to perform a specific task or service.
a) Declare exam results and print e-certificates:
Data required:
- Student's full name, roll number, date of birth
- Subject names and marks obtained in each subject
- Maximum marks per subject
- Pass/fail criteria (minimum passing marks)
- School/Board name, exam year
- Student's photograph (for e-certificate)
- Unique certificate ID / serial number
- Digital signature or QR code data for verification
b) Register participants in an exhibition and issue biometric ID cards:
Data required:
- Participant's full name, age, gender
- Contact details (phone number, email address)
- Organisation/Institution name
- Category of participation (visitor, exhibitor, judge, etc.)
- Biometric data: fingerprint scan and/or iris scan
- Photograph of the participant
- Unique participant ID / registration number
- Date and duration of participation
c) To search for an image by a search engine:
Data required:
- Image file (pixel data, colour values, resolution)
- Metadata of the image: file name, file size, format (JPEG, PNG, etc.)
- Tags, labels, or keywords associated with the image
- URL / source location of the image
- Alt text or caption associated with the image on the web page
- Date of upload/indexing
- Image features extracted by AI (shapes, colours, objects detected)
d) To book an OPD appointment with a hospital in a specific department:
Data required:
- Patient's full name, age, gender, contact number
- Patient ID / Aadhar number (for existing patients: medical history)
- Department name (e.g., Cardiology, Orthopaedics)
- Name of the preferred doctor
- Available appointment slots (date and time)
- Reason for visit / symptoms
- Insurance details (if applicable)
- Appointment confirmation number
Database Concepts
15 questions solved
- EXERCISE — Database Concepts (Chapter 8) · 15 questions
Q1.Give the terms for each of the following:
a) Collection of logically related records.
b) DBMS creates a file that contains description about the data stored in the database.
c) Attribute that can uniquely identify the tuples in a relation.
d) Special value that is stored when actual data value is unknown for an attribute.
e) An attribute which can uniquely identify tuples of the table but is not defined as primary key of the table.
f) Software that is used to create, manipulate and maintain a relational database.
Given: Descriptions of various database-related terms.
Answers:
a) Database — A database is a collection of logically related records (data) organised so that it can be easily accessed, managed, and updated.
b) Database Catalog (Data Dictionary) — The DBMS creates a file called the database catalog (or data dictionary) that stores the description (metadata) about the data stored in the database, including schema, constraints, and structure.
c) Primary Key (or Candidate Key) — An attribute (or a set of attributes) that can uniquely identify each tuple in a relation is called a Primary Key. More generally, any such attribute is called a Candidate Key.
d) NULL value — A special value called NULL is stored when the actual data value for an attribute is unknown, missing, or not applicable.
e) Alternate Key — An attribute that can uniquely identify tuples of the table but has not been selected as the primary key is called an Alternate Key. (It is a candidate key that is not the primary key.)
f) Relational Database Management System (RDBMS) — Software such as MySQL that is used to create, manipulate, and maintain a relational database is called an RDBMS.
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
16 questions solved
- EXERCISE — Computer Networks (Chapter 10) · 16 questions
Q1.Expand the following:
a) ARPANET
b) MAC
c) ISP
d) URI
Given: Abbreviations to be expanded.
Answers:
a) ARPANET — Advanced Research Projects Agency NETwork
b) MAC — Media Access Control
c) ISP — Internet Service Provider
d) URI — Uniform Resource Identifier
Data Communication
17 questions solved
- EXERCISE — Data Communication (Chapter 11) · 17 questions
Q1.What is data communication? What are the main components of data communication?
Data Communication:
Data communication refers to the exchange of data (information) between two or more networked or connected devices (such as laptops, PCs, printers, routers, etc.) through some transmission medium.
Main Components of Data Communication:
- Sender: The device or entity that originates and sends the message. Example: a computer, mobile phone.
- Receiver: The device or entity that receives the message sent by the sender. Example: a printer, another computer.
- Message: The actual data or information to be exchanged. It can be in the form of text, numbers, images, audio, video, multimedia, etc.
- Communication Media (Channel): The path or medium through which the message travels from sender to receiver. It can be wired (e.g., twisted pair cable, coaxial cable, optical fibre) or wireless (e.g., radio waves, microwaves, satellite links).
- Protocols: A set of rules that must be followed by the communicating parties to ensure successful and reliable data communication. Examples: HTTP, Ethernet, TCP/IP.
Security Aspects
17 questions solved
- EXERCISE — Chapter 12: Security Aspects (Computer Science, Class XII) · 17 questions
Q1.Why is a computer considered to be safe if it is not connected to a network or Internet?
Given/Concept: Most malware spreads through network connections, the Internet, or shared online resources.
Explanation:
A computer that is not connected to any network or the Internet is considered relatively safe because:
- No Remote Access: Hackers and crackers cannot remotely access or exploit the system since there is no network pathway available to them.
- No Malware Download: Malware such as viruses, worms, Trojans, ransomware, spyware, and adware are commonly downloaded from the Internet or spread through network connections. Without Internet access, this route is completely blocked.
- No Spam/Phishing: Email-based threats like spam, phishing links, and malicious attachments cannot reach the computer.
- No Network Intrusion: Attacks such as DoS, DDoS, snooping, eavesdropping, and buffer overflow attacks that rely on network traffic cannot be executed.
- No Drive-by Downloads: Visiting malicious websites or clicking unsafe links is not possible without Internet connectivity.
Note: A completely isolated (air-gapped) computer can still be infected through infected removable storage devices (e.g., USB drives), but the risk is significantly reduced compared to a networked computer.
Conclusion: Since the majority of malware distribution channels require a network or Internet connection, an offline computer is considered much safer.
Get chapter-wise help for Jharkhand Board Class 12 Computer Science
Super Tutor gives you chapter summaries, revision notes, practice quizzes and flashcards, organised around the Jharkhand Board syllabus. Free to start.
Try Super Tutor freeFrequently Asked Questions
Where can I find Jharkhand Board Class 12 Computer Science NCERT Solutions?
This page has NCERT solutions for 12 chapters of Jharkhand Board 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 Jharkhand Board 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 Jharkhand Board 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
Jharkhand Board 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