CBSE Sample Papers for Class 11 Computer Science Set 2 with Solutions

Students must start practicing the questions from CBSE Sample Papers for Class 11 Computer Science with Solutions Set 2 are designed as per the revised syllabus.

CBSE Sample Papers for Class 11 Computer Science Set 2 with Solutions

Time Allowed: 3 hours
Maximum Marks: 70

General Instructions:

  1. Please check this question paper contains 35 questions.
  2. The paper is divided into 5 Sections- A, B, C, D and E.
  3. Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark.
  4. Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
  5. Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
  6. Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
  7. Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
  8. All programming questions are to be answered using Python Language only.

Section A
[Each question carries 1 mark]

Question 1.
State True or False: [1]Computers are immune to tiredness.

Explanation: That7s correct! One of the advantages of computers is that they don’t experience fatigue or tiredness like humans do. Computers are designed to work continuously without getting exhausted or needing breaks. They can perform complex calculations, execute tasks, and run programs for extended periods of time without a decrease in performance due to tiredness.

Question 2.
What do you call the translator which takes high level language program as input and produces machine language code as output? [1](A) Assembler
(B) Compiler
(C) Interpreter
(D) Debugger
(B) Compiler

Explanation: A compiler is a translator that takes a high-level language program, often written in languages like C, C+ +, Java, as input and converts it into machine language code or executable code that can be directly executed by a computer. The process of compilation involves analyzing the entire source code, checking for syntax and semantic errors, and translating it into machine code instructions specific to the target computer architecture. The compiled code is usually stored in a separate file that can be executed independently.

Question 3.
Computerizing a system is also known as
(A) software
(B) telecommunication
(C) automation
(d) none of these
(C) automation

Explanation: Computerizing a system refers to the process of introducing computer technology and software into a manual or non-computerized system to automate its operations. It involves using computers to perform tasks and processes that were previously carried out manually. By automating a system, organizations can increase efficiency, accuracy, and productivity while reducing human effort and error.

Question 4.
Flow of control can be of the following types:
(A) sequential
(B) iterative
(C) derivative
(D) both (A) and (B)
(D) both (A) and (B)

Explanation: The flow of control refers to the order in which instructions or statements are executed in a program. It determines the path that the program follows during its execution. The two common types of flow of control are sequential and iterative.

Question 5.
Choose the correct command, to keep the cursor on the same line, after printing both values on the same line.
(A) print(a,b)
(B) print(a,b, end=””)
(C) print(a,b, end=”$”)
(D) print(a)print(b)
(B) print(a,b, end=””)

Explanation: In option (B), the “end” parameter is set to a space character (” “). This means that instead of printing a newline character after the values, it will print a space character. The next print call will start printing on the same line, after the space.

Question 6.
Which of the following operators is the correct option for pow(a,b)?
(A) a ^ b
(B) a**b
(C) a ^ ^ b
(D) a ^ * b
(B) a**b

Explanation: In Python, the double asterisk operator (** ) is used for exponentiation or raising a number
to a power. So, to calculate the power of ‘a’ raised to the exponent ‘b’, you would use the syntax shown in option (B): a**b

Question 7.
Which exception is raised in case of failure of attribute reference or assignment?
(A) AttributeError
(B) EOFError
(C) ImportError
(D) AssertionError
(A) AttributeError

Explanation: AttributeError: This exception is raised when you try to access or assign an attribute that does not exist on an object. It signifies a failure in attribute access or assignment.

Question 8.
The ……….. data type allows only True/False values.
(A) bool
(B) boolean
(C) Boolean
(D) None of these
(A) bool

Explanation: In Python, the bool data type represents boolean values, which can only take two possible values: True or False. The bool data type is used to store and manipulate logical values in Python.

Question 9.
What is the maximum possible length of an identifier?
(A) 16
(B) 32
(C) 64
(D) None of these
(D) None of these

Explanation: The maximum possible length of an identifier is not defined in the python language. It can be of any number.

Question 10.
Python allows repetition of a set of statements using construct.
(A) Looping
(B) Decision
(C) Condition
(D) Sequence
(A) Looping

Explanation: Python allows repeating a set of statements using looping constructs. Looping is a fundamental concept in programming that enables the execution of a block of code repeatedly until a certain test condition is satisfied.

Question 11.
In Python’s string or list, the indexing from the right starts from in reverse order.
(A) 0
(B) 1
(C) -1
(D) None of these
(C) -1

Explanation: The left -to-right index starts from 0 by default, and the maximum range is 1 less than the string length. The right-to -left index starts with -1 by default, and goes up to -1*length of string, i.e., the leftmost element.

