0% found this document useful (0 votes)
94 views3 pages

KVBRP 12 CS Summer Holiday HW 2024-25

class 12 cs
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
94 views3 pages

KVBRP 12 CS Summer Holiday HW 2024-25

class 12 cs
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 3

PM SHRI K V BERHAMPORE

SUMMER HOLIDAY HW FOR XII CS 2024-25 (TopicRevision Tour of XI Python)

Q Questions
no.
1 Out of the following, find those identifiers, which cannot be used for naming Variables or functions in a Python
program:
#Tag, While, Class, Switch, 3rdRow, finally, Column 31, Total+ , Days * Rent, For, A_price,
Grand Total, do, 2Clients, Participant13, My_city
2 Which string method is used to implement the following:
i. To count the number of characters in the string.
ii. To change the first character of the string in capital letter.
iii. To check whether given character is letter or a number.
iv. To change lowercase to uppercase letter.
v. Change one character into another character.

3 Write a program to check whether a string is palindrome or not


4 WAP a program to reverse a number (without using slicing) and check whether it is a palindrome or not.
5 Rewrite the following for loop into while loop:
for a in range(90, 9, -9):
print a

6 Write a program to input any string and to find the number of words in the string and also print the 5th word.
7 How many times will Python execute the code inside the following while loop? You should answer the question
without using the interpreter! Justify your answers.
i=0
while i < 0 and i > 2 :
print “Hello ...”
i = i+1
8 What is the correct way to add an element to the end of a list in Python?
a. list.add(element) b. list.append(element) c. list.insert(element) d. list.extend(element)

9 What will be the output of print("Welcome To My Blog"[2:6] + "Welcome To My Blog"[5:9])


a. Lcomme b. lcomme T c. lcomme To d. lcomme

10 Which of the following statement(s) would give an error during the


execution of the following code?
R = {'pno':52,'pname':'Virat', 'expert':['Badminton','Tennis'] ,'score':(77,44)}
print(R) #Statement 1
R['expert'][0]='Cricket' #Statement 2
R['score'][0]=50 #Statement 3
R['pno']=50 #Statement 4

a. Statement 1 b. Statement 2 c. Statement 3 d. Statement 4


11 Given the following dictionaries
dict_student = {"rno" : "53", "name" : 'Rajveer Singh'}
dict_marks = {"Accts" : 87, "English" : 65}
Which statement will append the contents of dict_marks in dict_student?
a. dict_student + dict_marks b. dict_student.add(dict_marks)
c. dict_student.merge(dict_marks) d. dict_student.update(dict_marks)

12 Which of the following is not a component of the math module in Python?


a. ceil() b. mean() c. fabs() d. pi
13 What will be the output of the following code?
L=["One , Two", "Three", "Four"]
print(len(L)/2*len(L[0]))

a. 6.5 b. 13 c. 13.5 d. 6.0


14 Rewrite the following code in Python after removing all the syntax errors. Underline each correction done in the
code.
num1, num2 = 10, 45
While num1 % num2 == 0
num1+= 20
num2+= 30
Else:
print('hello')
15 Write a suitable Python statement for each of the following tasksusing built-in functions/methods only:
i To delete an element Mumbai:50 from Dictionary D.
ii To display words in a string S in the form of a list
16 Write a program to take a string and count how many words are starting from a vowel ‘aeiouAEIOU’
17 Write a Python Program to display alternate characters of a stringmy_str.
For example, if my_str = "Computer Science"
The output should be Cmue cec

18 WAP to count the number of digits in a string taken from the user
19 For example, Consider the following dictionary BOOKS
BOOKS = {1:"Python", 2:"Internet Fundamentals ", 3:"Networking ",4:"Oracle sets", 5:"Understanding HTML"}
WAP a program that takes the dictionary BOOKS and displays the names in uppercase of those books whose name
starts with a consonant.
20 What possible output(s) are expected to be displayed on screen at the time of execution of the program from the
following code?
import random
points=[20,40,10,30,15]
points=[30,50,20,40,45]
begin=random.randint(1,3)
last=random.randint(2,4)
for c in range(begin,last+1):
print(points[c],"#")
(a) 20#50#30# (b) 20#40#45 (c) 50#20#40# (d) both (b) and (c)
21 State True or False: “Tuple is datatype in Python which contain data in key-value pair.”
22 Select the correct output of the code:
s='mail2kv@kvsangathan.kvs.in'
s=s.split('kv')
op = s[0] + "@kv" + s[2]
print(op)

(A) mail2@kvsangathan (B) mail2@sangathan. (C) mail2@kvsangathan. (D) mail2kvsangathan.


23 (A) Given is a Python string declaration:
message='FirstPreBoardExam@2022-23'
Write the output of: print(message[ : : -3].upper())

(B) Write the output of the code given below:


d1={'rno':25, 'name':'dipanshu'}
d2={'name':'himanshu', 'age':30,'dept':'mechanical'}
d2.update(d1)
print(d2.keys())
24 Predict the output of the Python code given below:
data=["L",20,"M",40,"N",60]
times=0
alpha=""
add=0
for c in range(1,6,2):
times = times + c
alpha = alpha + data [c-1] + "@"
add = add + data[c]
print (times, add, alpha)
25 Predict the output of the Python code given below:
L=[1,2,3,4,5]
Lst=[]
for i in range(len(L)):
if i%2==1:
t=(L[i],L[i]**2)
Lst.append(t)
print(Lst)
26 Predict the output of the code given below:
s="C++VsPy"
m=""
for i in range(0, len(s)):
if (s[i] >= 'a' and s[i] <= 'm'):
m = m +s[i].upper()
elif (s[i] >= 'n' and s[i] <= 'z'):
m = m +s[i-1]
elif (s[i].isupper()):
m = m + s[i].lower()
else:
m = m +'&'
print(m)
27 What will be the output of the following python program?
str = ""
name = "9@Days"
for x in name:
if x in "aeiou":
str+=x.upper()
elif not x.isalnum():
str+="**"
elif x.isdigit():
pass
else:
str+=x.lower()
print(str)
28 State True or False
i) “Python has a set of keywords that can also be used to declare variables”
ii)
29 Select the correct output of the following python code:
str="My program is program for you"
t = str.partition("program")
print(t)
a) ('My ', 'program', ' is ', 'program', ' for you')
b) ('My ', 'program', ' is program for you')
c) ('My ', ' is program for you')
d) ('My ', ' is ', ' for you')
30 a) What will be the output of the following string operation.
str="PYTHON@LANGUAGE"
print(str[2:12:2])

b) Write the output of the following code.


data = [1,2,4,5]
for x in data:
x = x + 10
print(data)

*************STAY HEALTHY STAY HAPPY*************

You might also like