Nothing Special   »   [go: up one dir, main page]

Python Revision Tour

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

VELAMMAL NEWGEN GROUP OF SCHOOLS

II/\ LF-YE/\RLY EXAMINATION [2022 -. 2023]


~-l -,,, 'V COMPUTER SCIENCE
i
)
nmc: Jh~~~ Dote: 13.12.7.022
l 17.. Which OIJNiltor i!> used for string conc<1te11ation?
il . ' b.// ,C. .·I d.-
13. Write tho outrut of tilP followinp.
G1'nrr,1I Instructions:
li st('wc lome') fl.. I JI..() I l
(lLv1t'1"1
l' I.. d \,vJ' \ el '7
I I hi<. qtJC-<,tlon p,ipt't c crnt.1i11s five srctions, S0cl1011 !\tor.. I I I_)
l !\II qtH'•,tion!-, ,11 (' c ornpul'iory. · l4 . clel Stilt<'mcn t c,111 cl Piel<' the followinr, frorn the list
J. 18 C'JLll~!->l1011, CiHry11\p, 01 n1ark 1',Kh.
!',t'rt inn ,\ h,wt•
il , '>rng lr• rlcnwnt h. rnultirle elc?mcnt~ ?· all elcrncnts alone with li',l 1

•l S.-ctinn n h,l!> 0 7 V1,ry <:,hort /\nswer type questions cilrryinc 02 marks e; 15. Which of the followinr, statements will c;:cate a tuple?
1 _tpl ,= ("a", "b'') b tpl.[2] = ("il", "b") c. tpl = (3)"'3
8'. d. None of thei
'1 \i•c·t,on Ch_,,~ 0 1 Short /\nswer type ciuc~stlonc; c;,rrylng 03 mJrks c;ich.
(). ~t'c tipn D hil\ 031 ong Answer type ciu0stlonc; curying OS mr1rks each. 16. Choose the correct statcmc~t(s).
l 5L'rt,on 1. h;i.-, 02 (lucstiot\S cc1rryinr, 04 marks e;ich. a. l)oth tuples c1nd lists are Immutable.
~ All prog, ilt11ming questions ;ir~ to be ;,11swercd using Pyihon Language c l"l1!uplcs are imniut;ible while lists· are mutable. -
c. Both tuples and lists arc mutable.
SECTION-A
t11 1· _ where ;,II the steps are executed orTe after the other ,s s. d. Tuples ar~ mutable while lists are immutable.
',('(]\ICl1Cl'.
17. Which of the following function return the frequency of particular elc
i1 flowchart IY. Algorithm c. Pseudocode d. None a. index() b, max() c. count() • d. None
2. Whirh of tl1e f ollowinc is an invalid variable?
18. Whc1t will be the output of the fallowing Python code?
cl 111y _Strine_ 1 b~ J st_strine C. foo d.
my_tunle = (1 , 2, 3, 4)
3. ,,,,allli51 elenwnt of python code is ca lled _ __
111y_luplc.r1rpe11d ( (5, 6, 7))
~- lclentifi<'rs b~Tokens c. keywords d. delirr prrnl( lcn(rny tuple?))
4. \•\Ir 11!' 11w out rut of the following code? il , 1 b. 5 C. 2 d. Error •
X=)
SECTION-8
Y· 3 19. What is the difference between source code and object code?
X-'-Yl ~ (OR}
p1 int(X ➔ Y) llow is a process-different from, a prograrn?
5. 1/✓ ritinr; comments is m,rndatory in python. 20. What are token s in. Python? How many types of tokens are allowed In ~
;1 1r ll" b rc1ls~ • . Exrmplify your t1nswer.
G. outrrnt of print(2• 3 • • 7) is_._
.-'· 21. '6fhal are variables?,How are th~y important for a program?
., . JG b. 611 c18 22. Whol ;,re dclla types? How are they important?
7. Which of the following store data in pair? (OR}
a 14-,1_ b.Tuple c, String Why is Booler1n considered a subtype of integers?
s:1mnt(lfool(1 ilr)d 6)) gvaluntc'> to _ __ 23. WhiJl nrc immutable and mutable types? List immutable and mutc1ble t
r1 f ;il•,e . r>. True• c, Frror d. None (OR)
9. Vint<' the output of the following code? Predict the output:
, " , 11 11 11 11 r, 11
. SECTION-C (),W(tk ►
cerui. H.tU
26. Whcit are Jump state 1 34. Wt1at will b SECTION-E
27. How is b k .· men ts · Name them? Explc1in with ;in excimple. _ e the output produced by following code? State reas
re;:i d1fferent fr • cl .b
• C - 1. 1, 2
w.
28 . nte a program to c I I
om continue? Explain with an example.
d ==a+ b
.
a cu ate the arer1 of an eciuilateral trianele.
e = 1.0 ·
I :n~ln·
. (OR)
pr_ogram to input the rudius of c1 sphere and c;ilculr1te Its volume .
,r1t 15 following code doing? What would it print for input r1s 3?
f::: 1.0
g = 2.0
h=e +f
n =1nt(input("Enter an integer:")) print(c = d)
if 11 <1: . pnnt(c is d)
f>rint ("invalid value") print(g == h) .:
el se : pnnt(g is h)
for i in rr1n13e (1, n ➔ 1) : 1· a.) What output .prod-uced by print(c=d) _
print (i • i)
. -b.) Wh-at output produced by print(c is d)
(OR)
Find the errors in the code given below and correct the code: ·- cT What output produced-byprint(g"'=hf
d .) What output produced by print(g is h)
L _ _ _ _ --
1f n == 0
print ("ze1 o")
35 . Consider the following code segm·ent:
elif :n 1 == a = int(input("Enter an integer: "))
print ('one') b = int(input("Enter an integer:"))
elif if a< = 0:
-n 2: == b = b·+1
print("two") else :
else n 3: == ;i =a+ 1
print (" three") if a > 0 and b > 0:
30. Wr ite a program which replaces all vowels in the string with'*' . print ("W")
(OR)
elif a> O:
Write a program which reverses a string and stores the reversed string in , print(''X")
if b > 0:
SECTION- D print("Y") \
31 1. Given a list L1 = [3, 4.5, 12, 25 .7, (2, 1, 0, 5], 88] which function can cl else :
prin!('~•z~")c....-- - -- - - - : - - - - : - : - : - : - - - - - - - - - -
(a) [3, 4.5, 17., ?.5 .7, 88) a. What letters will be printed if the use enters Ofor a and 0
(b) 13, 4.5, 12, 25 .7) a. Only W b. Only X Only Y d. Wan,
(c) [12 , 1, 0, SI, 88] . '. b. what letters will be printed if the user enters 1 for a and 1
ii. Find the output generated by following code fragments:. I a . Wand X b. Wand Y c. X and Y d. X anc
a. r,l,ine = ("Passengers", "Lugeage") c. ; - ➔What l~tters will be printed if the user enters 1 for a and -1
f "'q
&
-aoP
1
VELAMMAL VIDHY ASHRAM- SURAPET print(T[: :-2))
Class Test 1 (2)
')?,'U. Grade: 11 7. Identify the output of the following Python statements :
Subject: Computer Science - Duration: 40 minutes T = ( I 0,20,30)
Name:
--- --- --- --- -
Topic: Tuples in Python
Date: - - - - -
-
for i in T:

print(i%3,1,sep="&'')
Marks: 20 (2)
8. Differentiate List and Tuple.
----------------------------------------------- 9. Write down the similarittes you find in between tuple and list.
(2)
(I)
1. What will be the output for the following Python Statements (l) 10. Write a statement to be used for changing the given list objc:ct into tuple object.
T = ( I 0,20,30,40,50) X = [J0,3,7, 12.2,15)
T=T+(60 ,)
,. print(T) •
___, ~
.:
(a) (10,20,30,40,50,60) (b) (60,10,20,30,40,50)
(c) ( l 0,20,30,40,50,60) @)Error
2. What will be the eutp\!t for the following Python Statements ( l)
r = (10,20,fo,(46:so,60),10,so)
T[!J[2) = 100
print(T) 'v
(a) ( I 0,20,30,(40,50,60), 70,80) "'1'I'. I0,20, I 00,( 40,50,60), 70,80)
~0,20,30 ,(40,50,1 00),70,80 ) (d) Error
(I)
J. Which of the following 1s a valid Python statement?
(a) (I 0,20,30) + 40,50,60 (b) 10.20,30 • (10,20)
(c) (10,20,30,40)[2)=50 ~ 0,20,30) + (20)
of marks)
4. The record ofa student (Name, Roll_no, Marks ID five subjects and percentage
is stored in the following tuple.
strecord = ("HarryPo\;°er", 56044, [98,9 l",92, .89,95),93.0)
strecord.
Write Python statements to re~ieve the follo~g info~tion from the tuple
(i) Perc.entage of the student
(l}
(I)
(ii) Marks in the fourth subject
(I)
(iii) Maximum marks oftbe student
(I)
(iv) Roll_no oftbe student
(2)
(v) Add grade value "Al" to the tuple strecord(Find the possible way)
(2)
5. What will be the output of the following code segment:
Nitish has declared a tuple T ID Python as following:
T = ( 10,20,30)
the tuple
Now, he wants to insert an element 40/fler tl~se three elements ofT. So that
may contain (I 0,20,30,40) 1t l4 Dl )
tuple T.
Guess the statement used by Nitish, In order to insert the element 40 into the
(2)
6. Identify the output of the following Python statements:
T= tupleO
for i in range(?):
T=T+ (i,)
~:
1Ml3-:.!U:l:.!1 :.!U6-WAUUU:.!.Jpg
VELA lVIM AL VIDH Y ASHR AM - SURA PET
Grade : 11 Class Test - l 12Jlfth e following code is executed, what will be the output
of the following code?
-- Marks: 20 Tille= "Artificial Intelligence"
Subje ct: Comp uter Scien ce Durat ion: 30 minutes
Name : _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Date: print(Tillc[::-1 ])
---------------------------------------------------------------------------------- 13. Find the output of the following:
1. Which of the followi ng stateme nt is incorre ct?
>>>Nam e= "Pytho_n ~~amination"
A. X=*Y B. My_na me = 'Deepe sh' C. While= 400 >>>print (Nam'e [ : 8 : -1])
D. None of these
2. Which of the followi ng is not used to repeat some 14. Whtch of the following is not a valid identifier name
code in Python? in Python? Justify reason for it not
;. A. for loop B. d9,cwhile loop being a valid name._ ,
C. wlule loop •n. None of the above.
3. The _ _ _ _ stateme nt termina tes the executi
on of the enrire loop. ,a) 5Total b) _Radius c) pie d)Wh.ile
A. continu e B. break C. pass D. exit 15. What will be the output of following program:
4. Negativ e index - I belongs to _ _ _ of string.
A. first charact er a='hello'
B. second charact er
C. second last charact er b='virat'
D. last characf er
5. Predict the output ofthc followi ng code: for i in range(len(a)):
print(a[i],b[i])
for x in range(/ 0, 35):
if x%5== 0: ~Find the output of the following;
prinr(."I', end='') >>>Lin e= "Fun with Python"
6. Identify the valid logical operato r in Python. >>> print (Name [ : 5 : -1])
(a) ith Python (b) th Python -(d) nohty
(i) % (ii) ! (iii) or (iv) II (c) nohtyP ht
7. Identif y the invalid identifTers from the followin g: 17. Identify the output of the following Pythot1_statements.
(i) else x=0
(ii) fF (iii) 4boolcl (iv) stud_na rne
8. If the followi ng code is execute d, what will be the output while x < 15:
of the followin g code?
>>>Str l = ~•AAR DWOR JCvsSM ARTWO RK" print(x, end=")
x=x+ 3
>>>pri nt(Str I [7: 15]
a) 036912 15 b) 036912 _ c) 369121 5 d)369l 2
9. Find the invalid identifi er from the followi ng 18. Identify the output of the followin g Python stateme
nts.
a) yourNa me b) _false ~ 2My_N amc d) My_Na me
COtUtt= 0
I 0. Which of the followi ng is a valid assignm ent
operato r in Python ?
for a in range(0 , 20, 2): '
a)_. b) >= c) += e➔ !=
1
..!.,,,,('~
d) <=
I \...- ifa-0:
I J. If the followi ng code is execute d, what will be the output
of the followi ng code?
continu e
>>>nam e="Com putef §cie~cS with Python "
elifa% 2=0:
>>>pri nt(nam e[5: 16:2])
https://mall.google.com/mail/u/O/#inbox/FMfcgzGrbRVV
sBDxPlpDPpVfhMcBrbKq?projector-:1&messagePartld=
0.6
\ EL\ \l\fAL \1DHYASHR.\ \f -St:RAJ'ET
O.~s ,:._·

T.:._-;r~

L.

s t::neS

ale·
'; C !.:.C fc,lb'l::.g code

You might also like