g11 t-2 Worksheeet-1
g11 t-2 Worksheeet-1
2. 2**3**2 b) (2**3)**2
3. What will be output of the following code:
d1={1:2,3:4,5:6}
d2=d1.get(3,5)
print(d2)
a) 3 b) 4 c) 5 d) Error
9.
L=[12,23,18,9,17]
for i in range(len(L)):
if(L[i]%3==0):
L[i]=0
else:
L[i]=1
print(L)
10. Write the output of the code given below:
book_dict = {"title": "You can win", “copies”:15}
book_dict['author'] = “Shiv Khera”
book_dict['genre'] = "Motivation"
print(book_dict.items())
11. Find output generated by the following code:
string="aabbcc"
count=3
while True:
if string[0]=='a':
string=string[2:]
elif string[-1]=='b':
string=string[:2]
else:
count+=1
break
print(string)
print(count)
12. Write a Python program to count number of words in a given string that start
with vowels.
19.If the following code is executed, what will be the output of the following
code?
name="Computer_Science_with_Python"
print (name [-25:10])
(a) puter_S (b) hon (c) puter_Science (d) with python
26.,27
28.Consider a tuple in python named Months = (‘Jul’, ‘Aug’, ‘Sep’). Identify the
invalid statement(s) from the given below statements:-
a) S = Months[0] b) print(Months[2])
c) Months[1] = ‘Oct’ d) LIST1 =list(Months)
30. x = {1:10}
d = {2:20, 3:30, 4:40}
x.update(d)
print(x)
34. Which of the following statement(s) would give an error after executing the
Following code?
S="Welcome to class XII" # Statement 1
print(S) # Statement 2
S="Thank you" # Statement 3
S[0]= '@' # Statement 4
S=S+ "Thank you" # Statement 5
a. Statement 3 b. Statement 4
c. Statement 5 d. Statement 4 and 5
35.What will be the output of the following code?
a. Delhi#Mumbai#Chennai#Kolkata# b. Mumbai#Chennai#Kolkata#Mumbai#
c. Mumbai# Mumbai #Mumbai # Delhi# d. Mumbai# Mumbai #Chennai # Mumbai
Predict the output of the following code: