Sei sulla pagina 1di 2

Subject: - COMPUTER SCIENCE (083) PYTHON Max Marks: 70

th
Class – 12 Duration: 3:00 Hours
Name of Student: ____________________ Roll No. :______________ Date:_____________

(Note: All Questions are compulsory)


Instructions:
i) All questions are compulsory.
ii) Programming language: Python
iii) Please write down the complete serial number of the question before attempting it.

Q1. Write Short note using example: 2*10=20


1. Keywords 6. title()
2. Identifier 7. write()
3. len() 8. readlines()
4. split() 9. keys()
5. join() 10. lower()
Q2. Differentiate between: 8*2=16
1. pop() / remove() 5. if / else
2. insert()/ append() 6. //(floor) and /(divide)
3. append()/ extend() 7. keys()/values()
4. read()/ read(4) 8. update / alter in SQL
Q3. Find output: 2*4=8
if The List is : SList= ['P', 'y', 't', 'h', 'i', 'n', ' ', 'L', 'i', 's', 't', ' ', 'S', 'l', 'i', 'c', 'e', '.']
1. SList[ 5:17 ] 5. SList[ 3:12: 2]
2. SList[13:18 ] 6. SList[11:18: 5]
3. SList[11:17 ] 7. SList[ 9:10: 4]
4. SList[ 2: 6 ] 8. SList[ 5:15: 4]
Q4. Find output: 4*2=8
1. my_string = 'Python is Fun' 2. A={1:100,2:200,3:300,4:400,5:500}
print(my_string[:3]) print (A.items())
for i in range(len(my_string)): print (A.keys())
print(my_string[i].upper(),end="@") del A[4]
print() print (A.values())
print (my_string) print (A)
print (my_string[3:6])

Q5. Find output: 4*2=8


If d=['A'] for both Questions.
1. Question 1
d.insert( 0,'E') d.insert( 0,'H')
d.append('T') d.extend('O')
d.pop(2) d.reverse()
d.insert( 1,'V') d.append('G')
d.pop(2) print(d)
2. Question 2
d.insert( 0,'E') d.append(['F', 'S', 'C', 'W', 'P'])
d.extend('P') d.reverse()
d.insert( 2,'S') d.insert( 3,'N')
d.append('L') print(d)
d.extend('I')
d.sort()
Q6. Write Program: 2*5=10
1. Write a Python program to find and display those place names, in which there are
more than 5
Characters.
For example:
If the list PLACES contains ["Miao", "Tawang", "Chabua", "Kimin", "Imphal", "Dimapur"]
The following should get displayed :
Tawang
Chabua
Imphal
Dimapur
2. Write a Python program to check whether a user inputted string is palindrome or
not.
(Example of Palindrome string: MADAM i.e. a word/sequence that reads the same
backwards as forwards.)
3. Write a program to print the following from a string :
1) The last three characters of the string
2) The total number of characters in the string
3) The string with every ‘a’ replaced with an ‘e’
4. Write a program :
a. Square and display all items of list.
b. Write a program to replace all even by 0 and odd by 1 in list items.
5. WAF to read and count Words start with from text file :
1) Upper
2) Lower
3) Digits
4) Special

Potrebbero piacerti anche