Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 19

CBSE Sample Papers for Class 11 Computer

Science Set 4 with Solutions


Time Allowed: 3 hours
Maximum Marks: 70

ADVERTISEMENT

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.
_____ software is made to perform a specific task.
(A) System
(B) Application
(C) Utility
(D) None of these [1]
Answer:
(B) Application

Explanation:
An application program is a computer program designed to carry out a specific task other
than one relating to the operation of the computer itself, typically to be used by end-users.

Question 2.
State TRUE or FALSE. [1]
Idempotent law states that:
X.X’ =X and X+X’ = X
Answer:
False

Explanation:
Idempotent Law states:

1. A.A = A
2. A + A = A

Question 3.
In binary, (7)8 is represented by [1]
(A) (101)2
(B) (011)2
(C) (110)2
(D) (111)2
Answer:
(D) (111)2

Explanation: The binary equivalent of octal (7)8 is (111)2.

Question 4.
Which of the following is not a sequence datatype in Python? [1]
(A) List
(B) Tuple
(C) Set
(D) String
Answer:
(C) Set

Explanation:
In Python, the list, tuple, and string are all sequence datatypes, meaning they can hold
multiple values in a specific order. They allow indexing and slicing operations.

However, a set is not considered a sequence datatype. Sets are unordered collections of
unique elements, and they do not maintain any specific order.

Question 5.
What is the difference between the i s and == operators in Python? [1]
(A) Both is and == operators check for value equality.
(B) The is operator checks for object identity, while == checks for value equality.
(C) The is operator checks for value equality, while == checks for object identity.
(D) Both is and == operators check for object identity.
Answer:
(B) The is operator checks for object identity, while == checks for value equality.

Explanation:
In Python, the is operator is used to check if two objects refer to the same memory location,
indicating object identity. It compares the memory addresses of the objects.
On the other hand, the == operator is used to check if two objects have the same value or
content, indicating value equality. It compares the values of the objects.
Question 6.
Which of the following is the least restrictive open_source license? [1]
(A) MIT
(B) BSD
(C) GNUGPL
(D) Apache
Answer:
(A) MIT

Explanation:
Among the options provided, the MIT License (option A) is the least restrictive open source
license. It allows users to freely use, modify, distribute, and sublicense the software without
imposing any restrictions.

In comparison, the BSD License is also a permissive open-source license, but it may have
slightly more restrictive clauses in certain variants.

The GNUGPL (GNU General Public License) (option C) and Apache License (option D) are
more restrictive licenses compared to MIT and BSD.

Question 7.
Rudra wants to divide a number and store the result without decimal places into an integer
variable. Suggest him an appropriate operator from the following:[1]
(A) /
(B) %
(C) //
(D) Both (A) & (B)
Answer:
(C) //

