XIA CS WINTER BREAK HOMEWORK

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

CLASS-XI A

COMPUTER SCIENCE
WINTER BREAK HOMEWORK [2024-25]

1. What will be the output of the following code?


L1=[1,2,3,4,5]
L1.reverse( )
print(L1)
A. [1,2,3,4,5] B. [5,4,3,2,1]
C. Error D. reverse() function doesn’t exist in python

2. What is the output of the following code ?


example = ‘computar science’
example[6] = 'e'
print (example)
A. compuear science B. computer science
C. computar science D. Error.

3. Identify which of the following is a valid string operation


A. ‘python’ + 2023 B. ‘python’ + ‘2023’
C. ‘python’ * 5 D. python’ * ‘python’

4. A list is declared as
Lst = [1,2,3,4,5,6,8]
What will be the value of sum(Lst)?

5. Write the purpose of the following functions/methods in respect of string


i) len ( ) ii) split( ) iii) upper() iv)count () v) islower()

6. Write python statement for the following for list


L= [2,4,8,6,34,56,67,87,34]
(i) Add an element 65 to the list.
(ii) Delete 8 from the list
(iii) Delete element at index 4
(iv) Find minimum element of L

7. Write the output of the following questions on the basis of the string
str1=’Digital India’
I. print (str1 [ 3: :2] )
II. print (str1[ : : -1 ] )
III. print(str1[ 4 : 9 ] )
IV. print(str1.isalpha( ) )
V. print(str1.find ( ‘India’ ) )

8. Predict the output of the Python code given below


T1=(90,92,93,95,97,95,100)
print(T1[::-3])
print(max(T1))
print(T1.count(95))
print(T1.index(95))
print(sum(T1))
print(len(T1))

PM SHRI KENDRIYA VIDYALAYA NO. 2 CPE ITARSI


9. The record of a student(Name,Rollno,Marks in five subjects,Percentage of marks) is stored
in the following list:
rec=[‘Naman’,’CS1101’,[56,98,99,72,69],78.8]
Help Mr.Sam to write the python statements to retrieve the following information from the list rec
i)Minimum percentage of the student
ii)Marks in the fifth subject
iii)Maximum marks of the student
iv)Roll number of the student
v)Change the name of the student from Naman to Raman.

10. Given list1=[12,32,65,26,80,10], write output of the following statements:


i)list1.sort()
print(list1)
ii)sorted(list1)
print(list1)
iii)print(list1[::-2])
iv)list1[len(list1)-1]
v)del list1[1:3]
print(list1)

11. Write a program to input numbers in a list and print the sum of even numbers present in
list.

12. Write a program to input numbers in list from user and change even number by its half and
odd numbers by its double.
For example if L=[1,2,3,4,5,6,7,8]
Then program will display list [2,1,6,2,10,3,14,4]

13. Write a python code to accept a list of 10 elements from the user and and display the
following
1. Sum of negative numbers
2. Sum of positive even numbers
3. Sum of positive odd numbers
For example : if list is L1=[5,9,-4,12,-3,7,-15,11,2]
Output should be
1. Sum of negative numbers : -22
2. Sum of positive even numbers : 14
3. Sum of positive odd numbers : 32

14. Write a program to input a string and print number of uppercase and lowercase letters in
it.
For Example: If a user enters a string as given below: string="Strings in Python" Then the output
should be:
Number of uppercase letters: 2
Number of lowercase letters: 13

15. Write a program to input a string and print a new string that capitalizes every second letter in the
original string.
Eg.-computer becomes cOmPuTeR

PM SHRI KENDRIYA VIDYALAYA NO. 2 CPE ITARSI

You might also like