Question 12.
How to make a true copy of list LI?
(A) L2=L1
(B) L2= list(L1)
(C) L2.copy(L1)
(D) not possible
(B) L2= list(L1)

Explanation: True copy of a list means that the elements of the original list are copied to new memory locations, and the new list contains references to these new memory locations for each element of the list. Thus, any changes made in the first list would not be reflected in the second list. The list() function creates a new list and copies only the element values to the new list.

Question 13.
Write the output of the following, a=(23,34,65,20,5)
(A) 28
(B) 29
(C) 27
(D) 26
(C) 27

Explanation: a[0] = 23, i.e., the element at the 0th index in the list. Then, a.index(5) = 4, as the index() function returns the index where element 5 occurs first, traversing left-to-right. So, the sum of the two values = 27, hence the answer.

Question 14.
If popitem() is used with an empty dictionary, what will happen? [1](A) An empty dictionary is returned
(B) An empty tuple is returned
(C) Traceback error is raised
(D) Keyerror is raised
(D) Keyerror is raised

Explanation: In Python, the popitem() method is used to remove and return an arbitrary, or the last inserted key-value pair from a dictionary. When called on an empty dictionary, i.e., a dictionary with no items, the popitem() method will raise a KeyError exception, as there is no key-value pair to return and remove.

Question 15.
The data taken from a digital footprint can be used for [1](A) Hacking
(B) Only for feedback
(C) Showing relevant ads
(D) All of these
(D) All of these

Explanation: The data taken from a digital footprint can indeed be used for hacking, feedback collection, and showing relevant ads.

Question 16.
Which of the following activities fool the victim by convincing them that the site is real and legitimate by spoofing or looking almost identical to the actual site? [1](A) Eavesdropping
(B) Phishing
(C) Pharming
(D) PC. Intrusion
(B) Phishing

Explanation: Phishing is an activity where attackers try to deceive and fool victims by creating fake websites or emails that appear legitimate and trustworthy.

Q17 and 18 are ASSERTION AND REASONING based questions. Mark the correct choice as
(A) Both A and R are true and R is the correct explanation of A
(B) Both A and R are true but R is not the correct explanation of A
(C) A is true but R is false
(D) A is false but R is true

Question 17.
Assertion: The mode() method is suitable for finding the most frequently occurring value in a dataset. [1]Reasoning: Mode refers to the value that appears most frequently in a set of numbers, making the mode() method an effective choice for identifying the most commonly repeated value in a list or tuple.
(A) Both A and R are true and R is the correct explanation of A

Explanation: Yes, the assertion is correct. The mode() method is intended to find the mode, which is the most frequently occurring value in a set of numbers in a list or tuple. The mode() method determines and returns the most frequently occurring value by analysing the frequency of each value. Thus, the reasoning is also true and correct explanation for the given assertion.

Question 18.
Assertion: The import statement in Python combines two operations: searching for the named module and
binding the results of that search to a name in the local namespace. [1]

Reasoning: The import statement serves the purpose of incorporating functionality from external modules into a Python program. It first performs a search to locate the specified module by looking for the corresponding file or package. Once the module is found, the import statement binds the results of the search, typically a module object, to a name in the local namespace. This binding allows the program to access and utilize the functions, classes, or variables provided by the imported module.
(A) Both A and R are true and R is the correct explanation of A

Explanation: Yes, the assertion is correct. In Python, the import statement searches for the named module and then bind the results of that search to a name in the local namespace. This two-step process ensures that the desired module is found and loaded, and then allows easy access to and use of the module’s functionality within the program. Thus, the reasoning is also true and correct explanation for the given assertion.

Section B
[Each question carries 2 marks]

Question 19.
Define – [2](i) Why is G.U.I. used?
(ii) What is MS-DOS?


(i) Name two functions of OS?
(ii) Give some examples of utility programs.
(i) G.U.I. or Graphical User Interface puts forth the facility of not remembering the commands, as the commands can be selected on the screen.
(ii) MS-DOS stands for Microsoft Disk Operating System. It is a Command-Line Interface (C.L.I.), and a single user multi-tasking operating system.


(i) Functions of OS

  • Processor management
  • Storage (Memory) management

(ii) Some examples of utility programs are:

  • Virus scanners
  • Disk defragmenters
  • Encryption utilities
  • Backup software

Question 20.
What is application software? Why is it required? [2]


What is the difference between Windows and MS-DOS?
Application software is a software that pertains to applications. Application software is required because system software cannot carry out the routine jobs performed by the user, which application software can easily do.


