Students must start practicing the questions from CBSE Sample Papers for Class 11 Computer Science with Solutions Set 3 are designed as per the revised syllabus.
CBSE Sample Papers for Class 11 Computer Science Set 3 with Solutions
Time Allowed: 3 hours
Maximum Marks: 70
General Instructions:
- Please check this question paper contains 35 questions.
- The paper is divided into 5 Sections- A, B, C, D and E.
- Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark.
- Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
- Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
- Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
- Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
- All programming questions are to be answered using Python Language only.
Section A
[Each question carries 1 mark]
Question 1.
_____ is known as the brain of the computer. [1]
(A) CU
(B) ALU
(C) CPU
(D) Memory unit
Answer:
(C) CPU
Explanation:
The CPU is considered the brain of a computer because it performs the majority of the processing tasks, coordinating and executing instructions to carry out calculations and control the computer’s operations.
Question 2.
The expression of a NAND gate is
(A) A.B.
(B) A’B+AB’
(C) (A.B)
(D) (A + B)
Answer:
(C) (A.B)
Explanation:
NAND Gate is an inverter of AND gate. It gives a High Input if any of the input is low. Its symbol is AND Gate with a small circle at the output implying inversion.
Question 3.
In Binary, (F)16 is represented by [1]
(A) (1101)2
(B) (1111)2
(C) (1110)2
(D) (0111)2
Answer:
(B) (1111)2
Explanation:
Each hexadecimal digit can be converted to binary by replacing it with its corresponding four-bit binary representation. In ‘ this case, the digit F is replaced by 1111, which represents the value 15 in decimal and is equivalent to F in hexadecimal.
Question 4.
State TRUE or FALSE. [1]
Python can’t be used for game development.
Answer:
False
Explanation:
Python is used in game development because it’s an incredibly versatile and powerful programming language.
Question 5.
Which of the following statements about Python variables is true?
(A) They must be declared with a specific data type.
(B) They are case-sensitive.
(C) They cannot be reassigned once a value is assigned to them.
(D) They can only store numeric values.
Answer:
(B) They are case-sensitive.
Explanation:
In Python, variables are case-sensitive, which means that “myVar” and “myvar” would be considered as two separate variables.
Python uses dynamic typing, so variables do not need to be declared with a specific data type (option A is incorrect). Python variables can be reassigned with new values throughout the program (option C is incorrect). Python variables can store various types of data, including numeric values, strings, lists, and more (option D is incorrect).
Question 6.
What is the value of y after evaluating the following expressions?
x = 5
y = x+++++x – x—–x
(A) 0
(B) 5
(C) 7
(D) 8
Answer:
(A) 0
Explanation:
Expression is evaluated in the order: y = (x++) + (++x) – (x–) – (–x).This becomes: x++ = 5 and then updates the value of x to 6, as it is a postfix operator. Now prefix operator, ++x increments the value of x from 6 to 7 and then uses it. So till now, y = 5 + 7 = 12 and x = 7. Now, further moving right, x– first uses the current value of x and then decrements it by 1 as it is a postfix operator. So y = 12 – 7 = 5 and then x = 6. Then –x decrements the value of x by 1 and then uses it, so y = 5 – 5 = 0 and x = 5.
Question 7.
State TRUE or FALSE.
Banks and similar institutions have been the worst affected sectors due to technological advancements. [1]
Answer:
False
Explanation:
(1) The biggest revolution that comes came in banks is Digitization. Due to this, the banking process is faster than before and more reliable. Maintenance and retrieval of documents and records have become much faster and easier. (2) Computerized banking also improves the core banking system.
Question 8.
What will be the output of the following? [1]
>> print(bool(0))
(A) True
(B) False
(C) 0
(D) 1
Answer:
(B) False
Explanation:
The bool() ‘ function in Python converts an integer to a boolean value by considering the integer zero as ‘False’ and any non-zero integer as ‘ True ‘.
Question 9.
What gets printed with the following code ? [1]
x = True
y = False
z = False
if x or y and z : print("yes") else: print("no")
(A) False
(B) True
(C) yes
(D) no
Answer:
(C) yes
Explanation:
x OR y AND z
= True OR False AND False
= True OR False
= True
According to the relative precedence levels of operators in programming AND is at higher priority than OR. So y and z executed first.
Question 10.
What gets printed with the following code ?
for i in range(2): print (i, end = ",") for i in range(4, 6) print (i, end=",")
(A) 0, 1, 4, 5
(B) 0, 1, 2, 4, 5, 6
(C) 2, 4, 6
(D) 2, 4, 5, 6
Answer:
(A) 0, 1, 4, 5
Explanation:
The range () function generates a sequence of numbers, starting from 0 by default, and increments by 1 (also by default), and stops before a specified number. So the first loop prints 0 and 1. Then second for loop prints i starting from 4, and then 5.
Question 11.
What will be the output of the below Python code?
str123="12/7" print("str123")
(A) 12/7
(B) 1.7
(C) 1
(D) str123
Answer:
(D) str123
Explanation:
Since in the print statement, s t r 12 3 is written inside double quotes so it will simply print str123 directly.
Question 12.
What is the value of ‘new_list’?
my_list = [1, 2, 3, 4, 5] new_list = my_list[1 : 4]
(A) [1, 2, 3]
(B) [2, 3, 4]
(C) [1, 4]
(D) [1, 2, 3, 4]
Answer:
(B) [2, 3, 4]
Explanation:
The expression my_list [1:4] performs list slicing, which selects elements from index 1 (inclusive) to index 4 (exclusive).
In Python, indexing starts at 0, so the elements at index 1, 2, and 3 are 2, 3, and 4, respectively.
Question 13.
What is the output of the code?
my_tuple = (1, 2, 3, 4, 5) my_tuple[0] = 10
(A) TypeError: ‘tuple’ object does not support item assignment
(B) [10,2,3,4,5]
(C) (10,2,3,4,5)
(D) (1,2,3,4,5)
Answer:
(A) TypeError: ‘tuple’ object does not support item assignment
Explanation:
Tuples in Python are immutable, which means their elements cannot be modified once they are assigned. The line my_tuple[0] = 10 attempts to modify the element at index 0, assigning it the value 10.
This operation raises a TypeError: ‘tuple’ object does not support item assignment.
Question 14.
Which of the following is the correct form of using dict () ?
(A) dict([(‘a’, 45),(‘b’,76)])
(B) dict({‘a’: 45,’b’:76})
(C) None of these
(D) All of these
Answer:
(D) All of these
Explanation:
The contents of a diet can be written as a series of key:value pairs within braces { }, e.g. dict = { key1: value1, key2:value2, ….. }. It can also be passed as a list of pairs of key and value. So option A and B both are correct.
Question 15.
The data taken from a digital footprint can be used for
(A) Hacking
(B) Only for feedback
(C) Showing relevant ads
(D) All of these
Answer:
(D) All of these
Explanation:
The data taken from a digital footprint can be used for various purposes. It can be exploited for hacking, used for providing feedback to improve products or services, and utilized for displaying relevant ads. Therefore, all of these options are possible uses of the data obtained from a digital footprint.
Question 16.
The trademark product is denoted by symbols.
(A) ® or™
(B) ©
(C) ℗
(D) None of these
Answer:
(A) ® or™
Explanation:
Trademark includes any visual symbol, word, name, design, slogan, label etc., that distinguishes the brand or commercial enterprise, from other brands or commercial enterprises.
Q17 and 18 are ASSERTION (A) AND REASONING (R) 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 digital footprint is created automatically when you work on internet and provide data in any
form. [1]
Reasoning: The active digital footprint is created unintentionally without the user’s consent.
Answer:
(C) A is true but R is false
Explanation:
Assertion (A) states that the digital footprint is created automatically when you work ‘ on the Internet and provide data in any form, which is true.
Reason (R) is false as users sometimes actively engage in online activities, knowingly providing information and participating in various platforms, thereby creating their digital footprint with their consent. Therefore, the correct choice is (C) A is true but R is false.
Question 18.
Assertion: Indentation refers to adding the relevant number of tabs and spaces at the beginning of lines of code
to indicate a block of code. [1]
Reasoning: Indentation is very important to make the code readable, without indentation you find it hard to read or debug a program.
Answer:
(A) Both A and R are true and R is the correct explanation of A
Explanation:
Indentation refers to adding tabs and spaces at the beginning of lines of code to indicate a block of code. It is important for code readability and making it easier to understand and debug a program. Without proper indentation, code can be difficult to read and debug. Therefore, both the assertion and reasoning are true, and the reasoning explains the importance of indentation.
Section B
[Each question carries 2 marks]
Question 19.
Draw the equivalent logic circuit diagram for the Boolean expression (A’+B).C’ [2]
OR
(i) Express the OR operator in terms of AND and NOT operator.
(ii) Verify using truth table that X + XY = X for each X, Y in {0,1}.
Answer:
(i) (A+B) = (A” + B”) = (A’.B’)
(ii) The truth table for all possible combination of values of X, Y are.
X | Y | XY | X + XY |
0 | 0 | 0 | 0 |
0 | 1 | 0 | 0 |
1 | 0 | 0 | 1 |
1 | 1 | 1 | 1 |
Comparing the values of columns X and X + XY the expression is verified.
Question 20.
Convert (2267)8 into decimal. [2]
Answer:
2267 = 2*83 + 2*82 + 6*81 + 7*80
= 2 * 512 + 2 * 64 + 6 * 8 + 7 * 1
= 1024 + 128 + 48 + 7
= 1207
Question 21.
What will be the output of the following statements when inputs are [2]
a, b, c=30, 20, 30
(i) print (a<b<=c)
(ii) print(a>b<=c)
OR
Write the output of the following code:
x=5 while(x<15) print (x**2) x+=3
Answer:
(i) False
(ii) True
Explanation:
(i) ab evaluates to True, so it checks further and b<=c is also True, so overall the result evaluates to True.
OR
25
64
121
196
Question 22.
Consider the following string Subject: [2] Subject = “Computer Science” What will be the output of:
(a) print (Subject [: 3 :2 ])
(b) print(Subject[-9:-1])
(c) print (Subject [ 10 : : -2] )
(d) print(Subject*2)
OR
Write the output of the following.
(a) string1 = ‘Rainbow’ print(list(string1))
(b) list1 = [0, 5, 10, 15, 20, 25, 30] list1.clear( ) print (list1)
Answer:
(a) Cm
(b) r Scienc
(c) c eumC
(d) Computer ScienceComputer Science
Explanation:
slicing works as Subject [start_ index: stop_index: gap in between].
Stop index is not included, whereas start index is included.
(a) Extracts the characters between 0th (incl.) and 3rd (excl.) index, at intervals of 2, i.e., alternate index.
(b) Extracts substring from 9th index from right (other end) and till the 1st index on right.
(c) Extracts from the 10th index till the last, at alternate indices and in reverse order, i.e., from the last character on right till the character at the 10th index.
(d) Appends the string once again at the last of the current string PH
OR
The output is:
(a) [‘R’, ‘a’, ‘i’, ‘n’, ‘b’, ‘o’, ‘w’]
(b) [ ]
Explanation:
(a) list() function splits each ’ character into list by default, (b) listl stores elements, but is then cleared using clear ()
Question 23.
Predict the output of the following Python code. [2]
num1=dict([('a',"hello"), ('b',"welcome")]) print('num1 = ',num1) num2=dict([('a',"hello"), ('b',"welcome"), ('c',"good bye")]) print('num2 =' ,num2)
OR
Write the output of the following:
>>> a="python" >>> b=list (a) >>> b*2 >>> b+b >>> a+a
Answer:
num1 = {'a':"hello", 'b':"welcome"} num2 = { 'a':"hello", 'b':"welcome", 'c': "good bye"} num3 = { 'x':23, 'y':45, 'z':67}
Explanation:
In the first part, num1 is created using the diet () constructor along with a list of key- value pairs. It assigns the keys ‘a’ and ‘b’ with the corresponding values ‘hello’ and ‘welcome’. num2 is created in a similar manner, utilizing the dict () constructor with a list of key-value pairs. This time, it includes an additional key ‘c’, with the value ‘good bye’.
Lastly, the third part focuses on num3, which is constructed by combining two lists (‘x’, ‘y’, ‘z’) and (23, 45, 67) using the zip() function. The resulting pairs are transformed into dictionaries, and subsequently, these dictionaries are merged into a single dictionary named num3 utilizing the diet () constructor.
OR
[‘p’, 'y', ‘t’, ‘h’, ‘o’ ‘n’, p'' ‘y’, ‘t’ ‘h’, ‘o’ ‘n’] ['p', ‘y’, 't’, ‘o’, ‘t’, ‘h’, ‘o’, ‘n’] ‘pythonpython
Question 24.
What are the different ways to dispose of e-waste? [2]
Answer:
Ways to dispose off e-waste:
- Give Back to Your Electronic Companies and Drop Off Points
- Visit Civic Institutions
- Donating/Selling Your Outdated Technology
- Give Your Electronic Waste to a Certified E-Waste Recycler
Question 25.
What are the gender issues and disability issues while teaching or using computers? [2]
Answer:
Gender Issues
- Preconceived notions — Notions like “boys are better at technical and girls are good at humanities.
- Lack of motivation
- Lack of role models
- Lack of encouragement in class
- Not a girl friendly work culture
Disability Issues:
- Unavailability of teaching materials/aids
- Lack of special needs teachers
- Lack of supporting curriculum
Section C
[Each question carries 3 marks]
Question 26.
What is the need for secondary memory? [3]
Answer:
- Primary memory has limited storage capacity and is either volatile (RAM) or read-only (ROM). Thus, a computer system needs auxiliary or secondary memory to permanently store the data or instructions for future use.
- Secondary storage devices like CDs and flash drives can transfer the data from one device to another.
- Storage Capacity: Secondary memory provides a significantly larger storage capacity compared to primary memory (RAM).
Question 27.
What does ‘immutable’ mean? Which data types in Python are immutable. [3]
Answer:
In Python, ‘immutable’ refers to the property of an object that cannot be modified after it is created. Once an immutable object is assigned a value, its content cannot be changed. Instead, if a modification is needed, a new object is created with the updated value.
It’s important to note that although the objects of these data types are immutable, variables that reference these objects can be reassigned to new values. However, the original object itself remains unchanged.
Python has the following immutable datatypes: Numbers (int, float, complex), String, and Tuple.
Question 28.
Write a program that reads a string and then prints a new string that capitalizes every second letter in the original string, e.g., computer becomes cOmPuTeR. [3]
OR
What will be the output of the following code segment?
(a)
myList = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] del myList[3:] print(myList)
(b)
myList = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] del myList[:5] print(myList)
(c)
myList = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] del myList[::2] print(myList)
Answer:
string= input ("Enter a string:") length=len(string) print("Original String:", string) string2= "" for a in range(0, length): if a%2 == 0: string2= string2 + string[a] else: string2= string2 + string[a].upper( ) print(string 2)
OR
(a) [1, 2, 3]
(b) [6, 7, 8, 9, 10]
(c) [2, 4, 6, 8, 10)
Explanation:
(a) deleted the elements at and after 3rd index,
(b) deleted the elements till the 5th index (excluding it),
(c) deleted alternate elements from 0th index till last index (including both), i.e., at a gap of 2.
Question 29.
Write the output of the following code. [3]
t=tuple() t = t + ( 'Python',) print(t) print (len (t)) t1= (10,20,30) print(len(t1))
Answer:
(‘Python’,)
1
3
Explanation: In line2,Theempty tuple tis reassigned with a new tuple that concatenates the original tuple with the element ‘Python’. The comma after ‘Python’ ensures that it is treated as a tuple element. So, the updated tuple becomes (‘Python’,).
The len() function in line 4 calculates the length of the tuple t, which is 1 since it contains only one element.
In line 5, a new tuple tl is created with three elements (10,20,30), and thus its length is 3.
Question 30.
Explain the importance of intellectual property rights (IPR) in computer science. Provide two examples of the intellectual property in the field. [3]
Answer:
Intellectual property rights (IPR) are crucial in computer science for several reasons. They protect the rights of creators and encourage innovation. Two examples of intellectual property in computer science are
- Software Copyrights, which safeguard software code and prevent unauthorized use
- Patents, which protect novel inventions and encourage further technological advancements.
Section D
[Each question carries 4 marks]
Question 31.
Write 2 advantages and 2 disadvantages of Digital Footprints. [4]
Answer:
Advantages of Digital Footprints:
- Personalization: Digital footprints enable personalized user experiences by leveraging data on preferences and behaviors.
- Targeted Marketing: Digital footprints allow targeted marketing, leading to higher conversion rates and efficient resource allocation.
Disadvantages of Digital Footprints:
- Privacy Concerns: Digital footprints raise privacy concerns due to the collection and sharing of personal information.
- Loss of Control: Individuals may lose control over how their data is used and shared.
Question 32.
Consider the code given below to compute energy through mass m multiplied by the speed of light (c=3*108). Fill in the gaps as given in the statements. [4]
import ____ #Statement 1 m=____#Statement 2 c=____#Statement 3 e=____#Statement 4 print("Energy:", e, "Joule")
i. Write a statement to import the required module to compute power.
ii. Write a statement to accept floating point value for mass.
iii. Write a statement to compute c as speed of light as given formula. Use a function to compute the power, iv. Write a statement to compute the energy as e = mc2.
Answer:
i. import math
ii. m=float(input(“Enter mass value:”))
iii. c= 3 * (math.pow(10,8))
iv. e=m*c*c
Section E
[Each question carries 5 marks]
Question 33.
Write an algorithm to find: [5]
(i) Factorial of a number
(ii) Print Fibonacci series upto n. Fibonacci number is the sum of previous 2 numbers in the series. Series is: 0, 1, 1, 2, 3, 5,…
OR
(i) Write the output of the following:
(a)
num1 = 4 num2 = num1 + 1 num1 = 2 print (num1, num2)
(b)
num1, num2 = 2, 6 num1, num2 = num2, num1 + 2 print (num1, num2)
(c)
num1, num2 = 2, 3 num3, num2 = num1, num3 + 1 print (num1, num2 , num3) [3]
(ii) Draw a flowchart to print numbers from n to 1. [3]
Where n is input by user. [2]
Answer:
(i)
Step 1: Start Step 2: Read a number n Step 3: Initialize variables: i=1, fact=1 Step 4: if i<= n go to step 5 otherwise go to step 6 Step 5: Calculate fact =fact *i (i=i+1) and go to step 4 Step 6: Print fact Step 7: Stop
(ii)
Step 1: Start Step 2: Declare variable n1, n2, sum, n, i Step 3: Initialize variables: n1 = 0, n2 = 1, i = 2 Step 4: Read n from user Step 5: Repeat this step until i < = n: sum = n1 + n2 print sum n1 = n2 n2 = sum i = i + 1 Step 6: STOP
OR
(i) (a) 2,5
(b) 6,4
(c) Error as num3 is used in RHS of line 2 (num3, num2 = num1, num3 + 1) before defining it earlier.
(ii)
Question 34.
Write a program to read a list of n integers (positive as well as negative). Create a dictionary with the numbers as
keys and store the square of the number if it is negative or cube of the number if it is positive. [5]
OR
Write a Python program that takes a list of integers as input and prints the top k numbers with the highest frequency. [5]
Answer:
n = int(input("Enter the number of integers: ")) numbers = [] # Read the list of integers for i in range(n): num = int (input("Enter an integer:")) numbers.append(num) # Create the dictionary with squares/ cubes result_dict = {} for num in numbers: if num < 0: result_dict[num] = num ** 2 # Square of negative number else: result_dict[num] = num ** 2 # cube of positive number # Print the dictionary print("Result Dictionary:") for key, value in result_dict.items(): print(key, value)
OR
numbers = [] n = int(input("Enter the number of elements in the list: ")) for i in range(0, n) : num = int(input("Enter the element: ") ) numbers.append(num) k = int (input("Enter the value of k: ") ) frequency = { } for num in numbers: frequency[num] = frequency.get(num, 0) + 1 sorted_numbers = sorted(frequency, key=lambda x: frequency[x], reverse=True) top_k_numbers = sorted_numbers[:k] print(top_k_numbers)
Question 35.
Write a program to check if a number is palindrome without converting to string or any other data-structure, i.e., the reverse of the number is the number itself. [5]
Answer:
number = int(input("Enter a number: ") ) # Store the original number in a temporary variable temp = number reverse = 0 # Reverse the number while temp > 0: remainder = temp % 10 #Extract first digit from right reverse = (reverse * 10) + remainder #Add it to the reverse at one's place, i.e. leftmost temp = temp // 10 fupdate the original number by removing the extracted digit if number == reverse: print("The number is a palindrome") else: print ("The number is not a palindrome")