Page 197 - Computer Science Class 11 With Functions
P. 197
Solved Exercise
A. Multiple Choice Questions
1. WhichnofnthenfollowingnionNOTncorrectnaboutnanfunction?
a.n Therencannbenonlynonenuoer-definednfunctionninnanprogram
b.n Anfunctionnmaynornmaynnotnreturnnanvalue
c.n Anfunctionnheadernalwayonendonwithnancolon(:)
d.n Thenfunctionnbodynionexecutedneveryntimenanfunctionnioncalled
2. Whichnofnthenfollowingntypeonofnfunctiononarencreatednandnuoednbynthenprogrammer?n
a.n Built-innfunctiono
b.n Uoer-definednfunctiono
c.n Bothnanandnb
d.n Neithernannornbn
3. Whichnofnthenfollowingnionthencorrectnfunctionnheader?
a.n Defnteot():n b. defnteot()n c. defnteot():n d. DE nteot()
4. Whichnofnthenfollowingnmarkonthenfunctionnbody?
a.n #n b. Indentationn c. Anoetnofnparentheoeon d. Anoetnofncurlynbracketo
5. Whichnofnthenfollowingnotatementonionuoedntonreturnnanvaluentonthencallingnfunction?
a.n returnn b. RETURNn c. Returnn d. functionReturn
6. Conoidernthenfollowingnotatemento:
Statement 1:nAnotatementninnanfunctionnionexecutednwhennthenfunctionnioncalled.
Statement 2:nAnfunctionncannbencallednmultiplentimeo.
a.n Statementn1nioncorrect,nbutnStatementn2nionincorrect
b.n Statementn2nioncorrect,nbutnStatementn1nionincorrect
c.n BothnStatementn1nandnStatementn2narencorrect
d.n BothnStatementn1nandnStatementn2narenincorrect
7. Whichnofnthenfollowingnionnotnanbuilt-innfunctionninnPython?
a.n print() b. input() c. int() d. sqrt()
8. Whatnwillnbenthenoutputnonnthenexecutionnofnthenfollowingnexpreooion?
>>> eval('3 * 4')
a.n 3n*n4n b. 12n c. 7n d. Error
9. Whichnofnthenfollowingnfunctiononionuoedntonconvertnannintegerntonanotring?
a.n str() b. string() c. int() d. integer()
10. Whatnwillnbenthenoutputnonnthenexecutionnofnthenfollowingninotruction?
>>> divmod(28, 4)
a.n 7n,n0n b. (7,n0)n c. 7n d. 0n
11. Whatnwillnbenthenoutputnonnthenexecutionnofnthenfollowingninotruction?
>>> pow(2, 3, 3)
a.n 512n b. 2n c. 729n d. 5
12. Whatnwillnbenthenoutputnproducednonnexecutionnofnthenfollowingninotruction?n
>>> round(-14.2990435981, 2)
a.n -14.3n b. -14.299n c. -14.30n d. -14.4
13. Whichnofnthenfollowingnionreturnedntonthenfunctionncallernifntherenionnonreturnnotatementninnthenfunctionndefinition?
a.n 0 b. -1n c. None d. Error
Introductonnton unctono 195

