XI (CS) Question Bank
XI (CS) Question Bank
10 Which operator checks whether two variables refer to the same object?
a.== b. in c. is d. =
a. 0 1 2 b. 1 2 3 c. 0 1 2 3 d. Error
47 How would you create a loop to iterate over the contents of the list given as?
monthDays = [31,28,31,30,31,30,31,31,30,31,30,31]
and print out each element?
a. for days in range(monthDays):
print(days)
b. for days in monthDays:
print(days)
c. for days in range(len(monthDays)):
print(days)
d. for days in monthDays[0]:
print(days)
48 How many times will the loop in the given code will execute ?
MSD/2024-25/XI/Computer Science/ Question Bank/PG- 7 OF 36
x = "abcdef"
i = "a"
while i in x:
print(i, end = " ")
a. 0 times b. 1 time c. 6 times d. infinite times
51 Which of the following call to range() in Python will not yield anything?
a. range(-5, -1) b. range(-1, -5, -1) c. range(-5) d. All of the above
79 Consider the following case and write the code for the same
Given a string. Cut it into two "equal" parts (If the length of the string is odd, place the center character
in the first string, so that the first string contains one more character than the second). Now print a
MSD/2024-25/XI/Computer Science/ Question Bank/PG- 10 OF 36
new string on a single row with the first and second halves interchanged (second half first and the first
half second)
s = input()
______________________ //Fill in the statement
a. print(s[(len(s) + 1) // 2:] + s[:(len(s) + 1) // 2
b. print(s[(len(s) + 1) // 2:]
c. s[:(len(s) + 1) // 2
d. None of the above
80 What is the output of the following code?
example="helloworld"
example[::-1].startswith("d")
a. True b. dlrowolleh c. -1 d. None
84 (A) Assertion : You will get an error if you use double quotes inside a string that is surrounded by
double quotes: txt = "We are the so-called "Vikings" from the north."
(R) Reason : To fix this problem, use the escape character \":
(a) A is true but R is false
(b) A is true but R is not correct explanation of A
(c) A and B both are false
(d) A is True and R is correct explanation of A
85 (A) Assertion str1=”Hello” and str1=”World” then print(str1*3) will give error
(R) Reason : * replicates the string hence correct output will be HelloHelloHello
(a) A is true but R is false
(b) A is true but R is not correct explanation of A
(c) A and B both are false
(d) A is false and R is correct
86 (A) Assertion str1=”Hello” and str1=”World” then print(‘wo’ not in str) will print false
(R) Reason: not in returns true if a particular substring is not present in the specified string.
(a) A is true but R is false
(b) A is true and R is correct explanation of A
(c) A and B both are false
(d) A is true but R is not correct explanation of A
a. [10, 20, 30, 40, 50] b. [10, 20, 30, 50] c. [10, 20, 30, 40] d. [10, 30, 40, 50]
102 del statement can delete the following from the List?
a.Single Element b.Multiple Elements c.All elements along with List object d.All of the above
117 What will max(d) return for d = {'x': 5, 'y': 3, 'z': 9}?
a. 9 b. z c. 5 d. Error
a. -4 b. -5 c. 4 d. 5
127 What is the correct way to import only the sqrt() function from the math module?
a. import math.sqrt b. import math sqrt c. from math import sqrt d. math import sqrt
a. 2 b. -2 c. None d. ValueError
139 Which function generates a random EVEN number between 10 and 20?
a. random.randint(10, 20, 2)
b. random.randrange(10, 21, 2)
c. random.random(10, 20)
d. random.randint(10, 20)
Assertion-Reasoning Questions
a. Both A and R are true, and R correctly explains A.
b. Both A and R are true, but R does not explain A.
c. A is true, but R is false.
d. A is false, but R is true
1 (A): 5 / 2 results in 2.5 in Python 3.
(R): Python 3 uses true division (/), which always returns a float.
2 (A): 5 // 2 results in 2.
(R): The // operator performs floor division, rounding towards zero.
6 (A): The else block in a loop executes when the loop terminates normally.
(R): If a break statement is encountered, the else block does not execute.
7 (A): "python".capitalize() returns "python".
(R): The capitalize() method converts only the first character to uppercase.
8 (A): " ".join(["Hello", "World"]) returns "Hello World".
(R): The join() method concatenates elements using the specified separator.
9 (A): The range(5, 1, -1) generates [5, 4, 3, 2].
(R): The range(start, stop, step) includes start but excludes stop.
10 (A): d = {"a": 1, "b": 2}; del d["b"]; print(d) outputs {'a': 1}.
(R): The del statement removes the specified key-value pair.
11 (A): math.floor(4.9) returns 5.
(R): The floor() function rounds a number up to the nearest integer.
12 (A): random.randint(5, 10) can return 10.
(R): The randint() function includes both bounds.
13 (A): The continue statement stops execution of the current loop iteration.
(R): The continue statement transfers control to the next iteration.
14 (A): s = "abc"; print(s.index('d')) raises an error.
(R): The index() method raises a IndexError if the substring is not found.
15 (A): min(["apple", "banana", "cherry"]) returns "apple".
(R): The min() function compares ASCII values of characters.
Theory Questions
1 What is the difference between / and // operators in Python?
2 Why does 5 == "5" return False in Python?
3 What is the difference between is and == in Python? Provide an example.
4 Explain the role of augmented assignment operators. Provide three examples.
5 What is the difference between explicit and implicit type conversion? Give an example of each
6 Explain the difference between syntax errors, logical errors, and runtime errors with examples.
7 What will happen if you try to divide by zero in Python? What type of error will it raise?
8 Explain why int("abc") raises an error but int("123") does not.
9 What is the difference between find() and index() methods for strings?
10 What is the difference between sort() and sorted() in Python? Provide an example.
11 Given L = [1, 2, 3], what will L.extend([4, 5]) and L.append([4, 5]) do? Explain the difference.
12 What is the key difference between lists and tuples in Python?
MSD/2024-25/XI/Computer Science/ Question Bank/PG- 20 OF 36
13 Explain the purpose of get() method in dictionaries. How is it different from direct key access
(dict[key])?
14 Explain why True + True returns 2 in Python.
15 What is the role of the jump statements in Python?
16 Explain the difference between pop() and remove() in lists.
17 Write the similarity and dissimilarity between split() and partition() methods of string.
18 Aarav wants to add "Blueberry" to his list of berries at the second position. He writes the following
code:
berries = ["Strawberry", "Raspberry", "Blackberry"]
berries.insert(2, ["Blueberry"])
print(berries)
Expected Output:
["Strawberry", "Blueberry", "Raspberry", "Blackberry"]
Actual Output:
["Strawberry", "Raspberry", ["Blueberry"], "Blackberry"]
i. Why did "Blueberry" appear as a nested list instead of a single element?
ii. What is the correct way to insert "Blueberry" at the second position?
20 Kabir has a list of exam scores and wants to remove the last score from the list. He writes:
scores = [85, 90, 78, 92]
removed_score = scores.pop(5)
print(scores)
However, he gets an IndexError.
i. Why does this happen?
ii. What is the correct way to remove the last score from the list?
21 Meera is sorting a list of numbers and writes the following code:
numbers = [4, 2, 9, 1]
MSD/2024-25/XI/Computer Science/ Question Bank/PG- 21 OF 36
sorted(numbers)
print(numbers)
She expects the list to be printed in sorted order, but the original order remains unchanged.
i. Why does print(numbers) still show [4, 2, 9, 1]?
ii. How can Meera modify the code to update the list in sorted order?
23 Arjun is working with a dictionary that stores the price of various fruits:
prices = {"apple": 100, "banana": 40, "cherry": 150}
print(prices["grapes"])
He gets a KeyError.
i. Why does this error occur?
ii. How can Arjun avoid this error while checking for unavailable keys?
24 Sara creates a tuple of favorite colors:
colors = ("red", "blue", "green")
colors[1] = "yellow"
print(colors)
She expects the output to be ("red", "yellow", "green"), but instead, she gets an error.
i. Why does this error occur?
ii. How can Sara modify a tuple if she really wants to change its values?
25 Siddharth has a sentence and wants to split it at the first occurrence of a hyphen:
text = "high-speed-train"
print(text.partition("-"))
Output: ('high', '-', 'speed-train')
i. What does the partition() method do?
ii. How is partition("-") different from split("-")?
c) text = "abcdabcdabcd"
result = text[2:8:2].replace("c", "x") + text[::-3]
print(result)
h) word = "Python"
result = word[2] * 3 + word[3:].upper()
print(result)
i) str1 = "abcdefg"
result = str1[-6:-2:2] + str1[::3]
print(result)
k) word = "abc"
result = (word * 2).replace("c", "x")[2:]
print(result)
m) text = "abcdef"
result = text.startswith("abc") and text[3:].index("e") or -1
print(result)
n) text = "Python3.9"
result = text[:6].isalnum() and text[-3:].replace(".",
"").isdigit()
MSD/2024-25/XI/Computer Science/ Question Bank/PG- 24 OF 36
print(result)
o) text = "Hello123World"
result = text[-5:].isalpha() and text[:5].isalpha()
print(result)
p) string = "Hello123World"
processed_string = ""
for char in string:
if char.isupper():
processed_string += char.lower()
elifchar.islower():
processed_string += char.upper()
elifchar.isdigit():
if int(char) % 3 == 0:
processed_string += "#"
else:
processed_string += char
print(processed_string)
q) string = "Hello123World"
result = ""
for char in string:
if char.isupper():
result += char.lower()
elifchar.islower():
result += char.upper()
elifchar.isdigit():
if int(char) % 3 == 0:
result += "#"
else:
result += char
print(result)
print(" ".join(processed_words))
s) Name="PythoN3.1"
R=""
for x in range(len(Name)):
if Name[x].isupper():
R=R+Name[x].lower()
elif Name[x].islower():
R=R+Name[x].upper()
elif Name[x].isdigit():
R=R+Name[x-1]
else:
R=R+"#"
print(R)
t) text = 'ABCD'
number = '1357'
i = 0
s =''
while i<len(text):
s = s + text[i] + number[len(number)-i-1]
i = i + 1
print(s)
Programming Questions
Write a Python program that prompts the user to enter a number and then displays whether the number
is positive, negative, or zero.
1
Write a Python program that prompts the user to enter a number and then displays its multiplication
table up to 10.
2
Create a program that asks the user to input a year and determines whether it is a leap year. A year is a
leap year if it is divisible by 4 but not by 100, except if it is also divisible by 400.
3
4 Write a Python program that takes three numbers as input from the user and prints the largest of the
three.
5 Write a Python program that takes a non-negative integer from the user and calculates its factorial using
a loop.
6 Write a program to display the Fibonacci series upto n numbers.
7 Write a program to input a number and check if it is a prime or composite
8 Write a program to input an integer number and check if it is a palindrome.
9 Write a Python program that takes a positive integer as input and calculates the sum of its digits.
10 Develop a program that prompts the user to enter a string and then prints the string in reverse order.
MSD/2024-25/XI/Computer Science/ Question Bank/PG- 27 OF 36
12 Write a program to check whether a given number is an Armstrong number. An Armstrong number is
an n-digit number that is equal to the sum of its digits raised to the power of n.
13 Create a program that calculates the sum of the following series up to n terms: 1 + 1/2 + 1/3 + 1/4 + ...
+ 1/n.
14 Write a program to input the value of x and n and print the sum of the following series:
1 − 𝑥 + 𝑥2 − 𝑥3 + 𝑥4 … … 𝑥𝑛
1 + 𝑥 + 𝑥2 + 𝑥3 + 𝑥4 … … 𝑥𝑛
𝑥2 𝑥3 𝑥4 𝑥𝑛
𝑥− 2
+ 3
− 4
…. 𝑛
String
1 Take a string as input and print its length.
2 Print ASCII Value of a character
3 Input a string and display the number of words.
4 Input a string and display the number of characters, digits, spaces and special characters.
5 Input a string display the words starting with a vowel.
6 Input a string and display and display the words which starts with a vowel and ends with a consonant.
7 Merge two strings and remove duplicates.
8 Count the occurrences of 'a' in a given string.
MSD/2024-25/XI/Computer Science/ Question Bank/PG- 28 OF 36
17 Write a program that takes an email address and returns its domain.
18 Write a program to accept a string and print the largest word from the string.
19 Write a Python program that prompts the user to enter a password and checks if it meets the following
criteria:
At least 8 characters long
Contains both uppercase and lowercase letters
Includes at least one numerical digit
Has at least one special character (e.g., !, @, #, $)
If the password meets all the criteria, print "Password is valid"; otherwise, specify which criteria are not
met.
20 Develop a program that evaluates the strength of a user's password based on the following criteria:
Length:
o Less than 6 characters: "Weak"
o 6 to 10 characters: "Moderate"
o More than 10 characters: "Strong"
Inclusion of uppercase and lowercase letters
Inclusion of numbers
Inclusion of special characters
Based on these factors, rate the password as "Weak", "Moderate", or "Strong".
List
1 Create a list of numbers from 1 to 10 and print it.
2 Remove the last element from a list and print it
3 Reverse the order of elements in a list without using reverse().
4 Merge two lists and remove duplicates.
5 Count the occurrences of a specific element in a list.
6 Print the common elements between two lists.
MSD/2024-25/XI/Computer Science/ Question Bank/PG- 29 OF 36
8 Write a Python program that iterates through a list of integers and separates them into two new lists:
one containing all the even numbers and the other containing all the odd numbers.
9 Develop a program that removes elements from a list that are located at odd indices, resulting in a list
containing only elements from even indices.
10 Write a Python program that takes a list of numbers and returns a new list where each element is the
cumulative sum of the elements up to that point. For example, given [1, 2, 3, 4], the output should be
[1, 3, 6, 10].
Dictionary + Tuples
10 Consider a dictionary where keys are the names of students, and the values are lists of their grades in
three subjects.
Write a program to calculate the average grade for each student and print the results.
students = {
"Alice": [85, 90, 78],
"Bob": [92, 88, 79],
"Charlie": [70, 85, 89]
}
MSD/2024-25/XI/Computer Science/ Question Bank/PG- 30 OF 36
2 A football team tracks player stats as tuples with player name, position, and goals scored. Write a
function top_scorer(players) that finds the player with the highest goals scored.
Example Players:
[("Alice", "Forward", 10), ("Bob", "Midfielder", 8), ("Charlie", "Forward", 12)]
Write the Python code to perform the following tasks.
1. Display all Players and their winnings.
2. Display the players with the highest winnings.
3. Display the players with winnings greater than 10.
3 A text-processing tool needs to analyze a sentence stored as a list of words. The tool should:
Convert all words to lowercase.
Remove a specific word if it exists.
Reverse the order of words.
sentence = ["Hello", "World", "This", "is", "Python", "Programming"]
Details to Store:
Book ID: Unique identifier for each book
Title: Name of the book
Author: Author of the book
Publication Year: Year the book was published
11 How can one protect their online identity and maintain confidentiality of personal information?
12 Explain the importance of using strong, unique passwords and enabling two-factor authentication.
13 Define malware and describe the differences between viruses, trojans, and adware.
14 What are the common signs that a system might be infected with malware?
15 Outline the steps to prevent and remove malware from a computer system.
16 What is e-waste, and why is its proper disposal important for environmental sustainability?
17 Discuss the methods and best practices for the disposal and recycling of used electronic gadgets.
18 Analyze the impact of technology on gender and disability issues in the context of education and
computer usage.
19 What initiatives can be implemented to promote inclusivity and accessibility in technology for
individuals with disabilities?
20 A university student frequently shares personal updates, photos, and opinions on various social media
platforms without adjusting privacy settings.
Analyze the potential risks associated with this behavior concerning their digital footprint.
What steps can the student take to manage and protect their digital footprint effectively?
21 A software developer uses code snippets from open-source projects in a proprietary application without
adhering to the original licensing terms.
Identify the intellectual property issues involved in this scenario.
What actions should the developer take to rectify the situation and comply with open-source
licenses?
22 A high school student becomes a victim of cyberbullying through anonymous messages and
defamatory posts on social media.
Evaluate the psychological and social impacts of cyberbullying on the victim.
What measures can schools and parents implement to prevent and address cyberbullying
incidents?
23 An employee downloads a seemingly legitimate software application from the internet, which turns out
to be malware that compromises the company's data.
Assess the potential consequences of this malware infection for the organization.
What protocols should the company establish to prevent future malware infections?
25 A school plans to integrate new educational software but discovers it is not accessible to students with
visual impairments.
Analyze the challenges faced by students with disabilities concerning inaccessible technology.
Recommend strategies to ensure that educational technologies are inclusive and accessible to all
students.
9 Draw the block diagram of a computer system. Briefly write about the functionality of each component.
10 What is the primary role of system bus? Why is data bus is bidirectional while address bus is
unidirectional?
Number System
1 Do the following conversions.
(i) (514)8 = (?)10 (iv) (4D9)16 = (?)10
(ii) (220)8 = (?)2 (v) (11001010)2 = (?)10
(iii) (76F)16 = (?)10 (vi) (1010111)2 = (?)10
2 Do the following conversions from decimal numberto other number systems.
(i) (54)10 = (?)2 (iv) (889)10 = (?)8
(ii) (120)10 = (?)2 (v) (789)10 = (?)16
(iii) (76)10 = (?)8 (vi) (108)10 = (?)16
3 Express the following hexadecimal numbers intoequivalent decimal numbers.
(i) 4A2 (ii) 9E1A (iii) 6BD (iv) 6C.34
4 Convert the following binary numbers into octaland hexadecimal numbers.
(i) 1110001000 (ii) 110110101 (iii) 1010100(iv) 1010.1001
5 Write binary equivalent of the following octalnumbers.
(i) 2306 (ii) 5610 (iii) 742 (iv) 65.203
6 Write binary representation of the followinghexadecimal numbers.
(i) 4026 (ii) BCA1 (iii) 98E (iv) 132.45
7 Express the following decimal numbers intohexadecimal numbers.
(i) 548 (ii) 4052 (iii) 58 (iv) 100.25
8 Express the following octal numbers into theirequivalent decimal numbers.
(i) 145 (ii) 6760 (iii) 455 (iv) 10.75
9
10 Identify the postulate names from the given Boolean expressions.
(i) A+ A’=1
(ii) A⋅1=A
(iii)A⋅(B+C)=(A⋅B)+(A⋅C)
(iv) A+A=A
(v) A+B = B+A
11 Draw the truth table and circuit diagram of the NAND and XOR gate.
12 Verify the following using truth tables.
i. X+Y+Z = (X+Y).(X+Z)
ii. (A+B)⋅(A+ B’)=A+(B⋅ B’)
MSD/2024-25/XI/Computer Science/ Question Bank/PG- 35 OF 36
(i) Write the names of all the gates used in this circuit
(ii) Identify the value of F
(iii)Find the complement of the expression
(iv) Find the duality of the expression
(i) Write the names of all the gates used in this circuit
(ii) Identify the value of F
(iii)Find the complement of the expression
(iv) Find the duality of the expression
16 Draw the circuit diagram for the above given Boolean expressions. Also find complement and duality.
(i) (A’B’+C+B’A)’
(ii) A’⋅(B+C) + A⋅(B’⋅ C’)
(iii) A⊕B⊕C
(iv) (A+B)’ ⋅(C+D’)+A⋅C
(v) (A⊕B)⋅(C’+D)