0% found this document useful (0 votes)
10 views6 pages

g11 t-2 Worksheeet-1

Uploaded by

aayush270105
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)
10 views6 pages

g11 t-2 Worksheeet-1

Uploaded by

aayush270105
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/ 6

1. What will be the datatype of d, if d = (15) ?

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

4. 3 and 5<15 or 3<13 and not 12<2


5. s="one two three"
s=s.split()
print(s)
6. Consider the statements given below and then choose the correct output
from the given options:
s=”KVS@CBSE 2023”
print(s[-2:2:-2])
7. What will be the output of the following code:
t=(2,3,[4,5,6],7)
t[2]=4
print(t)
a) (2,3,4,7) b) (2,3,[4],7) c) Type error d) None

8. What possible output(s) are expected to be displayed on screen at the time of


execution of the program from the following code?
import random
points=[30,50,20,40,45]
begin=random.randint(1,3)
last=random.randint(2,4)
for c in range(begin,last+1):
print(points[c],"#",end=’’)
(a) 20#50#30# (b) 20#40#45 (c) 50#20#40# (d) both (b) and (c)

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.

13. Predict the output of the following code


l=['1','2','3']
m=str(l)
print(m)
print(m.find('2'))
14. test_list = [5, 6, 7]
test_tup = (9, 10)
res = tuple(list(test_tup) + test_list)
print(str(res))

15. Predict the output?


Tup1 =((1,2),)*7
print(len(Tup1[3:8]))

16.Write python code to Generate following pattern using Nested loop


*
**
***
****
*****
17. Which of the following functions will return the last three characters of a string
s?
s[3: ] b) s[ : 3] c) s[-3: ] d) s[ : -3]

18.Which keyword is used to terminate the looping in Python when certain


condition is
met ?

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

20.Which of the following operations on a string will generate an error?


(a) "PYTHON"*3 (b) "PYTHON" + "20"
(c)"PYTHON" + 10 (d) "PYTHON" + "LANGUAGE"

21.What will be the output of the following Python code?


i=1
while True:
if i % 3 == 0:
break
print(i)
i+=1

22.What will be the output of above Python code?


str1= “6/4”
print(“str1”)
a) 1 b) 6/4 c) str1 d (1.5)

23.Which of the following will give "Simon" as output?


If str1="John,Simon,Aryan"
a) print(str1[-7:-12]) b) print(str1[-11:-7])
c) print(str1[-11:-6]) d) print(str1[-7:-11])
24.What will be the output of below Python code?
str1="Application"
str2=str1.replace('a','A')
print(str2)
a) application b) Application c) ApplicAtion d) application
25.

26.,27

If a is [1,2,3],is a*3 equivalent to a+ a+a?

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)

29. Write the output of following code:


d = {'x': 1, 'y': 2, 'z': 3}
for k in d:
print (k, '=', d[k])

30. x = {1:10}
d = {2:20, 3:30, 4:40}
x.update(d)
print(x)

31. What will be the output of the following Python code?


random.randrange(0,91,5)
a) 18 b) 10 c) 79 d) 95
32.
Select the correct output of the code:
for i in "QUITE":
print(i.lower(), end="#")
a. q#u#i#t#e# b. ['quite#’] c. ['quite'] # d. [‘q’]#[‘u’]#[‘i’]#[‘t’]#[‘e’]#
33. Consider the statements given below and then choose the correct output from the given
options:
pride="#Azadi Ka Amrut@75"
print(pride[-2:2:-2])
Options
7TRAa d
7tRAa d
7TrAa d
7trAa d

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:

You might also like