Students must start practicing the questions from CBSE Sample Papers for Class 11 Computer Science with Solutions Set 4 are designed as per the revised syllabus.
CBSE Sample Papers for Class 11 Computer Science Set 4 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.
State TRUE or FALSE [1]
DOS is a graphical user interface operating system.
Answer:
False
Question 2.
The simplified form of X.(X+Y): [1]
(A) X+Y
(B) Y
(C) X
(D) X.Y
Answer:
(C) X
Explanation:
L.H.S. X. (X+Y) = X.X + X.Y
= X+X.Y since X.X = X
= X.(1+Y)
= X (R.H.S.) since 1+Y = 1
Question 3.
Identify the invalid symbol used in hexadecimal number system. [1]
(A) F
(B) G
(C) A
(D) D
Answer:
(B) G
Explanation:
A Hexadecimal number system has sixteen (16) alphanumeric values from 0 to 9 and A to F. Here A is 10, B is 11, C is 12, D is 13, E is 14 and F is 15.
Question 4.
The smallest individual unit in a program is called [1]
(A) Identifier
(B) Keyword
(C) Token
(D) None of these
Answer:
(C) Token
Explanation:
The smallest individual unit in a program is known as a tokens or a lexical unit. There are different types of token in Python such as identifiers, reserved words, literals, operators and punctuators.
Question 5.
Which one of the following is the correct way of declaring and initialising a variable ‘x’ with value 5, in Python?
(A) intx x=5
(B) int x=5
(C) x=5
(D) declare x=5
Answer:
(C) x=5
Explanation:
Python doesn’t require explicit type declarations, so you can directly assign a value to a variable using the equal sign (=) operator.
Question 6.
____ is all about the responsible and safe use of Internet.
(A) Cyber Safety
(B) Safety
(C) Guidelines
(D) Protocol
Answer:
(A) Cyber Safety
Explanation:
Cyber safety refers to the safe and responsible use of information and communication technology.
Question 7.
Which exception is raised when a calculation exceeds maximum limit for a numeric type?
(A) StandardError
(B) ArithmeticError
(C) OverflowError
(D) FloatingPointError
Answer:
(C) OverflowError
Explanation:
OverflowError: Raised when a calculation exceeds the maximum limit for a numeric type.
Question 8.
____ is the container for non-sequential data.
(A) List
(B) String
(C) Tuple
(D) Dictionary
Answer:
(D) Dictionary
Explanation:
Dictionaries and sets are containers for non-sequential data.
Question 9.
Predict the output.
if 'a' =' a' : print("Hello") else: print("Bye")
(A) Hello
(B) Bye
(C) True
(D) Error
Answer:
(A) Hello
Explanation:
Condition of if statement will be True, hence the statement inside of if statement will be executed.
Question 10.
What will be the output of the following code if the value of i is 5.
while(i<10): i+=3 print(i)
(A) 5
8
(B)
5
6
7
8
9
10
(C)
8
11
(D) Error
Answer:
(C)
8
11
Explanation:
When i=5
while(5<10) ⇒ True
⇒ i=5+3 = 8
while(8<10) ⇒ True
⇒ i=8+3 = 11
while(11<10) ⇒ False
Question 11.
What arithmetic operators cannot be used with strings?
(A) –
(B) *
(C) +
(D) All of these
Answer:
(A) –
Explanation:
+ is used to concatenate and * is used to multiply strings.
Question 12.
Predict the output
ls= [ 'a', 'b', 'c', 'd', 'e', 'f'] print(1s[-1:-5:-2])
(A) [‘f’, ‘d’, ‘b’]
(B) [‘f’/d’]
(C) [‘f’, ‘e’, ‘d’, ‘c’, ‘b’]
(D) [‘e’, ‘c’]
Answer:
(B) [‘f’/d’]
Explanation:
List starts printing from the last index till index -4 with the decrement of 2.
Question 13.
What will be the output of the following code?
a= (1, 3, 2, 4, -2, -1) print(a[a[1]] + a[a[4]])
(A) 1
(B) 2
(C) 3
(D) 4
Answer:
(B) 2
Explanation:
a[a[1]] = a[3] = 4
a[a[4]] =a[-2] = -2
a[a[1]] +a[a[4]] = 4 + (-2) = 2
Question 14.
What will be the output of the following code?
a={1:"One",2:"Two",3:"Three"} print(a.get (5,4)) print(a.get(1,4)) print(a.get (5,2))
(A) 4
4
Two
(B) 4
One
2
(C)
5
1
4
(D) Error
Answer:
(B) 4
One
2
Explanation:
get( ) – Returns the value of a given key in the dictionary.
Syntax:
dictionary_name.get(key, default _ val)
If the key isn’t present in the dictionary it returns the default value(second parameter).
If the two parameters are passed in the method, it considers the first parameter only for checking the key availability.
Question 15.
Suhana, who was sick with a fever, decided to skip school and requested her classmate Shaurya to explain the concept of tuples in Python. Shaurya downloaded a video clip from the Internet, added his own text to it, and emailed the modified video to Suhana without giving credits to original creator. [1]
(A) Fair use
(B) Hacking
(C) Copyright infringement
(D) Trademark Infringement
Answer:
(C) Copyright infringement
Question 16.
A ______ is a virus that is often disguised as a useful computer program.
(A) trojan horse
(B) backer
(C) worm
(D) spam
Answer:
(A) trojan horse
Explanation:
A Trojan Horse Virus is a type of malware that downloads onto a computer disguised as a legitimate program. The delivery method typically sees an attacker use social engineering to hide malicious code within legitimate software to try and gain users’ system access with their software.
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 for A
(B) Both A and R are true and R is not the correct explanation for A
(C) A is True but R is False
(D) A is false but R is True
Question 17.
Assertion (A): Scientific disposal of e-waste is very important to protect human and environmental health.
Reason (R): e-waste contains toxic pollutants like mercury, lead, cadmium, chromium and plastics.
Answer:
(A) Both A and R are true and R is the correct explanation for A
Explanation:
Scientific disposal of e-waste is important to protect human and environmental health because e-waste contains toxic pollutants like mercury, lead, cadmium, chromium, and plastics. Proper disposal methods are necessary to prevent these pollutants from harming people and the environment.
Question 18.
Assertion (A): A bug is an error in the code. [1]
Reason (R): Debugging is the process of finding errors in a program. [1]
Answer:
(C) A is True but R is False
Explanation:
A bug is indeed an error in the code, but debugging is not solely limited to finding errors. It also involves the process of identifying, understanding, and fixing errors or bugs in a program.
Section B
[Each question carries 2 marks]
Question 19.
Draw the given logic circuit: XY’ + X’Y
OR
(i) Name the law shown below & verify it using a truth table.
X + X’ .Y = X + Y.
(ii) Write the equivalent Boolean Expression for the following Logic Circuit:
Answer:
(i) This law is referred to as third distributive law.
X | Y | X’ | X+X’.Y | X+Y |
0 | 0 | 1 | 0 | 0 |
0 | 1 | 1 | 1 | 1 |
1 | 0 | 0 | 1 | 1 |
1 | 1 | 0 | 1 | 1 |
(ii) Y = P’.Q+(Q+R’)
Question 20.
Convert following binary numbers to decimal: [1]
(a) 1010
(b) 1101101010
OR
What is the use of encoding schemes?
Answer:
(a) 10102 = 1 × 23 + 0 × 22 + 1 × 21 + 0 × 20 = 8 + 2 = 1010
(b) 11011010102 = 1 × 29 + 1 × 28 + 0 × 27 + 1 × 26 + 1 × 25 + 9 × 24 + 1 × 23 + 0 × 22 + 1 × 21 + 0 × 20
= 512 + 256 + 0 + 64 + 32 + 0 + 8 + 0 + 2 + 0
= 87410
OR
Encoding schemes help Computers represent and recognize letters, numbers and symbols. It provides a predetermined set of codes for each recognized letter, number and symbol. Most popular encoding schemes are ASCI, Unicode, ISCII, etc.
Question 21.
Differentiate between runtime error and compile time error.
Answer:
Runtime Error | Compile Time error |
Occurs during program execution | Detected during the compilation phase |
Can lead to a program crashes, abnormal terminations, or incorrect results | Prevents the generation of executable code |
Question 22.
Consider the following string: my_string = “Hello! How are you doing?”
Answer the following questions based on this string:
(i) print (my_string. upper () )
(ii) print (string. split (“!”) )
(iii) print(my_string.replace(“how”, “what”))
(iv) print(my_string.count(“o”))
OR
Write the statement to find the maximum and minimum element in the list [4, 12, 43.3, 19, 100].
Answer:
(i) “HELLO ! HOW ARE YOU DOING?”
(ii) [‘Hello’, ‘ How are you doing?’]
(iii) “Hello! What are you doing?”
(iv) 4
OR
print (max( 4, 12, 43.3, 19, 100 ) )
print (min( 4, 12, 43.3, 19, 100 ) )
Question 23.
Consider the following dictionary state Capital
stateCapital = {“AndhraPradesh”:”Hyderabad”, “Bihar”: “Patna”, “Maharashtra”:”Mumbai”, “Rajashthan”:”Jaipur”}
(i) print (len (stateCapital) )
(ii) print (“Maharashtra” in stateCapital.items)
(iii) print (stateCapital.get (“Assam”))
(iv) del stateCapital[“AndhraPradesh”] print (stateCapital)
OR
When would you prefer tuples over lists?
Answer:
(i) 4 : len ( ) function return the length or number of key-value pairs of the dictionary passed as the argument.
(ii) True: ‘in’ is a membership operator which returns True if a key is present in the dictionary.
(iii) None: get( ) function returns ‘None’ if the key is not present in the dictonary.
(iv) del stateCapital [‘Andra pradesh’] will delete the key-value pair of AndhraPradesh’ key.
OR
Tuples are preferred over lists in the following cases:
- When we want to ensure that data is not changed accidentally. Tuples being immutable do not allow any changes in its data.
- When we want faster access to data that will not change as tuples are faster than lists.
- When we want to use the data as a key in a dictionary. Tuples can be used as keys in a dictionary, but lists cannot.
- When we want to use the data as an element of a set. Tuples can be used as elements of a set, but lists cannot.
Question 24.
Explain the different types of Software License.
Answer:
Types of Software License:
- Proprietary license is a license where the copyright stays with the owner /producer and the user is granted the right to use the software.
- GNU General Public License (GPL) which are agreements under which open source is usually licensed.
- End User License Agreement (EULA) indicates the terms under which the end user may use the software.
- Creative Commons (CC) license is a public copyright license that enables the free distribution of a copyrighted work.
Question 25.
What are super cookies? Where do super cookies store data ?
Answer:
Super cookies are persistent cookies that remain even after being deleted.
Super cookies store data in Flash cookies, Silverlight storage, browsing history and HTML5 Local storage.
Section C
[Each question carries 3 marks]
Question 26.
Explain language translator? Differentiate between compiler and interpreter. [3]
Answer:
A language translator is one kind of system software that translates high-level language code to low-level, machine-understandable language.
Compiler | Interpreter |
Compiler translates the entire source code before execution. | Interpreter Translates and executes the code line by line or statement by statement |
Generates an independent executable file | Does not generate a separate executable file |
Question 27.
Explain numeric data types in python with example. [3]
Answer:
There are three distinct numeric types – integers, floating-point numbers, and complex numbers. Additionally, Booleans are a sub-type of integers.
Integer: In the Integer Data Types data is in Integer format like the below example.
e.g: X = 5
Float: In the Float Data Types data is in Integer but in Decimal format like the below example.
e. g: x = 20.5
Complex: In the Complex Data Types data is in Integer consists of two values, the first one is the real part of the complex number, and the second one is the imaginary part of the complex format like below example.
e.g: x = (3 + 7j)
Question 28.
Rewrite the following code in python after removing all syntax error(s). Underline each correction done in the
code. [3]
STR="Happy Python Programming" for i in range[0, 8]: print STR(i) print i+STR
OR
Write a program in Python to filter odd and even number from a list,
Given list is [2, 23, 24, 51, 46, 67]
Answer:
STR="Happy Python Programming" for i in range(0,24): print(STR[i]) print(i, STR)
OR
num=[ ] a=int(input("Enter the number of elements of the list")) for i in range (a): num.append(int(input("enter list element"))) even = [] odd = [] for i in range(len(num)): if num[i] % 2 == 0: even.append(num[i]) else: odd.append(num[i]) print("Even elements are",even) print("Odd elements are",odd)
Question 29.
(i) Define the following functions in reference to Tuple in python. [2 + 1 = 3]
a) len ()
b) count ()
(ii) Write the output of the following:
for i in tuple ("Python") : print (i + i)
Answer:
(i)
a) len( ) – this function returns the number of elements of a tuple.
Syntax:
len(tuple_name)
b) count( ) – this function returns the number of times the given element appears in the tuple.
Syntax:
tuple_name.count(element)
(ii) PP
yy
tt
hh
oo
nn
Question 30.
Himanshi uses technical devices like computer, mobile, etc. Study the following cases and answer the questions
given below. [3]
(i) Once she got the message in Whatsapp that CBSE is announcing the new syllabus of class XI tomorrow at 2:00 pm. Immediately she forwarded the message to her few friends. But actually there is no such announcement on CBSE’s official web-site. She is violating:
(A) net etiquettes
(B) Communication etiquettes
(C) copyright
(D) None of the above
Answer:
(B) Communication etiquette
Explanation:
Communication etiquette refers to the rules or etiquette followed while sending emails, chatting, sending SMS, calling, posting on forums and social media.
(ii) She is surfing various web-sites. She is un-intentionally leaving:
(A) Active digital footprint
(B) Passive digital footprint
(C) There is no chance of any digital footprint
(D) None of the above
Answer:
(B) Passive digital footprint
Explanation:
When the personal data of the user is collected without letting them know or without their permission is known as passive digital footprint.
(iii) She is frequently getting abusive messages from an unknown person on her social-media posts. The unknown person can be called as:
(A) Cyber bully
(B) Internet troll
(C) Hacker
(D) Cracker
Answer:
(B) Internet troll
Explanation:
Internet trolls are people who intentionally disrupt harmony on online platforms.
Section D
[Each question carries 4 marks]
Question 31.
Consider the following program: [4]
a = int(input("Enter a value: ")) while a != 0: count = count + 1 a = int(input("Enter a value: ")) print("You entered", count, "values.") and gives an error in line: 'count=count+1'
What change should be made to this program so that it will run correctly ? Write the modification that is needed into the program above, crossing out any code that should be removed and clearly indicating where any new code should be inserted.
Also write, what the program intends to do.
Answer:
The line count = count + 1 is incrementing the value of variable count by 1 but the variable count has not been initialized before this statement. This causes an error when trying to execute the program. The corrected program is below:
count = 0 a = int(input("Enter a value: ")) while a != 0: count = count + 1 a = int(input("Enter a value: ")) print("You entered", count, "values.")
The program is supposed to count the number of values entered by the user until the user enters 0 and then display the count (not including the 0).
Question 32.
E-waste is electronic products that are unwanted, not working, and nearing or at the end of their “useful life.”
Computers, televisions, VCRs, stereos, copiers, and fax machines are everyday electronic products. [4]
The ongoing challenge of how best to dispose of used and unwanted electronics isn’t a new one and dates back at least to the 1970s. But a lot has changed since then, particularly the number of electronics being discarded today. E-waste recycles in India is predominantly an informal sector activity.
There are thousands of poor households surviving by scavenging materials from waste dumps. The common recycling practices for middle-class urban households, particularly for waste paper, plastic, clothing, or metal, is to sell out to small-scale, informal sector buyers often known as ‘kabadiwalas/ and they further sort and sell these as an input material to artisanal or industrial processors.
(i) E-waste is becoming one of the fastest growing environmental hazards in the world today. The ____ has issued
a formal set of guidelines for proper handling and disposal of e-waste.
(A) Central Pollution Control Board (CPCB)
(B) Department of Information Technology (DIT)
(C) Electrical and Electronic Equipment (WEEE)
(D) Information Communication Technology (ICT)
Answer:
(A) Central Pollution Control Board (CPCB)
Explanation:
The CPCB has issued a formal set of guidelines for proper handling and disposal of e-waste to address the growing environmental hazards associated with electronic waste.
(ii) Following are the impacts of e-waste on the environment. Choose the odd one out.
(A) Soil Pollution
(B) Water Pollution
(C) Air Pollution
(D) Sound Pollution
Answer:
(D) Sound Pollution
Explanation:
Sound pollution cannot be an impact of e-waste on the environment.
(iii) Feasible method(s) to manage e-waste:
(A) Reduce
(B) Reuse
(C) Recycle
(D) All of the above
Answer:
(D) All of the above
Explanation:
Reduce, reuse and recycle all of these are the feasible methods to manage e-waste.
(iv) In India, E-Waste management assumes greater significance because
(A) Generation of own e-waste
(B) Dumping of e-waste from developed countries
(C) Lack of awareness
(D) All of these
Answer:
(D) All of these
Explanation:
E-Waste management assumes greater significance in India due to multiple factors. These include the generation of its own e-waste from various electronic devices, the dumping of e-waste from developed countries, and the lack of awareness regarding proper e-waste handling and disposal. All these factors contribute to the need for effective e-waste management in India.
Section E
[Each question carries 5 marks]
Question 33.
(i) Write an algorithm to accept a number from a user and print the sum of squares of all the numbers from 1 till that number. [2+2+1=5]
(ii) Study the given algorithm to accept only positive integers upto 100, and answer the questions Algorithm
INPUT Number IF (0<= Number) AND(Number <= 100) ACCEPT Else REJECT
(a) On what values will this algorithm fail ?
(b) Can you correct the algorithm ?
(iii) What is dry run?
OR
(i) Write a program to print the following pattern m
5 5 5 5 5
4 4 4 4
3 3 3
2 2
1
(ii) Find errors in the following code and correct them. Also underline the corrections:
a= int("Enter any number") for i in Range [2,6] if a=i print ("A") else print("B")
(iii) Convert the following loop into for loop:
x = 4 while(x <= 8); print(x*10) x+=2
Answer:
(i)
Step 1: START Step 2: Initialize sum=0 Step 3: READ number as num Step 4: Initialize i = 1 Step 5: IF i>num, JUMP to STEP 9 Step 6: Add square of i to sum Step 7: Increment i by 1 Step 8: REPEAT STEP 5,6,7 UNTIL condition becomes TRUE Step 9: PRINT sum Step 10: STOP
(ii) (a) This algorithm fails at value 0. Because in condition we specify “greater than equal to operator”. So it will accept zero also.
(b) INPUT Number
IF (0< Number) AND (Number <= 100)
ACCEPT
Else
REJECT
(iii) When pseudocode is tested on papers by taking some sample inputs to check if the required output is obtained it is called a dry run.
OR
(i)
for i in range (5, 0, -1): for j in range(1, i+1): print(i, end= "") print()
(ii)
int(input("Enter any number")) for i in range(2, 6): if a==i: print("A") else: print("B")
(iii)
for x in range(4, 9, 2): print(x*10)
Question 34.
A list named Divisibility contains the following elements:
9, 35, 4, 19, 55, 12, 55, 36
Write a program to swap the elements that are divisibly by 5, with their right neighbor, so that resultant list looks like:
9, 4, 35, 19, 12, 55, 36, 55
Answer:
Divisibility = [9, 35, 4, 19, 55, 12, 55, 36] n = len(Divisibility) i = 0 while i<n: if Divisibility[i]%5 == 0: temp=Divisibility[i] Divisibility[i]=Divisibility[i+1] Divisibility[i+1]=temp i = i + 2 else: i = i + 1 print(Divisibility)
Question 35.
(i) What would be the possible outputs produced by the following code? Explain. [5]
import math import random print(math.ceil(random.random()))
(ii) What are the possible outcome(s) executed from the following code? Also specify the maximum and minimum values that can be assigned to variable NUM.
import random NAV = ["LEFT","FRONT","RIGHT","BACK"] NUM = random.randint(1, 3) NAVG = "" for C in range(NUM, 1, -1): NAVG = NAVG + NAV[C] print(NAVG)
OR
(i) Find the output generated by following code fragments and also justify your answer: (2)
t3 = (6, 7) t4 = t3 * 3 t5 = t3 * (3) print(t4) print(t5)
(ii) Write the program to print the following pattern: (3)
1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
1 2 3 4 5 4 3 2 1
Answer:
(i) The output would be either 0 or 1 :
random.random( ) would generate a number in the range [0.0, 1.0). Then math.ceil( ) will return ceiling number for this range, i.e., the nearest integer greater than the number.
So, when random.random() generates 0.0, math.ceil() will give 0 only, but any other number generated in the range (0,1) will be scaled up to 1.
(ii)
No Output #when NUM = 1 or RIGHT #when NUM=2 or BACK #when NUM=3 BACKRIGHT
NUM has Max value 3 and minimum value 1
OR
(i) Output
(6, 7, 6, 7, 6, 7)
(6, 7, 6, 7, 6, 7)
Explanation:
The repetition operator * replicates the tuple specified number of times. The statements t3 * 3 and t3 * (3) are equivalent as (3) is an integer not a tuple because of lack of comma inside parenthesis. Both the statements repeat t3 three times to form tuples t4 and t5.
(ii)
rows = 6 for i in range(1, rows + 1): for j in range(1, i - 1): Print(j, end=" ") for j in range(i - 1, 0, -1): print(j, end=" ") print()