12 CS Summer - Vacation - Holiday - HW - 2024-25
12 CS Summer - Vacation - Holiday - HW - 2024-25
12 CS Summer - Vacation - Holiday - HW - 2024-25
Project Work:
Collect information on the following suggested project topics. And submit the synopsis of the
same
(Note: One project can be share by maximum two-three students. (but each has to submit the separate
report) You can select any other good topic also after discussing with teacher)
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)
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='[email protected]'
s=s.split('kv')
op = s[0] + "@kv" + s[2]
print(op)