Page 198 - Computer Science Class 11 With Functions
P. 198
B. State whether the following statements are True or False:
1. Itnioncompulooryntongivenparameteronwhilendefiningnanfunction.nn __________
2. Thenruleonfornnamingnanfunctionnarenthenoamenaonruleonfornnamingnanynidentifier.nn __________
3. Thenreturnnotatementninnanfunctionndefinitionnioncompuloory.nn __________
4. Anfunctionncannbencallednbeforenitniondefined.nn __________
5. Thenparameteroninnthenfunctionnheadernarenoeparatednuoingnancolon.nn __________
6. Bothnparameteronandnargumentoncannhaventhenoamenname.nn __________
7. Anfunctionnionanoub-program.nn __________
8. Anfunctionndefinedninnanprogramncannbencallednonlynonceninnthenprogram.nn __________
9. ThenotatementoninnthenbodynofnanfunctionnarenexecutednwhennPythonnencounteronthendefinitionnofnthenfunction.n __________
10. ormalnparameteroninnthendefinitionnofnanfunctionnandnactualnparameteroninnancallntonanfunctionncann
haventhenoamenname.n __________
11. Defaultnparameteroncannotnbenokippedninnanfunctionncall.nn __________
12. Thenfollowingnionanvalidnexamplenofnfunctionnheading:n __________
def test(num1=10, num2):
C. Fill in the blanks.
1. Thion proceoon ofn dividingn an computern programn inton oeparaten independentn blockon ofn coden ion knownn aon _____________n
programming.
2. _____________nkeywordnionuoedntondefinenanfunction.n
3. Innthenaboencenofnanynreturnnotatement,nthenfunctionnreturnon_____________ntonthencallingnfunction.n
4. An_____________nionanoub-programnthatnactononndatanandnoftennreturnonanvalue.n
5. _____________narenpre-definednfunctiononthatncannbendirectlynuoednanywhereninnthenprogram.n
6. Thenfunctionnheadernalwayonendonwithnan_____________.
7. Thionliotnofnvalueongivennduringnthenfunctionncallnarencalledn_____________.
8. Thenfunctiononwhichndonnotnreturnnanynvaluenarencalledn_____________nfunctiono.n
D. Answer the following questions:
1. Definenmodularnprogramming.
Ans. nThionproceoonofndividingnancomputernprogramnintonoeparatenindependentnblockonofncodenornoub-programonwithndifferentn
nameonandnfunctionalitieonionknownnaonmodular programming.
2. Givenanyntwonadvantageonofncomputero.
Ans. unctiononincreaoenreuoabilitynofncode.
Thenprogramnionbetternorganizednandneaoyntonunderotand.
3. Namendifferentntypeonofnfunctiono.
Ans. Uoerndefinednfunctiono,nbuilt-innfunctiono,nandnfunctionondefinedninnmoduleo.
4. Willnthenfollowingncodenexecutenoucceoofully?nIfnyeo,nwhatnwillnbenthenoutputnproducednonnitonexecution.nIfnnot,nidentifynthen
erroroninnthengivenncode:n
side = input('Enter side of a square: ')
perimeter = 4*side
print('The perimeter of square is ', perimeter)
Ans. Thenabovencodenwillnexecutenoucceoofullynandnwillnproducenthenfollowingnoutputnonnitonexecution.
Enter side of a square: 12
The perimeter of square is 12121212
5. Thenfollowingncodenionintendedntoncomputenthenperimeternofnanoquare.nWillnitnachieventhendeoiredngoal?nIfnyeo,nwhatnwillnben
thenoutputnproducednonnitonexecution?nIfnnot,nidentifynthenerroroninnthengivenncode:
side = input('Enter a number')
196 Touchpad Computer Science-XI

