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

Xii CS

The document contains holiday homework for Class XII Computer Science, including questions on Python programming concepts such as tuples, dictionaries, string manipulation, and error handling. It includes tasks like writing programs to count words, manipulate lists, and handle string cases. Additionally, it asks for explanations of errors and the differences between certain list methods.

Uploaded by

dark.death0723
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Xii CS

The document contains holiday homework for Class XII Computer Science, including questions on Python programming concepts such as tuples, dictionaries, string manipulation, and error handling. It includes tasks like writing programs to count words, manipulate lists, and handle string cases. Additionally, it asks for explanations of errors and the differences between certain list methods.

Uploaded by

dark.death0723
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

HOLIDAY HOMEWORK

SUB : C S
CLASS - XII
Q.1
1. Suppose a tuple T is declared as T = (10, 20, 30, 40)
what will be the output of print(T*2).
2. In key- value pair, each key is separated from its value by a………………………
3. Name the python Library modules which need to be imported to invoke the following
functions: (i) ceil() (ii) mean()
4. What will be output of following expression:
(5<10) AND (10<5) OR (3<18) AND NOT (8<18)
5. What is the output of following code :
names = ['Kirti', 'Srikhar', 'Yaksh', 'Prakhar']
print(names[-1][-1])
6. Identify the valid declaration of X :
X = [20, 20.19, ‘Dec_pre_board’, “KVS”]
(i) list (ii) dictionary (iii) invalid list (iv) tuple
7. What is the output of following code :
( i) >>> 2 < 3 (ii) >>> True+5
8. Declare a dictionary as x and display only all values.

Q.2
1. What is output from the following code:
(i) range(6) (iii) range (5,20,4)
(ii) range (7,10) (iv) range (12, 1, -2)
2. Declare a dictionary as d, then display it and update any one value again display it.
3. Write a program to count total number of words present in an string.
4. What will be output of following:
word=’AMAZING’
print(word[0:3])
print(word[-5:-1])
print(word[ : :-2])
print(word[1: 10: 2])
5. Rewrite the following code in python after removing all errors. Underline each
correction done in the code.
M =int(“enter number”)
for in loop(0,11):
if M = = K :
print(M+K)
Else :
Print(M-k)
6. Different between append() and extend() with example.
7. Find and write the output of the following Python code:
Def output( ):
str='Fun@Python3.0'
m=""
for i in range(0,len(str)):
if(str[i].isupper()):
m=m+str[i].lower()
elif str[i].islower():
m=m+str[i].upper()
else:
if i%2==0:
m=m+str[i-1]
else:
m=m+"#"
print(m)

print(“bye bye”)
outout()
print(“welcome”)

Q.3 Write the output of the following.


L1=[500,600]
L2=[35,45]
L1.append(700)
L1.extend(L2)
L1.insert(25,2)
print(L1)
print(L1+L2)
print(L1.index(35))
1. Define with example : (i) Runtime error (ii) Syntax error (iii) Logical error
2. Write a program to count and display the number of upper case , lower case,
digits and spaces in the string using function and passing a string as a
parameter.
3. Write a program of to remove the elements from the list which are divide by 5 and
store in another list using function (pass list as parameter).
For example
Original Given list : a= [3, 20, 32, 43, 5, 12, 35]
Output : New list b= [ 20, 5, 35]
Changed Original list a = [ 3, 32, 43,12]
4. Write a program to search any element from the list by using function.
( Linear search)
5. Write a program to check number of ‘H’ present in a string using function:
HEALPS HEALS WITHOUT HURTING
The out will be displayed as: Total number of ‘H’ is: 4

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy