Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

PM SHRI KENDRIYA VIDYALAYA ORDINANCE FACTORY AMBERNATH

CLASS XI CS
Winter Break Homework

• Note : Complete Your Class work and Practical Record

String
Q.1 Write a python script that traverses through an input string and prints its characters in
different lines – two characters per line
Q. 2 Suggest appropriate functions for the following tasks –
(a) To check whether the string contains digits.
(b) To find the occurrence a string within another string.
(c) To convert the first letter of a string to upper case.
(d) To convert all the letters of a string to upper case.
(e) To check whether all the letters of the string are in capital letters.
(f) to remove all the white spaces from the beginning of a string.
Q. 3 Find the output – if we give input as “Hello”

Q.4 What would following expression return?


(a) “Hello World”.upper().lower() [1]
(b) ”Hello World”.lower().upper() [1]
(c) ”Hello World”.find(“Wor”,1, 6) [1]
(d) ”Hello World”.find(“Wor”) [1]
(e) ”Hello World”.find(“wor”) [1]
Q.5 . Given a string S = “CARPE DIEM”. If n is length/2 then what would following
return?
(a) S[:n] [1]
(b) S[n:] [1]
(c) S[n:n] [1]
(d) S[1:n] [1]
(e) S[n:length-1]

Q. 6 Write a program that takes a string with multiple words and capitalizes the first letter of
each word and
forms a new string out of it.

LIST
Q.1 How are lists different from strings when both are sequences?
Q. 2 Predict the output

Tuples
Q. 1 Find out the output generated by following code fragments:
(a) plane = (“Passengers”, ”Luggage”)
plane [1] = “Snakes”
(b) (a, b, c) = (1,2,3)
(c) (a, b, c, d) = (1,2,3)
(d) a, b, c, d = (1,2,3)
(e) a, b, c, d, e = (p, q, r, s, t) = t1
(f) T1=(1,)*3
T1[0]=2
Print(T1)
(g) TupleA=’m’,’n’
TupleB=(‘m’,’n’)
Print(TupleA==TupleB)
Q. 2 WAP that creates a tuple storing first 9 items of Fibonacci Series.
Q.3 What are the two ways to add something to a list ? How are they different from tuple?

Dictionary
Q.1 . Dictionary is a mutable type, which means you can modify its contents ? What all is
modifiable in a dictionary ? Can you modify the keys of a dictionary ?

Q. 2 Predict the output of the following code in python:


Fruit ={ }
L=[‘Orange’,’Apple’,’Grapes’]
for index in L:
if index in Fruit:
Fruit[index]+=1
else:
Fruit[index]=1
print(len(Fruit))
print(Fruit)

Case Study Based Question


1. A bank is a financial institution which is involved in borrowing and lending of money. With
advancement in technology, online banking, also known as internet banking, allows
customers of a bank to conduct a range of financial transactions through the bank’s website
anytime, anywhere.
The basic two operations performed on an account are Deposit and Withdrawal. Write a
menu-driven program that accepts either of the two choices of Deposit and Withdrawal,
then accepts an amount, performs the transaction and accordingly displays the balance. The
program should display the following options as:
Open a savings bank account
Add a customer
Deposit money
Displaying the sorted records
Closing/deleting the account

2. Vidyarthi Gurukul conducts physical training camps for the physical well being of its
students. This camp is held for one week on the outskirts of the city. The entire group of
students are represented as a list. The list stores the roll numbers of the participants for
camp activities. As part of this training, the entire stream of students are divided into two
halves. When the first group of students goes for physical training, the other half goes for
aerobics classes and in the later half these groups are swapped.

Write a Python program that maintain and display details about the swapping of activity
classes and award them stars on completion of each activity.

3. Rajmandir Basket is a department store with a wide range of merchandise including


groceries, fruits, vegetables and household accessories. It aims to develop a complete
software for Billing, Inventory and Accounts management and to provide consumers a
user-friendly interface to view item codes and prices of various items.

Write a program in Python that repeatedly asks the user to enter product names and
prices. Store all of them in a dictionary whose keys are product names and values are
prices. Also write a code to search an item from the dictionary.

4. The above shopping destination for groceries, Rajmandir, stores phone numbers of its
customers. Phone numbers are to be stored in the form of a dictionary. Write a Python
program to input ‘n’ names and phone numbers to store them in a dictionary and to input
any name and to print phone number of that particular customer.

You might also like