Students must start practicing the questions from CBSE Sample Papers for Class 11 Computer Science with Solutions Set 5 are designed as per the revised syllabus.
CBSE Sample Papers for Class 11 Computer Science Set 5 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.
Which of the following is not a pointing device? [1]
(A) Mouse
(B) Joystick
(C) Light pen
(D) Digitizer
Answer:
(D) Digitizer
Explanation:
Digitizer is an input device that converts analog information into a digital form.
Question 2.
Which of the following Boolean operator operates on a single operand? [1]
(A) NOT
(B) AND
(C) OR
(D) NAND
Answer:
(A) NOT
Explanation:
AND, OR, NAND all take more than > one operand.
Question 3.
One octet represents ___ bits. [1]
(A) 8
(B) 16
(C) 32
(D) 1024
Answer:
(A) 8
Explanation:
An octet in computer systems and ’ networks represents an 8-bit quantity.
Question 4.
Which of the following Python mode allows you to write Python program with multiple lines? [1]
(A) Interactive Mode
(B) Script Mode
(C) Client Mode
(D) Debug Mode
Answer:
(B) Script Mode
Explanation:
Script mode is where you write your, code in a . py file and then run it with the Python command.
Question 5.
Which of the following is not a Python token ? [1]
(A) Keyword
(B) Literals
(C) List
(D) Operators
Answer:
(C) List
Explanation:
The smallest individual unit in a program is known as a token or a lexical unit. There are different types of tokens in Python such as identifiers, reserved words, literals, operators and punctuators.
Question 6.
Which of the following symbol is not an operator? [1]
(A) /
(B) %
(C) //
(D) #
Answer:
(D) #
Explanation:
Operators are special symbols which perform some computation. # is used for comments, which are lines that are not executed in code.
Question 7.
The programmers who break into secure systems for malicious purpose are: [1]
(A) crackers
(B) hackers
(C) breakers
(D) burglars
Answer:
(A) crackers
Explanation:
A cracker is an individual who performs cracking, or the process of breaking into a computer or a network system. A cracker might be performing cracking for malicious activities, profit, certain nonprofit intentions or causes, or just for a challenge.
Question 8.
Which of these is not a core data type? [1]
(A) List
(B) Tuple
(C) Dictionary
(D) Class
Answer:
(D) Class
Explanation:
Class is a user-defined data type.
Question 9.
How many times will the loop run? [1]
i=2 while(i>0): i=i-1
(A) 2
(B) 3
(C) 1
(D) 0
Answer:
(A) 2
Explanation:
The loop will run 2 times, for i=2 and 1.
Question 10.
Which of the following sequences would be generated by the given line of code? [1]
(A) 5 4 3 2 1 0 -1
(B) 5 4 3 2 1 0
(C) 5 3 1
(D) None of the above
Answer:
(C) 5 3 1
Explanation:
The initial value is 5 which is decreased by 2 till 0 so we get 5, then 2 is subtracted so we get 3 then the same thing repeated we get 1 and now when 2 is subtracted we get -1 which is less than 0 so we stop and hence we get 5 3 1.
Question 11.
What will be the output of below Python code?
str1 = "Artificial" print (str1[2:7])
(A) tifici
(B) rtifici
(C) rtific
(D) tific
Answer:
(A) tifici
Explanation:
In string slicing, the output is the substring starting from the first given index position i.e 2 to one less than the second given index position i.e.(8 – 1 = 7) of the given string str1.
Question 12.
Which of the following will give output as [6,1, 0, 3, 8]?
If list=[8, 4, 3, 9, 0, 2, 1, 5, 6] [1]
(A) print(list[7::-2])
(B) print(list[::-2])
(C) print(list[0:9:2])
(D) print(list[0: :2] )
Answer:
(B) print(list[::-2])
Explanation:
The [:: -2 ] reverses the order with a difference of 2 steps.
Question 13.
Which of the following two Python codes will give same output?
(i) print (tup [:-1 ] )
(ii) print (tup [0 : 6] )
(iii) print(tup[0:5])
(iv) print (tup[-5:])
If tup= (3,5,1,6,7,0)
(A) i, ii
(B) ii, iv
(C) i, iv
(D) i, iii
Answer:
(D) i, iii
Explanation:
tup[0:5] returns a tuple with elements from index 0 to index 5(excluding it), tup [: -1] returns a tuple with elements from beginning to index -1, i.e. 1st index from right, which is also the 5th index from left. So both return the same slicing output.
Question 14.
Which of the following will delete key_value pair for key=”tiger ” in dictionary?
dic={"lion":"wild","tiger":"wild","cat":"domestic","dog":"domestic"}
(A) del dic[“tiger”]
(B) dic[“tiger”].delete()
(C) delete(dic.[“tiger”])
(D) del(dic.[“tiger”])
Answer:
(A) del dic[“tiger”]
Explanation:
del die [ “tiger”] will delete key_ value pair for key=”tiger” from dictionary.
Question 15.
Recycling of e-waste is needed for
(A) protecting human and environmental health
(B) save money
(C) save space
(D) help needy
Answer:
(A) protecting human and environmental health
Explanation:
The recycling of e-waste serves a lot of useful purposes. For instance, include protecting human and environmental health by keeping those devices out of landfills. Or recovering the parts within the devices that still have value, and providing manufacturers with recycled metals that can be used to make new products.
Question 16.
State TRUE or FALSE.
Technology such as computers, smartphones, laptops etc. have made life complex.
Answer:
False.
Explanation:
Technologies like tablets, laptops, computers smartphones etc. have made communication more accessible, and people can ensure connectivity with one another anytime.
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): Permission given to use a product by the copyright holder is License. [1]
Reason (R): One should not use the copyrighted product without taking license.
Answer:
(A) Both A and R are true and R is the correct explanation of A
Explanation:
When someone obtains a license, they are granted the legal right to use the copyrighted product in a specific manner as specified by the license agreement. So, assertion is correct.
The reason provided explains why one should obtain a license before using a copyrighted product. It emphasizes the importance of obtaining permission through a license rather than using the product without authorization, which is also true.
Question 18.
Assertion (A): Logical errors can easily be debugged. [1]
Reason (R): Run time errors are known as exception.
Answer:
(D) A is false but R is true
Explanation:
Logical errors are errors in a program’s logic that result in unexpected behavior, and are more difficult than syntax or runtime errors, to debug as they often do not give warnings. So Assertion is false.
Runtime errors are often referred to as exceptions because they typically cause the program’s normal flow to be disrupted, and exceptions provide a mechanism to handle and recover from these errors. So, Reason is true, but it is not the reason for the assertion.
Section B
[Each question carries 2 marks]
Question 19.
Correct the following boolean statements:
(1) X+1 = X
(2) (A’)’ = A’
(3) A+A’ = 0
(4) (A+B)’ = A.B
OR
(i) State the idempotent law of Boolean Algebra.
(ii) Find the complement of the following expression
(A + B).(B + C).(A + C)
Answer:
(1) X + 1 = 1 or X + 0 = X
(2) ((A’)’=A
(3) A + A’ = 1 or AA’ = 0
(4) (A + B)’ = A’B’
[1/2 mark for each corrected statement]
OR
(i) Idempotent Law = An input that is AND’ed or OR’ed with itself is equal to that input.
A + A = A A variable OR’ed with itself is always equal to the variable
A . A = A A variable AND’ed with itself is always equal to the variable
(ii) Complement of (A + B).(B + C).(A + C)
= [(A + B).(B + C).(A + C)]’
= (A + B)’ + [(B + C).(A + C)]’
= (A + B)’ + (B + C)’ + (A + C)’
= A’.B’ + B’.C’ + A’.C’
Question 20.
Convert (69)10 into equivalent binary number. [1]
Answer:
(69)10 = (1000101)2
Question 21.
Assume if A = 60; and B = 13; then find the values of the following :
(i) A&B
(ii) A|B [2]
OR
How many types of strings are supported in Python?
Answer:
Here in binary format they will be as follows:
A = 00111100
B = 0000 1101
hence
A&B = 00001100 and A|B = 00111101
OR
Python allows two string types:
- Single line strings : Strings that are terminated in single line. For example :
str = ‘Oswaal Books’ - Multiple strings : Strings storing multiple lines of text. For example: str = ‘Owaal Books’
or str = ” ” ” Oswal Books
” ” “
Question 22.
Give the output of these Python codes:
x = “Marvellous”
(i) print (x [3 : ] , “and”, x[:2])
(ii) print (x [-7 :] , “and”, x[-4:-2])
OR
Write the output of the following code.
A = [2, 4, 6, 8,10] L = len(A) S = 0 for I in range (1, L, 2) : S+= A[I] print("Sum=", S)
Answer:
vellous and Ma
vellous and lo
OR
Sum = 12
Explanation:
for loop runs from index 1, till the last index of list, with a step size of 2.
A[1] = 4, step size = 2
A[3] = 8
S = 4 + 8 = 12
Question 23.
If
d1 = {"john":40, "peter":45} d2 = {"john":466, "peter":45} d3 = ("john":40, "peter":45}
What will be the output of the following?
(i) “john” in d1
(II) d1 == d2
(iii) d1 > d2
(iv) d1 == d3
OR
Given a list L1 = [3, 4.5, 12, 25.7, [2, 1, 0, 5], 88]
(i) Which list slice will return (12, 25.7, [2, 1, 0, 5]]?
(ii) Which expression will return [2, 1, 0, 5]?
(iii) Which list slice will return [[2, 1, 0, 5]]?
(iv) Which list slice will return [4.5, 25.7, 88]?
Answer:
(i) True
(ii) False
(iii) Error
(iv) True
Explanation:
i) Here, ‘in’ operator checks if the given string is a key in the dictionary
ii) d1≠d2 as the value of “john” is different in both
iii) Can not establish a less than or greater than relationship with dictionary objects,
(iv) d1 = =d3 as both are completely same.
OR
(i) L1 [2:5]
(ii) L1 [4]
(iii) L1 [4:5]
(iv) L1[1::2]
Question 24.
What is copyright infringement?
Answer:
Copyright infringement is when we use another person’s work without obtaining their permission to use or we have not paid for it, if it is being sold. Suppose we download an image from the internet and use it in our project.
But if the owner of the copyright of the image does not permit its free usage, then using such an image even after giving reference of the image in our project is a violation of copyright. Just because it is on the Internet, does not mean that it is free for use. Hence, check the copyright status of the writer’s work before using it to avoid plagiarism.
Question 25.
What is cyber bullying?
Answer:
Harassing, demeaning, embarrassing, defaming or intimidating someone using communication technologies such as internet, cell phones, instant messengers, social networks, etc. is called Cyber Bullying.
Section C
[Each question carries 3 marks]
Question 26.
What are language translators? What are its types? [3]
Answer:
Language translators are system software that translate the source code written in a high level language or assembly language into object code or machine code.
There are three types of language translators:
- Assembler: It converts the program written in assembly language into machine language
- Interpreter: An interpreter is a type of system software that translates and executes instructions line-by-line.
- Compiler: It converts high-level language code to machine (object) code in one session.
Question 27.
What is the difference between a list and tuple? [3]
Answer:
Lists | Tuples |
Lists, are mutable, i.e. they can be edited | Tuples are immutable (they are lists that cannot be edited) |
Lists are usually slower than tuples | Tuples are faster than lists |
Lists consume a lot of memory | Tuples consume less memory when compared to lists |
Lists are less reliable in terms of errors as unexpected changes are more likely to occur | Tuples are more reliable as it is hard for any unexpected changes to occur |
Lists consist of many built-in functions | Tuples do not consist of any built-in functions. |
Syntax list_1 = [10,’intelispaar. w0]] | Syntax tup_1=[10,’intelispaar.w0]] |
Note: Mention any 3 points
Question 28.
Write the output of the given Python code. [3]
s.tr = "This is a form of online harassment." str1 = "is"
(i) print (str.rfind (“is”) )
(ii) print (str.rfind (str1, 0,10))
(iii) print (str.rfind (str1, 10, 0))
(iv) print (str .find(str1) )
(v) print (str.find(str1, 0,10))
(vi) print (str .find (str1, 10, 0))
Answer:
(i) 5
(ii) 5
(iii) -1
(iv) 2
(v) 2
(vi)-1
Explanation:
rfind () finds and returns the last occurrence of a given char/substring in the string, whereas find () looks for the very first occurrence. The syntax is: rfind (substring, start_index, stop_index)
Question 29.
What do you mean by packing and unpacking of tuples? Illustrate the answer with an example.
OR
What are the characteristics of Python Dictionaries ?
Answer:
Tuple packing refers to assigning multiple values into a tuple.
Tuple unpacking refers to assigning a tuple into multiple variables.
Example:
Packing t=(1, 'Computer Science', Class 11') Here just assigned multiple values, which are 1, 'Computer Science' and 'Class 11' into tuple t. Unpacking: Sno, sub, cla =t[0], t[1], [t2] Sno, sub, cla= t Tuple unpacking is totally the opposite action of tuple packing.
OR
The 3 main characteristics of a dictionary are :
- Dictionaries are Unordered: The dictionary elements (key-value pairs) are not in an ordered form.
- Dictionary Keys are Case Sensitive: The same key name but with different cases are treated as different keys in Python dictionaries.
- No duplicate key is allowed: When duplicate keys are encountered during the assignment, the last assignment wins and overwrites the previous value.
Question 30.
Write two ways in which a VIRUS affects a computer system, and one way how spyware attacks.
Answer:
(a) VIRUS
- A VIRUS infects system files thus making a system to behave unexpectedly.
- A VIRUS tends to slow down the system by executing itself in the background.
(b) Spyware
(i) Information Theft: Spyware is designed to covertly collect sensitive information from infected systems without the user’s consent.
Section D
[Each question carries 4 marks]
Question 31.
What measures should one take to maintain confidentiality of personal information?
Answer:
We should follow the following to maintain confidentiality of personal information:
- Never open suspicious texts or emails.
- Never send money or give your credit card, personal details, bank account details to anyone you don’t know or trust.
- Choose strong passwords and update them regularly.
- Avoid using public computers or WiFi hotspots to access or provide personal information.
Question 32.
Write the output of the following: ‘
import math
a. print (math, cell (35.7) )
b. print(math.cell(-98.9))
c. print(math.sqrt(math.cell(63.01)))
d. print(math.pow(9,math.sqrt(4)))
e. print(math.pow(10,-2))
f. print(math.sqrt(81))
g. print(math.pow (4, -2))
h. print(math.pow(math.sqrt(100),math.cell(-3, 96)))
Answer:
a. 36
b. -98
c. 8.0
d. 81.0
e. 0.01
f. 9.0
g. 0.0625
h. 0.001
Section E
[Each question carries 5 marks]
Question 33.
Write a python program to encrypt a string as per the following rules: [5]
i) Replace vowels with
ii) Change the case of consonant, i.e. b->B and vice-versa
iii) Replace any no. by n ‘*’s if its odd or n ‘#’s if even, where n is the no.
Answer:
string = input ("Enter a string: ") encrypted_string = '' for char in string: if char.lower() in 'aeiou': encrypted_string += '@' elif char.isalpha(): if char.isupper(): encrypted_string += char. lower() else: encrypted_string += char. upper() elif char.isdigit(): if int(char) % 2 == 0: # Check if the digit is even encrypted_string += '#' * int(char) else: encrypted_string += '*' * int(char) else: encrypted_string += char print("Encrypted string:", encrypted_ string)
Question 34.
i) What could be the possible range of output for a and b: [5]
import random import math a= random.random()*6 b= math.ceil(random.random()*6 + 20)
ii) Write a program to print the following pattern for n rows, where n is user-input:
For n=5:
* * * * * *
* * * *
* * *
* *
*
OR
(i) Predict the output:
j=12 c=9 while(j): if (j>5) : c=c+j-2 j=j-1 else break print(j, c) print(c)
(ii) What will be the output produced by following code fragments?
x = “hello world”
(a) print (x[:2], x[:-2], x[-2:])
(b) print (x[6], x[2:4])
(c) print (x [2 : -3], x [ —4 :-2 ])
Answer:
i) The possible range of output for a is [0,6).
The possible range of output for b is [20, 26].
Explanation:
a = random.random() generates a random floating-point number between 0 and 1 (incl. 0 and excl. 1). Multiplying the random number by 6 scales it to the range between 0 and 6 (incl. 0 & excl. 6).
In case of b, adding 20 to the scaled random number gives a range of [20, 26]. The math.ceil() function rounds up the result to the nearest integer greater than or equal to the given value. So 26 is also inclusive now.
ii)
rows = int (input ("Enter the number of rows: ")) for i in range(rows + 1, 0, -1): # nested reverse loop for in range (0, i - 1): print ("*", end=' ') print(" ")
OR
(i) 5 58
58
(ii)
a)
hello world Explanation x[:2] ⇒ he x[:-2] ⇒ hello wor x[-2:] ⇒ Id
b) w ll
Explanation
x[6] ⇒ w x[2:4] ⇒ 11
c) llo wo or
Explanation
x[2:-3] ⇒ llo wo x[-4:-2] ⇒ or
Question 35.
Write a program to print the following pattern: [3]
@ * *
# @ *
# # @
OR
# # # # #
# * * * #
# * @ * #
# * * * #
# # # # #
Answer:
n = 3 for i in range(n): for j in range(n): if i == j: print("@ ", end="") elif i >= j: print("# ", end="") else: print ("* ", end="") print( )
OR
for i in range(5): # Iterate over the rows for j in range(5): # Iterate over the columns if i == 2 and j == 2: # If it's the center position print ("@", end=" ") # Print "@" elif i == 0 or i == 4 or j == 0 or j == 4: # If it's the border position print ("#", end=" ") # Print "#" else: # For all other positions print("*",' end=" ") # Print "*" print () # Move to the next line after printing each row