0% found this document useful (0 votes)
0 views4 pages

Xii Assign Review of Python

The document contains a series of questions related to Python programming, focusing on identifiers, string operations, logical operators, and data structures like tuples and dictionaries. Each question provides multiple-choice answers, testing the reader's understanding of Python syntax and functionality. It serves as a review for students in a Computer Science class, specifically for Chapter 1 on Python.

Uploaded by

adityaraj06228
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)
0 views4 pages

Xii Assign Review of Python

The document contains a series of questions related to Python programming, focusing on identifiers, string operations, logical operators, and data structures like tuples and dictionaries. Each question provides multiple-choice answers, testing the reader's understanding of Python syntax and functionality. It serves as a review for students in a Computer Science class, specifically for Chapter 1 on Python.

Uploaded by

adityaraj06228
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/ 4

SCHOLARS PRIDE SCHOOL, FARIDABAD

CLASS: XII SUBJECT: COMPUTER SCIENCE


CHAPTER -1 : REVIEW OF PYTHON

1) Find the invalid identifier from the following


a) Name b) break c) section d) mark12

2) For a given declaration in Python as s= "WELCOME''


Which of the following will be the correct output of print (S (1: :2])?
a) WEL b) COME c) WLOE d) ECM

3) Find the invalid identifier from the following


a) none b) address c) Name d) pass

4) Which of the following is an incorrect Logical operator in Python?


a) not b) in c) or d) and

5) Given the Python declaration S1="Hello". Which of the following statements will given
errors
a) print(S1[4]) b) S2=S1 c) S1=S1[4] d) S1[4]="Y"

6) Which of the following is the correct output for the execution of the following Python
statement?
print(5+3**2/2)
a) 32 b) 8.0 c) 9.5 d) 32.0

7) What is the output of the expression?


N='Swachh Bharat'
A=N.partition(' ')
print(A)

a) ('Swachh Bharat',' ', ' ') c) ('Swachh', ' ', 'Bharat')


b) ['Swachh', ' ', 'Bharat'] d) Error

8) Select the correct output of the code:

a) PYTHON-IS-Fun c) PYTHON-is-Fun
b) Python-is-fun d) PYTHON-Is -Fun

9) Consider the statements given below and then choose the correct output from the given
options:
pride="#G20 Presidency"
print(pride[-2:2:-2])
a) ndsr c) ceieP0
b) ceieP d) yndsr

10) Which of the following is not a Tuple in Python?


a) (1,2,3) c) ("One", "Two", "Three")
b) (10,) d) ("One")

11) Which of the following is not a valid Python string operation?


a) 'Welcome' +'10' c) 'Welcome' *10.0
b) 'Welcome' * 10 d) "10" + 'Welcome'

12) What will be the output for the following Python statement?
T=(10,20,[30,40,50], 60,70)
T[2][1]= 100
print(T)
a) (10,20,100,60,70) c) (10,20,[30,100,50], 60,70)
b) (10,20,[100,40,50],60,70) d) Error

13) Identify the output of the following code snippet:


S = "text#next"
print(S.strip("t"))
a) ext#nex c) ex#nex
b) text#nex d) ext#next
14) What will be the output of the following Python statement?
L=[10,20,30,40,50]
L= L+ 5
print(L)
a) [10,20,30,40,50,5] c) [15,25,35,45,55]
b) [5,10,20,30,40,50] d) Error

15) What will be the output for the following Python statement?
D={"AMIT":20,"RESHMA":96,"SUKHBIR":92,"JOHN":95}
print("JOHN" in D, 90 in D, sep="#")
a) True # False c)True # True
b) False # True d) False # False

16) What does the list.append(10) method do in Python?


a) Add the element 10 in the beginning of the list.
b) Add the element 10 in the mid of the list.
c) Add the element 10 in the last of the list.
d) Error

17) What will the following expression be evaluated to in Python?


print(15.0 / 4 + (8 + 3.0))
a) 14.75 b)14.0 c) 15 d) 15.5
18) Nitish has declared a tuple T in Python as following?
T=(10,20,30)
Now, he wants to insert an element 40 after these three element of T so that the
tuple may contain (10,20,30,40)
a) T= T +40 c)T= T +(40)
b) T= T +(40,)
c) Nitish cannot insert 40 into the tuple since Tuples are immutable

19) Identify the output of the following Python statement?


S="GOOD MORNING"
print(S.capitalize(),S.title(),end="!")

a) GOOD MORNING! Good morning c) Good Morning! Good morning


b) Good morning! Good Morning! d) Good morning Good Morning!

20) Identify the output of the following Python statement?


L=[]
for i in range(4):
L.append(2*i+1)
print(L[::-1])

a) [7,5,3,1] b) [9,7,5,3] c) [4,3,2,1] d) [1,2,3,4]


21) Identify the output of the following Python statement?
D={}
T=("ZEESHAN","NISHANT","GURMEET","LISA")
for i in range(1,5):
D[i]=T[i-1]
print(D)

a) {"ZEESHAN","NISHANT","GURMEET","LISA")
b) "ZEESHAN","NISHANT","GURMEET","LISA"
c){[1,"ZEESHAN"],[2,"NISHANT"],[3,"GURMEET"],[4,"LISA"]}
d){1:"ZEESHAN",2:"NISHANT",3:"GURMEET",4:"LISA"}

22) Identify the output of the following Python statements


L1,L2=[10,15,20,25],[]
for i in range(len(L1)):
L2.insert(I,L1.pop())
print(L1,L2,sep=”&”)

a) [] &[25,20,15,10] c) [10,15,20,25]&[25,20,15,10]
b) [10,15,20,25]&[10,15,20,25] d) [25,20,15,10]&[]

23) Which of the following option can be the output for the following Python code?
L1=[10,20,30,20,10]
L2 = []
for i in L1:
if i not in L2:
L2.append(i)
print(L1, L2,sep=”&”)

a) [10 , 20 , 30 , 20 , 10]&[10 , 20 , 30 , 20 , 10]


b) [10 , 20 , 30 , 20 , 10] [10 , 20 , 30 , 20 , 10] &
c) [10 , 20 , 30 , 20 , 10] &[30 , 20 , 10]
d) [10 , 20 , 30 , 20 , 10] &[10 , 20 , 30]

24) Consider a tuple tup1 = (10, 15, 25, 30).


Identify the statement that will result in an error.
a) print(tup1[2])
b) tup1[2] = 20
c) print(min(tup1))
d) print(len(tup1))
25) Identify the output of the following Python code.
D={1:"One",2:"Two",3:"Three"}
L = []
for K,V in D.items():
if V[0] =="T":
L.append(K)
print(L)

a) [1,2,3] b) ["One" , " Two" , " Three"]


b) [2,3] c) [" Two" , "Three"]

26) What will be the output of the following Python code?


S="UVW"; L=[10,20,30];D={}
N=len(S)
for i in range(N):
D[L][i]=S[i]
for K,V in D.items():
print(K,V,sep = "*",end = ",")

a) U*10 , V*20 , W*30, c) 10*U , 20*V,30*W,


c) 10 , 20 , 30 , U*V*W* d) Error

27) What will be the output of the following Python code?


L=[10,20]
L1=[30,40]
L2=[50,60]
L.append(L1)
L.extend(L2)
print(L)

a) [60, 50, 40, 30, 20, 10] c) [10 , 20 , 30 , 40 ,50, 60]


b) [10 , 20 , 30 ,40 , [50 , 60]] d) [10 , 20 , [30 ,40] , 50 , 60]]

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