[Note: Write any 2 points. More given here for reference]


  1. Command-line operating system with a text-based interface.
  2. Single-tasking, capable of running only one program at a time.
  3. Provides basic file management and a platform for running software applications.


  1. Graphical operating system with windows, icons, menus, and a user-friendly interface.
  2. Supports multitasking, allowing users to run multiple programs simultaneously.
  3. Offers advanced features such as a graphical file manager, multimedia capabilities, networking support, and a wide range of software applications.

Question 21.
Draw a flowchart to calculate simple interest.


Draw a flowchart to print sum of first 100 natural numbers.


Question 22.
Find the output of the following:

a=4, 5
print (a//b)
print (a/b)


Question 23.
Write some of the commonly made runtime errors in Python. [2]Answer:
(i) Division by zero.
(ii) Accessing the file which does not exist.
(iii) Using an identifier that has not been defined.
(iv) Performing an operation on incompatible : types.

Question 24.
Explain any 2 types of cyber-bullying.


What will be the output of the following statement?
Justify your answer.
>>>’ Radha’s dress is pretty7
[Note: Write any 2]

i. Doxing: Doxing involves revealing personal information without consent to harass or harm someone online, potentially leading to privacy breaches and threats to their safety.

ii. Harassment: Cyber harassment is the repeated, aggressive behavior online that aims to intimidate, distress, or harm an individual, often through the use of offensive messages, threats, or spreading rumors.

iii. Impersonation: Impersonation involves pretending to be someone else online, either through fake profiles or by using another person’s account, with an intent to deceive or harm others, potentially leading to reputation damage and online manipulation.

iv. Cyberstalking: Cyberstalking is the persistent and unwanted pursuit or monitoring of an individual online, often involving tracking their activities, gathering personal information, and sending threatening or harassing messages, which can cause significant fear, distress, and emotional harm to the victim.


Output: Syntax Error: invalid syntax To get the desired output we need to use escape sequences for single quote in Radha’s. This will make Python interpret the quote as a printable character and not the syntax of a string literal.

Question 25.
What would be the output of the following code snippet? [2]

print (4+9)
print( "4+9")

The output of the following code snippet is:

Section C
[Each question carries 3 marks]

Question 26.
Write a pseudo code to check if a number is an Armstrong number. An armstrong number is the one, in which the
sum of cube of digits is equal to the original number. [3]Answer:
Step 1: INPUT n
Step 2: SET sum = 0, temp = n
Step 3: ITERATE until temp > 0
Extract the last digit of temp, i.e., at one’s place, by using %10
Calculate the cube of this digit, and add it to sum
Update temp by removing the last extracted digit, by using floor division with 10.
Step 4: CHECK IF sum = = n
THEN print(‘Armstrong Number’)
ELSE print(‘Not an Armstrong Number’)

Question 27.
Write a program to calculate in how many days a work will be completed by three persons A, B, and C, together.
A, B, and C take x days, y days, and z days, respectively, to do the job alone. 3
i. Take user input, and store it in integer format.
ii. Calculate the combined working days using the formula xyz/(xy + yz +zx), where x, y, and z are the number of days required to complete the work alone.
iii. Round it to the ceil value, and print the answer.

import math
x = int(input('Enter the number of days required by A:'))
y = int(input('Enter the number of days required by B:'))
z = int(input('Enter the number of days required by C:'))

ii. toget = (x * y * z)/(x*y + y*z + x*z)

iii. days = math.ceil(toget)
print(‘Total time taken to complete work if A, B and C work together:’, days)

Question 28.
Write the pseudocode to print the bill depending upon the price and quantity of an item. Also print G .S.T. Bill, which is the bill including 5% of tax in the total bill. [3]Answer:

INPUT totalitem
INPUT pricePeritem
COMPUTE bill = totalitem * pricePeritem
PRINT bill
COMPUTE tax = bill * (5/100)
COMPUTE gstBill = bill + tax
PRINT gstBill

Question 29.
“You should use the internet ethically”. – Justify this in detail. [3]


What is the importance of cyber law?
Using the internet ethically is necessary to maintain a positive and inclusive digital environment. Ethical internet use promotes respectful online interactions, protects individuals’ privacy and security, and encourages the responsible sharing and use of information. It helps prevent cyberbullying, misinformation, and harmful online behavior. By engaging in ethical internet practices, we contribute to a healthier online community and support the well-being and rights of others.


Cyber law is vital in the digital age as it protects individuals and businesses from cyber crimes, safeguards privacy and intellectual property, promotes e-commerce, enables international cooperation, and balances freedom and responsibility online. It establishes legal frameworks to deter cyber threats, regulates electronic transactions, and ensures a secure and fair digital environment. By enforcing rights and responsibilities in cyberspace, cyber law contributes to a safer and more reliable digital landscape for everyone involved.

Question 30.
Explain the following software licenses: [3]i. Creative Commons
ii. G.P.L.
iii. Apache
i. Creative Commons (CC): Creative Commons licenses provide a flexible framework for creators to specify permissions and restrictions beyond traditional copyright for their creative works. These licenses cover various modules like attribution, sharing, and modification.

ii. GPL (GNU General Public License): GPL is a popular open source copyleft license that grants users the freedom to use, modify, and distribute software, while ensuring that derivative works are also released under the same license, promoting open source collaboration.

iii. Apache License: The Apache License is a permissive open source license that allows users to freely use, modify, and distribute software without the requirement of licensing derivative works under the same terms, facilitating flexibility in combining ‘ code with different licenses.

Section D
[Each question carries 4 marks]

Question 31.
Write a Python program to calculate the first 10 golden ratios for n values ranging from 3 to 13 using the Fibonacci
sequence. Append the golden ratios to a list and print the mean, maximum, and minimum values using the statistics module. [4]The golden ratio is a mathematical constant often approximated as the ratio of two consecutive Fibonacci numbers. The Fibonacci sequence is a series of numbers in which each number is the sum of the two preceding ones, typically starting with 0 and 1.

import statistics
# Function to calculate the fibonacci of n
def fibonacci (n) :
if n <= 0:
return 0
elif n == 1:
return 1
return fibonacci (n - 1) + fibonacci (n - 2)
golden_ratios = [] # List to store the golden ratios
# Calculate and append the golden ratios for n = 3 to 13
for n in range(3,14):
fibonacci_n = fibonacci (n)
fibonacci_n_plus_1 = fibonacci (n + 1)
golden_ratio = fibonacci_n_plus_1 / fibonacci_n

# Calculate and print the mean, maximum, and minimum values

mean_value = statistics.mean(golden_ ratios)
max_value = max(golden_ratios)
min_value = min(golden_ratios)
print("Mean value:", mean_value)
print("Maximum value:", max_value)
print("Minimum value:", min_value)

Question 32.
Consider the following Python code to calculate the factorial of random integers. Answer the question for each
subpart: [4]

import ____
def factorial (n) :
if n == ____ or n == ____ :
return 1
return n * factorial(n - 1)
numbers = random.sample(range(1, 100), 10)
factorial_dict = (num: factorial(num) for num in numbers)
sorted_dict = diet(sorted(factorial_dict.items(), key=lambda x: x[1], ____))
for num, fact in sorted_dict.items():
print(f"The factorial of (num) is {fact}")

i. Which module needs to be imported at the beginning of the code to generate random numbers?
ii. What are the base cases for the recursive function ‘ factorial(n)’ ?
iii. numbers = random.sample(range(1, 100), 10)
What does this line of code do?
iv. To sort the factorial_dict dictionary by factorial values in descending order, what parameter needs to be modified in the line
sorted_dict = diet(sorted(factorial_dict.items(), key=lambda x: x[1], _____))?
i. The ‘random’ module needs to be imported so that we can generate random numbers later on.
ii. The base cases for factorial(n) are when n==0 or n==1, return 1, because the factorial of 0 and 1 is 1.
iii. The given line of code generates a list of 10 random integers between 1 and 100.
iv. To sort the factorial_dict in descending order, we need to modify the parameter reverse to reverse = True

Section E
[Each question carries 5 marks]

Question 33.
Write a program to print the following patterns, for given n, where n=number of rows. Here, n=5: [5]



#upper half
u= (n+1)//2
for i in range (1, u + 1) :
#printing leading spaces
for j in range(k, 1, -1):
print(' ',end=' ')
#printing stars
for j in range(1, 2 *i):
print('*', end=' ')
#lower half
for i in range(1, 0, -1):
#printing leading spaces for j in range(1, k+1):
print(' ', end=' ')
#printing stars
for j in range(1, 2*i):
print('*', end=' ')
print ()


n = 3
# Upper half of the hollow diamond for i in range(n):
# Print leading spaces for j in range(n - i - 1) :
print (" ", end="")
# Print asterisks and double spaces for j in range (i + 1) :
if j == 0 or j == ,i:
print("*", end=" ") # Print
"*" at the edges
print(" ", end=" ") # Print double spaces in between
# Move to the next line print ()
# Lower half of the hollow diamond for i in range(n - 2, -1, -1):
# Print leading spaces for j in range(n - i - 1):
print(" ", end="")
# Print asterisks and double spaces for j in range(i + 1):
if j == 0 or j == i:
print("*", end=" ") # Print
"*" at the edges
print(" ", end=" ") # Print
double spaces in between
# Move to the next line



 n = 5
for i in range (n):
for j in range(n):
if (i == j) or (i == n - 1 - j):
print("#", end=" ") #Printing hash on diagonal places
print("*", end=" ") #Printing stars on other places


rows = 5
k = 2 * rows - 2
for i in range(rows, -1, -1):
for j in range(k, 0, -1):
print(end=" ")
k = k + 1
for j in range (0, i + 1):
print ("*", end=" ")
print(" ")

Question 34.
Write a Python program to create a student database that stores information about multiple students. The program
should consist of the following subparts: [5]

i. Student Initialization: Create a list of students to store the student records. Each student record should be a dictionary containing the following keys: ‘name’, ‘age’, and ‘marks’. Initialize the students list with at least one student record.

ii. Display Records: Define a function display_records() that takes the students data as input and displays the records of all the students in a formatted manner.

iii. Add Student: Define a function add_student() that prompts the user to enter the details of a new student and adds the student record to the students list.

iv. Update Marks: Define a function update_marks() that prompts the user to enter the name of a student and their new marks. Update the student’s marks with the new value.

v. Program Execution: Write the main part of the program that calls the necessary functions in the correct order to execute the student database. Prompt the user to choose an option (1 for display records, 2 for add student, 3 for update marks) and perform the corresponding operation based on their input.

Ensure to provide appropriate comments and meaningful variable names to make the code more understandable.

# Student Initialization
students = [
{'name': 'Alice', 'age': 18, 'marks': 95},
{'name': 'Bob', 'age': 17, 'marks': 85},
{'name': 'Carol', 'age': 16, 'marks': 92}


# Display Records
def display_records():
print("Student Records:")
for student in students:
print(f"Name: {student['name']}")
print(f"Age: {student['age']}")
print(f"Marks: {student['marks']}")
print( )


# Add Student
def add_student():
name = input("Enter student name: ")
age = int(input("Enter student age: ") )
marks = float (input ("Enter student marks: "))
new_student = {'name': name, 'age': age, 'marks': marks}
print("Student added successfully!")


# Update Marks
def update_marks():
name = input("Enter the name of the student: ")
new_marks = float (input ("Enter the new marks: "))
for student in students:
if student['name'] == name:
student['marks'] = new_marks
print("Marks updated successfully!")
print("Student not found.")


# Program Execution
print("Welcome to the Student Database!")
while True:
print("1. Display Records")
print("2. Add Student")
print ("3. Update Marks")
print("4. Exit")
choice = input("Enter your choice (1-4): ")
if choice == '1' :
display_records ()
elif choice == '2':
elif choice == '3':
elif choice == '4':
print("Thank you for using the Student Database. Goodbye!")
print'("Invalid choice. Please try again.")

Question 35.
i. What is the meaning of the term Cyberculture? [5]ii. Discuss the social issues and cultural impact induced by technology
i. Cyberculture refers to the cultural aspects and practices that arise from the use of computer networks and the internet, encompassing beliefs, behaviors, and social interactions shaped by digital technologies.

ii. a) Communication and Social Media: The proliferation of social media platforms has revolutionized how people connect and interact. While it has facilitated global connectivity, it has also raised concerns about online harassment, invasion of privacy, and addiction.

b) Privacy and Security: Advances in technology have brought about concerns regarding data privacy and security. Issues such as data breaches, surveillance, and the collection of personal information by tech companies have sparked debates about individual privacy rights.

c) Workforce Transformation: Automation and AI have reshaped the workforce, leading to job displacement and the need for new skills. Technology’s impact on industries has resulted in a shift in job requirements, emphasizing the importance of continuous learning and adaptation.

d) Cultural Shifts: Technology has influenced cultural norms, behaviors, and forms of entertainment. Digital media consumption, online streaming platforms, and social media have transformed the way people access and engage with cultural content, impacting traditional media industries.

Show More

Related Articles

यौगिक किसे कहते हैं? परिभाषा, प्रकार और विशेषताएं | Yogik Kise Kahate Hain Circuit Breaker Kya Hai Ohm ka Niyam Power Factor Kya hai Basic Electrical in Hindi Interview Questions In Hindi