Explanation:
Floor Division (//) – The division of operands where the result is the quotient in which the
digits after the decimal point are removed.

Question 8.
Which of the following is not a mutable data type? [1]
(A) Lists
(B) Dictionaries
(C) Sets
(D) Tuples
Answer:
(D) Tuples

Explanation:
Mutable data types can change their values in place e.g. Lists and dictionaries.
Question 9.
What will be the output? [1]

x="1a3"
sum = 0
for i in x:
if i.isdigit():
sum+= int(i)
print(sum)
(A) 6
(B) 4
(C) 0
(D) None of these
Answer:
(B) 4

Explanation:
The isdigit () function returns True if the specified string is a number, otherwise False. Here,
only 1st and last elements are numbers, so their values are added to sum, which becomes 4.

Question 10.
Which of the following Python code will give different output from the others? [1]
(A) for i in range(0, 5) :
print(i)
(B) for j in [0,1,2,3,4]:
print (j)
(C) for k in [0,1,2,3,4,5]:
print(k)
(D) for 1 in range(0,5,1) :
print(l)
Answer:
(C) for k in [0,1,2,3,4,5]:
print(k)

Explanation:
In option C, all the values will be printed, which are from 0 to 5 (both inclusive). Similarly, in
option B, values are printed upto 4. In options A & D, values are printed from 0 to 5, but
excluding 5. Therefore, C is the different one.

Question 11.
Which of the following will result in an error? [1]

st="python_language"
(A) print(st [2])
(B) st[l]=”Wow”
(C) print(st[0:5])
(D) Both (B) and (C)
Answer:
(B) st[l]=”Wow”

Explanation:
Strings are immutable. So, new values cannot be assigned at any index position in a string.

Question 12.
What will be the output of the below Python code? [1]

list1=[5, 3, 9, 0]
print(list1[: : -1])
(A) [0,9,3,5]
(B) [0]
(C) [9]
(D) [5, 3, 9, 0]
Answer:
(A) [0,9,3,5]

Explanation:
The negative indexing is the act of indexing from the end of the list with indexing starting at -
1 i.e. -1 gives the last element of list, -2 gives the second last element of list and so on.

Question 13.
What will be the output of the below Python code? [1]

tup1=('a', 'b', 2)
tup3=tup1*2
print(tup3)
(A) (‘a’, ‘b’, 2, ‘a’, ‘b’, 2)
(B) (‘a’,’b’,4)
(C) (‘a’, ‘a’, ‘b’, ‘b’, 2, 2)
(D) Error
Answer:
(A) (‘a’, ‘b’, 2, ‘a’, ‘b’, 2)

Explanation:
The * operator concatenates multiple copies of the same.

Question 14.
Predict the output of the following code if: [1]

mydict = {'a':23,'b': '78','c':89,


del mydict['c']
print( mydict)
(A) {‘a’:23,’b’: ’78’,’c’:89,’d’:36}
(B) {‘a’:23,’b’: ’78’,’d’:36}
(C) {‘a’:23,’b’: ’78’,89, ‘d’:36}
(D) {‘a’:23, ‘b’: ’78’, ‘d’:89, ‘e’:36}
Answer:
(B) {‘a’:23,’b’: ’78’,’d’:36}

Explanation:
del keyword is used to remove individual items or the entire dictionary itself. Here, del
keyword removed the key ‘c’ from the dictionary, along with its value.

Question 15.
When someone steals someone else’s personal information to commit theft or fraud, it is
called________ [1]
(A) Identity theft
(B) Hacking
(C) Computer piracy
(D) Infringement
Answer:
(A) Identity theft

Explanation:
Identity theft is the crime of obtaining the personal or financial information of another person
to use their identity to commit fraud, such as making unauthorized transactions or purchases.
Identity theft is committed in many different ways and its victims are typically left with
damage to their credit, finances, and reputation.

Question 16.
One of the cultural changes induced by the technology is: [1]
(A) people have lost a deeper understanding of their culture.
(B) going out for lunch and dinner has become a culture
(C) people love to go shopping
(D) All of the above
Answer:
(A) people have lost a deeper understanding of their culture.

Explanation:
Technology has a crucial impact on fundamental aspects of all our cultures including
language, art, mobility, education and religion.

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 (A): The IT Act 2000 does not protect from Child Pornography. [1]
Reason (R): IT Act section 67 was amended to ensure that browsing sites of Child
Pornography is also an Offence.
Answer:
(D) A is false but R is true

Explanation:
Child pornography is an illegal act in India. Information Technology Act, 2000 & Indian
Penal Code, 1860 gives protection against the child pornography. Child refers to a person
who is below the age of 18 years.

Question 18.
Assertion (A): a* *b is used for power, i.e., ab
Reason (R): <, > operators are similar to ! = operator [1]
Answer:
(B) Both A and R are true but R is not the correct explanation of A

Explanation:
The power operator in python is a**b, i.e., 2**3=8. Also <,>&!= are all relational operators
and are therefore similar. But the reasoning is not correct for the given assertion.

Section B
[Each question carries 2 marks]

Question 19.
Draw a logic circuit for the following Boolean expression: AB + CD’ [2]

OR

(i) Find the 1’s complement of 110001?


(ii) Write the equivalent boolean expression for the following logic circuit.

Answer:
(1/2 mark for placing each gate)

OR

(i) 1’s complement of 110001 is 001110


(ii) ((X.Y)’ + (X.Y)’) = X.Y

Question 20.
write a binary representation of the following hexadecimal numbers. [2]
(i) 4026
(ii) BCA1
(iii) 98E
(iv) 132.45
Answer:
(i) (4026)16 = (0100000000100110)2
(ii) (BCA1)16 = (1o111oo1o1oooo1)2
(iii) (98E)16 = (100110001110)2
(iv) (132.45)16 = (000100110010 . 01000101)2

Question 21.
What is the difference between an expression and a statement in Python? [2]

OR

Convert the following loop into for loop:

x=4
while(x<=8):
print (x*10)
x+=2
Answer:

Statement Expression
Represents a command or instruction Used in calculations, assignments, etc.

May or may not produce a value Always has a value

e.g., 5+3, x*y e.g., x=5, print(‘Hii’), if-else blocks

Executes the instructions in the statement Can be evaluated to obtain a value

OR

for x in range(4,9,2):
print(x* 10)
Question 22.
What will be the output of the following code if the input is given: [2]
(i) abbcca
(ii) bccabc

string = input ("Enter a string:'')


count = 0
while True :
if string[0] == 'a' :
string = string[2:]
elif string[-1] == 'b':
string = string [:2]
else :
count+=1
break
print(string)
print(count)
OR

What will be the output of the following statements?

(i)

list1 = [12, 32, 65, 26, 80, 10]


list1.sort()
print(list1)
(ii)

list1 = [12, 32, 65, 26, 80, 10]


sorted(list1)
print(list1)
(iii)

list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]


print (list1[: :-2])
print(list1 [:3] + list1[3:])
(iv)

list1 = [1, 2, 3, 4, 5]
print(list1[len(list1)-1])
Answer:
(i) bcca
1
(ii) bccabc
1

Explanation:

(i) In the first iteration of the while loop, the condition string[0] = = ‘a’ is satisfied, so the
first two characters are removed. The updated string becomes “bcca”. In the second iteration,
the condition string [-1] == ‘b’is not satisfied, so the else block is executed. The count is
incremented by 1, and the while loop is exited.

(ii) In the first iteration of the while loop, the condition string [0] == ‘a’ orstring[-1] == ‘b’ is
not satisfied, so the else block is executed. It increments the count to 1 and breaks the loop.
The original string is printed because no conditions were satisfied.

OR

(i) [10, 12, 26, 32, 65, 80]


(ii) [12, 32, 65, 26, 80, 10]
(iii) [10, 8, 6, 4, 2]
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
(iv) 5

Explanation:

(i) sort() function sorts the original list in-place, which is then printed.
(ii) sorted () function sorts the list, but returns a new copy and does not update the original
list. Due to this, the original list remains un-sorted.

(iii) 1st print statement prints the alternate elements in list1, in reverse order. The 2nd
statement prints the whole list, as the stop index and start index of the slicing operations are
same and, therefore the remaining list from 1st slicing is added later.

(iv) The last element of list is printed.

Question 23.
If d={‘math’: 45, ‘english’, 60, ‘science’: 65, ‘computer science’: 70} [2]
What will be the output of the following?
(i) print (len (d) )
(ii) print(list(d.keys( )))
(iii) print (d[“english”] )
(iv) print(max(d.values() ) )

OR

Start with the list [8, 9,10]. Do the following using list functions:
(i) Set the second entry (index 1) to 17
(ii) Add 4,5 and 6 to the end of the list
(iii) Remove the first entry from the list
(iv) Insert 25 at index 3
Answer:
(i) 4
(ii) [‘math’, ‘english’, ‘science’, ‘computer science’]
(iii) 60
(iv) ‘70

Explanation:

1. the length of the dictionary is printed


2. The keys of the dictionary are printed using keys ()
3. The value of ‘English’ key in the dictionary is printed,
4. values () function returns the list of all values in the dictionary, and then max is
picked from it.

OR

listA = [8,9,10]
(i) listA[1] = 17
(ii) listA.extend([4, 5, 6])
(iii) listA.pop(0)
(iv) listA.insert(3, 25)
Question 24.
Name the crimes for which cyber laws are enforced strictly in India. [2]
Answer:
These are:
(a) cyber crimes,
(b) electronic and digital signatures,
(c) intellectual property, and
(d) data protection and privacy.

Question 25.
Where are the digital footprints mainly stored? [2]
Answer:
There are two main storages of digital footprints:

1. Browser Settings: The digital footprints can be saved in browser history,


cookies, password, autofill data etc.
2. Web Server and Database: Every website has its own database. When the user
enters data and fills it up, it can be saved in the database.

Section C
[Each question carries 3 marks]

Question 26.
Differentiate between DRAM and SRAM. [3]
Answer:

DRAM SRAM

(i) A DRAM cell consists of only one transistor


A SRAM consists of internal flip-flops.
and one capacitor.
(ii) It has a large number of cells packed within the
The number of cells on a SRAM chip is less.
chip.

(iii) It needs to be refreshed (about thousand times It retains data as long as the power is supplied to

in a second) to retain the stored data. it i.e., there is no need to refresh it.

(iv) DRAMs are used in primary storage


SRAMs are used in specialized applications.
sections of most computers.

Question 27.
Name four Python’s basic data types. Why are they called so? [3]
Answer:
The four basic data types are :

(i) Number
(ii) Sequences
(iii) Sets
(iv) Maps.

These are called so because:

(i) Number data type stores numerical values and is immutable. These are of 3 types :

a. Integer and Long


b. Float/Floating point
c. Complex

(ii) Sequence is an ordered collection of items (just like a logical sequence series), indexed by
positive integers. It is a combination of mutable and non- mutable data types. Three types of
sequence data types available in Python are strings, lists and tuples.

(iii) Sets is an unordered collection of values of any type, with no duplicate entry. Sets are
immutable, e.g., S = set ([1, 2, 3, 4])
(iv) Mapping data types are unordered and mutable. They map one key to one or more values,
e.g., Dictonaries.

Question 28.
Write a Python program to find the number of times a maximum occurring element occurs in
a list. [3]
Answer:

1st = input().split()
count_dict = { }
for element in 1st:
# If the element is already in the dictionary, increment its
count by 1 if element in count_dict:
count_dict[element] += 1
# If the element is not in the dictionary, add it with an
initial count of 1
else:
count_dict[element] = 1
# Find the maximum count
max_count = max(count_dict.values())
print(max_count)
Question 29.
Write a program to add all the values in the tuple of marks t= (23, 11, 41, 56, 1) which ends
with 1 and display their sum. [3]

OR

Write the output of the following code:


A= {10:100,20:200,30:3000,40:4000,50:5000}
(i) print (A.items( ))
(ii) print(A.keys( ))
(iii) print(A.values( ))
Answer:

t = (23, 11, 41, 56, 1)


s=0
for i in t:
if i%10==1:
print(i, end=' ')
s+=i
print("\nSum ends with 1 is:",s)
OR

(i) dict_items ([ (10, 100), (20, 200), (30, 3000), (40, 4000), (50, 5000)])
(ii) dict_keys ([10, 20, 30, 40, 50])
(iii) dict_values ([100, 200, 3000, 4000, 5000])
Explanation:
items () prints the key, value pair of the dictionary, whereas keys () returns a list of ah the
keys, and values () returns a list of all the values.

Question 30.
List the guidelines to avoid plagiarism. [3]
Answer:
Follow the below given guidelines to avoid plagiarism:

 To avoid plagiarism, instead of directly copying the language of the book as it


is, understand it and try to put it in your own language/words.
 If copying someone else’s work in your work, word for word, then do not forget
to enclose it in quotes and also mention its source.
 Give credit to the author whose work you are using.

Section D
[Each question carries 4 marks]

Question 31.
Why is it important to recycle e-waste? Give 4 distinct points. [4]
Answer:
Recycling e-waste, or electronic waste, is crucial for severed reasons:

1. Prevents toxic pollution: E-waste contains harmful substances that can pollute
the environment if not recycled.
2. Reduces landfill waste: Recycling e-waste helps minimize the amount of
electronic waste sent to landfills, conserving valuable space.
3. Conservation of resources: E-waste recycling allows for the recovery of
valuable materials like metals and plastics, reducing the need for virgin
resource extraction.
4. Energy savings: Recycling e-waste requires less energy compared to
manufacturing products from raw materials, leading to energy conservation.

Question 32.
Write a Python program to input space-separated list of student heights and calculate the
average height of
students in the class and median. Also calculate the most common height, i.e., the mode. [4]
Answer:

import statistics
heights = input("Enter space-separated heights").split()
avg = statistics.mean(heights)
print("Average height in the class:",avg)
median_value median(heights) = statistics.median(heights)
print("Median value for heights:",median_value)
mode = statistics.mode(heights)
print("Mode value for heights:", mode)
Section E
[Each question carries 5 marks]

Question 33.
Draw a flowchart to check whether a given number is an Armstrong number. An Armstrong
number of three digits is an integer such that the sum of the cubes of its digits is equal to the
number itself. For example, 371 is an
Armstrong number since 3* *3 + 7* *3 + 1 * *3 = 371. [5]

OR

Write a program to print the following pattern:


12345
1234
123
12
1
Answer:

OR

n = 5
for i in range (n, 0, -1): # Loop for the rows
for j in range(n - i): # Loop for the spaces before each row
print(" ", end="")
for j in ranged, i ,+ 1) : # Loop for the numbers in each row
print (j, end=" ”)
print() # Move to the next line after printing a row
Question 34.
Write a program to read a list of elements. Modify this list so that it does not contain any
duplicate elements, i.e.,
all elements occurring multiple times in the list should appear only once. [5]

OR
(i) If a is [1,2,3]
(a) What is the difference (if any) between a * 3 and [a, a, a]?
(b) is a * 3 equivalent to a + a + a? 2
(ii) What does each of the following expressions evaluate to? Suppose that L is the list
[“These”, [“are”, “a”, “few”, “words”], “that”, “we”, “will”, “use”].

 L[1] [0: : 2]
 “a” in L[1][0]
 L [: 1 ] + L [ 1 ] [3]

Answer:

n = int(input("How many elements you want to enter in a


list?"))
ol=[ ]
for i in range(n):
e = int(input("Enter the element :") )
ol.append(e)
len = len(ol)
#Sorting the list to bring duplicate elements together
ol.sort()
c=0
print("Original List is : ", ol)
#Iterating over the list to remove consecutive duplicate
elements
while(c<len-1):
if ol[c] == ol[c+1]:
ol.pop(c) #Removing element if next element is same
len=len-l
else:
c=c+1
print("List after removing duplicate Values is : ",ol)
OR

(i)

a) a * 3 ⇒ [1, 2, 3, 1, 2, 3, 1, 2, 3]
[a, a, a] ⇒ [[1, 2, 3], [1, 2, 3], [1, 2, 3]]
So, a * 3 repeats the elements of the list whereas [a, a, a] creates nested list.

b) Yes, both a * 3 and a + a + a will result in [1,2,3, 1,2,3,1,2,3]

(ii)

 [‘are’, ‘few’]
L[1] returns [“are”, “a”, “few”, “words”]. L[1][0::2] returns a slice of [“are”,
“a”, “few”, “words”] starting at index 0 covering every alternate element till the
end of the list. So, final output is [‘are’, ‘few’].
 True
L[1][0] is “are”. As “a” is present in “are” so output is True.
 [‘These’, ‘are’, ‘a’, ‘few’, ‘words’]
L[:1] return L[0] i.e. [“These”]. L[1] returns [“are”, “a”, “few”, “words”]. +
operator adds the two in a single list to give the final output as [‘These’, ‘are’,
‘a’, ‘few’, ‘words’].

Question 35.
Write a python program as per the steps given: [5]
(i) Take user-input in a string.
(ii) Calculate and store the frequency of each character in string
(iii) Sort the characters based on increasing frequency. If a tie occurs, sort as per the
alphabetical order.
(iv) Update the string and print the answer.
Answer:
Part (i):

User input
str = input("Enter a string: ")
Part (ii):

Count the frequency of each


character
frequency = { }
for ch in str:
if ch in frequency:
frequency[ch] += 1
else:
frequency[ch] = 1
Part (iii): Sort the characters based on frequency and
alphabetical order sorted_chars = sorted(frequency, key=lambda
x: (-frequency[x], x))
Part (iv): Create the sorted string and return the
result sorted_string = ''.join(sorted_chars)
print(sorted_string)

You might also like