CBSE Class 11 Computer Science Mid Term Question Paper 2025-26 with Solutions (Morning Shift)
Interactive Answer Key & Detailed Step-by-Step Explanations
Total Questions: 21
Your Score: 0 / 21
SECTION B
Short Answer Questions (2 Marks Each)
Question 22
2 Marks
Rohit, a Python programmer, is working on a project in which he wants to print the sum of odd numbers between 1 and 1000 (both values including). He has written the following code but his code is having some logical and syntactical errors. Rewrite the correct code and underline the corrections made.
a=1
while a<1000:
if a%2==0
print(a)
a/=1
Solution / Answer:
s = 0
a = 1
while a <= 1000:
if a % 2 != 0:
s += a
a += 1
print(s)
Question 23
2 Marks
Write a program in python to take 2 integers from the user. If both integers have the same parity (i.e. both are odd or both are even) then display their sum otherwise display their multiplication as output.
Solution / Answer:
num1 = int(input(“Enter first number: “))
num2 = int(input(“Enter second number: “))
if (num1 % 2 == num2 % 2):
print(“Sum:”, num1 + num2)
else:
print(“Multiplication:”, num1 * num2)
Question 24
2 Marks
What will be the output of following statement:
6 + 7 // 4 + 3 ** 2 – 5
6 + 7 // 4 + 3 ** 2 – 5
Solution / Answer:
• Step 1 (Exponentiation
• Step 2 (Floor Division
• Step 3 (Addition & Subtraction): 16 – 5 = 11
3**2): 6 + 7 // 4 + 9 – 5• Step 2 (Floor Division
7//4): 6 + 1 + 9 – 5• Step 3 (Addition & Subtraction): 16 – 5 = 11
OR
What will be the output of following statement:
(5 > 6) and (8 != 9) or True
(5 > 6) and (8 != 9) or True
Solution / Answer:
• Step 1:
• Step 2:
• Step 3:
• Step 4:
(5 > 6) is False.• Step 2:
(8 != 9) is True.• Step 3:
False and True gives False.• Step 4:
False or True gives True.
Question 25
1 × 2 = 2 Marks
Fill in the blanks:
(a) (51)10 = ( ___ )16
(b) ( ___ )10 = (115)8
(a) (51)10 = ( ___ )16
(b) ( ___ )10 = (115)8
Solution / Answer:
(a) (51)10 to Hexadecimal: 51 ÷ 16 = 3 remainder 3 (Hex: 33) → 33
(b) (115)8 to Decimal: (1×8²) + (1×8¹) + (5×8⁰) = 64 + 8 + 5 = 77
(b) (115)8 to Decimal: (1×8²) + (1×8¹) + (5×8⁰) = 64 + 8 + 5 = 77
Question 26
2 Marks
What is the output of the following code?
a=10
c=0
for b in range(3,a):
if b%3==0:
c=c+b
else:
c=c-b
print(a+c)
Solution / Answer:
• range(3, 10) values for b: 3, 4, 5, 6, 7, 8, 9
• b=3 (%3==0): c = 0 + 3 = 3
• b=4: c = 3 – 4 = -1
• b=5: c = -1 – 5 = -6
• b=6 (%3==0): c = -6 + 6 = 0
• b=7: c = 0 – 7 = -7
• b=8: c = -7 – 8 = -15
• b=9 (%3==0): c = -15 + 9 = -6
• Output print(a+c) = 10 + (-6) = 4
• b=3 (%3==0): c = 0 + 3 = 3
• b=4: c = 3 – 4 = -1
• b=5: c = -1 – 5 = -6
• b=6 (%3==0): c = -6 + 6 = 0
• b=7: c = 0 – 7 = -7
• b=8: c = -7 – 8 = -15
• b=9 (%3==0): c = -15 + 9 = -6
• Output print(a+c) = 10 + (-6) = 4
Question 27
2 Marks
Write a program in python that takes three numbers from the user and displays “OK” if these numbers are multiple of either 3 or 5. Otherwise display “NOT OK”.
Solution / Answer:
n1 = int(input(“Enter first number: “))
n2 = int(input(“Enter second number: “))
n3 = int(input(“Enter third number: “))
if (n1%3==0 or n1%5==0) and (n2%3==0 or n2%5==0) and (n3%3==0 or n3%5==0):
print(“OK”)
else:
print(“NOT OK”)
OR
Write a program in python that accepts a number from the user and display sum of its digits.
Solution / Answer:
num = int(input(“Enter a number: “))
s = 0
temp = num
while temp > 0:
digit = temp % 10
s += digit
temp //= 10
print(“Sum of digits:”, s)
Question 28
2 Marks
Find the Hexadecimal equivalent of (100101)2.
Solution / Answer:
• Make groups of 4 bits from right: (0010) (0101)
• Convert each group to decimal/hex: 0010 = 2, 0101 = 5
• Result: (25)16
• Convert each group to decimal/hex: 0010 = 2, 0101 = 5
• Result: (25)16
OR
Draw the circuit diagram of the following expression: ABC’ + A’B’ + C
Solution / Answer:
• Term 1: AND gate receiving inputs A, B, and C’ (C connected via NOT gate).
• Term 2: AND gate receiving inputs A’ (A via NOT) and B’ (B via NOT).
• Term 3: Direct line for C.
• Combine outputs of Term 1, Term 2, and Term 3 using a 3-input OR gate.
• Term 2: AND gate receiving inputs A’ (A via NOT) and B’ (B via NOT).
• Term 3: Direct line for C.
• Combine outputs of Term 1, Term 2, and Term 3 using a 3-input OR gate.
SECTION C
Medium Answer Questions (3 Marks Each)
Question 29
3 Marks
Write a Python program to accept marks of 3 subjects from the user, calculate the average, and display the grade as per the following criteria:
• Average ≥ 90: Grade A
• Average ≥ 80: Grade B
• Otherwise: Grade C
• Average ≥ 90: Grade A
• Average ≥ 80: Grade B
• Otherwise: Grade C
Solution / Answer:
m1 = float(input(“Enter marks 1: “))
m2 = float(input(“Enter marks 2: “))
m3 = float(input(“Enter marks 3: “))
avg = (m1 + m2 + m3) / 3
if avg >= 90:
print(“Grade A”)
elif avg >= 80:
print(“Grade B”)
else:
print(“Grade C”)
OR
Write a python program to accept a number from the user and check whether it is a palindrome or not. (Eg.: Input number = 141, reverse is 141 → Palindrome)
Solution / Answer:
num = int(input(“Enter a number: “))
temp = num
rev = 0
while temp > 0:
rev = (rev * 10) + (temp % 10)
temp //= 10
if num == rev:
print(“It is a Palindrome”)
else:
print(“Not a Palindrome”)
Question 30
1 × 3 = 3 Marks
Prove the following identity using truth table: (A + B)C = AC + BC
Solution / Answer:
Columns
| A | B | C | A+B | (A+B)C | AC | BC | AC+BC |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 1 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 | 1 | 1 | 0 | 1 |
| 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
(A+B)C and AC+BC are identical. Hence proved.
OR
Fill in the blanks:
(a) 1 Byte = _____ bits
(b) 1 MB = _____ Kb
(c) ( _____ )’ = A’ . B’
(a) 1 Byte = _____ bits
(b) 1 MB = _____ Kb
(c) ( _____ )’ = A’ . B’
Solution / Answer:
(a) 8 bits
(b) 8192 Kb (since 1 MB = 1024 KB = 1024 × 8 Kb)
(c) ( A + B ) [By De Morgan’s Law]
(b) 8192 Kb (since 1 MB = 1024 KB = 1024 × 8 Kb)
(c) ( A + B ) [By De Morgan’s Law]
Question 31
1 × 3 = 3 Marks
Consider below given expressions, what will be the output of the following?
(i) a,b=1,2
c=a**b
print(c, type(c))
(ii) a,b=50,9
c=a//b
print(c, type(c))
(iii)a,b=30,7
c=a%b
print(c, type(c))
Solution / Answer:
(i)
(ii)
(iii)
1 <class 'int'>(ii)
5 <class 'int'>(iii)
2 <class 'int'>
OR
How many times the loop will iterate?
(i) for i in range(1,20):
(ii) for i in range(-15,5,-1):
(iii) while True:
Solution / Answer:
(i) 19 times (from 1 to 19)
(ii) 0 times (step -1 goes in opposite direction from -15 to 5)
(iii) Infinite times
(ii) 0 times (step -1 goes in opposite direction from -15 to 5)
(iii) Infinite times
SECTION D
Long Answer Questions
Question 32
1 × 4 = 4 Marks
State True or False:
(i) Output devices are used to provide data and control signals to a computer.
(ii) NAND is the complement of the AND gate.
(iii) XOR gate outputs 1 only when both inputs are the same.
(iv) ASCII uses 16 bits to represent a character.
Solution / Answer:
(i) False (Input devices provide data/control signals)
(ii) True
(iii) False (XOR outputs 1 when inputs are different)
(iv) False (Standard ASCII uses 7 or 8 bits)
(ii) True
(iii) False (XOR outputs 1 when inputs are different)
(iv) False (Standard ASCII uses 7 or 8 bits)
OR
Fill in the blanks:
(i) Storage devices like hard disks and SSDs are examples of ________ memory.
(ii) A ________ translates and executes code line by line.
(iii) ________ gate outputs 1 only when inputs are different.
(iv) The decimal number system has a base of ________.
Solution / Answer:
(i) Secondary
(ii) Interpreter
(iii) XOR
(iv) 10
(ii) Interpreter
(iii) XOR
(iv) 10
Question 33
2 × 2 = 4 Marks
a. Write a python program to print the following pattern using loops:
* * * * * * * * * * * * * * *b. List any two functions of operating system.
Solution / Answer:
a. Python Code for Pyramid Pattern:
1. Process Management: Handles process execution, scheduling, and CPU time allocation.
2. Memory Management: Allocates and deallocates primary memory (RAM) to running application programs.
n = 5
for i in range(1, n + 1):
print(” ” * (n – i) + “* ” * i)
b. Two Functions of Operating System:1. Process Management: Handles process execution, scheduling, and CPU time allocation.
2. Memory Management: Allocates and deallocates primary memory (RAM) to running application programs.
Question 34
4 Marks
WAP in python to input the value of x and n and print the sum of the following series: (consider n as an integer value)
1 + x + x² + x³ + x⁴ + … + xⁿ
1 + x + x² + x³ + x⁴ + … + xⁿ
Solution / Answer:
x = float(input(“Enter value of x: “))
n = int(input(“Enter value of n: “))
s = 0
for i in range(n + 1):
s += (x ** i)
print(“Sum of series:”, s)
Question 35
1 × 4 = 4 Marks
Answer the following questions in one word/line:
(i) A security system only unlocks a door if both the correct PIN and fingerprint are provided. Which logic gate does this represent?
(ii) You are working on a document, and suddenly the power goes off. When the computer restarts, your document is lost. Which type of memory was holding the document?
(iii) You want to write a Python program. After writing the code, you need it to run. Which type of translator will execute the program line by line?
(iv) You use a tablet where apps open by tapping on icons. What type of user interface is this?
Solution / Answer:
(i) AND Gate
(ii) RAM (Volatile Memory)
(iii) Interpreter
(iv) GUI (Graphical User Interface)
(ii) RAM (Volatile Memory)
(iii) Interpreter
(iv) GUI (Graphical User Interface)
SECTION E
Case-Based / Integrated Questions
Question 36
2 + 1 + 2 = 5 Marks
The school library charges a fine for late book returns:
• If the delay is 0 days, there is no fine.
• If the delay is 1–5 days, the fine is ₹2 per day.
• If the delay is 6–10 days, the fine is ₹5 per day.
• If the delay is more than 10 days, the fine is ₹10 per day, and a warning is issued.
(i) Write a program in python to calculate the fine based on the number of late days? (2 Marks)
(ii) What output should the program give if the book is returned 19 days late? (1 Mark)
(iii) Modify the program to keep asking for number of late days until the user enters valid number? (Here invalid number means negative or decimal value etc.) (2 Marks)
• If the delay is 0 days, there is no fine.
• If the delay is 1–5 days, the fine is ₹2 per day.
• If the delay is 6–10 days, the fine is ₹5 per day.
• If the delay is more than 10 days, the fine is ₹10 per day, and a warning is issued.
(i) Write a program in python to calculate the fine based on the number of late days? (2 Marks)
(ii) What output should the program give if the book is returned 19 days late? (1 Mark)
(iii) Modify the program to keep asking for number of late days until the user enters valid number? (Here invalid number means negative or decimal value etc.) (2 Marks)
(i) Write a program in python to calculate the fine based on the number of late days? (2 Marks)
Warning: Book returned very late!
(iii) Modify the program to keep asking for number of late days until the user enters valid number? (2 Marks)
days = int(input(“Enter number of late days: “))
if days <= 0:
fine = 0
print(“No fine.”)
elif days <= 5:
fine = days * 2
print(f”Fine amount: ₹{fine}”)
elif days <= 10:
fine = days * 5
print(f”Fine amount: ₹{fine}”)
else:
fine = days * 10
print(f”Fine amount: ₹{fine}”)
print(“Warning: Book returned very late!”)
(ii) What output should the program give if the book is returned 19 days late? (1 Mark)
Fine amount: ₹190Warning: Book returned very late!
(iii) Modify the program to keep asking for number of late days until the user enters valid number? (2 Marks)
while True:
try:
days = int(input(“Enter number of late days: “))
if days >= 0:
break
else:
print(“Invalid input! Days cannot be negative.”)
except ValueError:
print(“Invalid input! Please enter a whole number.”)
if days == 0:
fine = 0
elif days <= 5:
fine = days * 2
elif days <= 10:
fine = days * 5
else:
fine = days * 10
print(“Warning issued!”)
print(“Total Fine: ₹”, fine)
Question 37
1 × 5 = 5 Marks
Hally, a student of class 11 is designing a circuit diagram. Help her to get the output out of it at different stages.
(i) What will be the output at 1?
(ii) What will be the output at 2?
(iii) What will be the output at 3?
(iv) What will be the output at 4?
(v) ________ and ________ are also known as universal gates.
(i) What will be the output at 1?
(ii) What will be the output at 2?
(iii) What will be the output at 3?
(iv) What will be the output at 4?
(v) ________ and ________ are also known as universal gates.
Solution / Answer:
(i) What will be the output at 1? → A’ + B
(ii) What will be the output at 2? → A · B · C
(iii) What will be the output at 3? → B + C
(iv) What will be the output at 4? → (A’ + B) + (A · B · C) + (B + C)
(v) NAND and NOR are also known as universal gates.
(i) What will be the output at 1? → A’ + B
(ii) What will be the output at 2? → A · B · C
(iii) What will be the output at 3? → B + C
(iv) What will be the output at 4? → (A’ + B) + (A · B · C) + (B + C)
(v) NAND and NOR are also known as universal gates.
Pingback: CBSE Class 11 Computer Science Previous Year Question Papers with Solutions - Digital Study Lab