Q6.Whatisthedifference betweenObjectOrientedProgramming andProceduralProgramming?Ans: ObjectOrientedProgramming ProceduralProgramming EmphasisonData Emphasisondoingthings (functions) Data hidingfeature preventsaccidentalchangeindata Presence Featureslike data arepresent Suchfeaturesare notavailable Q7. DifferentiatebetweenaCallbyValueandCallbyReference,givingsuitableexamplesofeach? Ans: CallbyValue CallbyReference Thecalledfunctionaccessesandworkswiththe original valuessent toit. originalvalues usingtheirreferences. Anychangesthatoccur inthefunction run,changesinthe originalvaluesarenotreflected. originalvaluesarereflected. void change(intb) voidchange(int&b) { { b=10; b=10; } } voidmain() voidmain() { { inta=5; inta=5; } } Outputwillbe: Outputwillbe: Q8.Whatisaparameter?Differentiatebetweenanactualandaformalparameterwithanexample? Example: void change(intb) //bistheformalparameter { b=10; } voidmain() { inta=5; change(a); } Q9. Enlistanyfourjump statementswith theiruses. Ans:(i)goto: A gotostatementcantransferthe programcontrolanywhereintheprogram. anycode inbetween. continue:Abreakstatementenablesaprogramtoforcethenextiterationtotakeplace,skipping anycode inbetween.
Q6.Whatisthedifference betweenObjectOrientedProgramming andProceduralProgramming?Ans: ObjectOrientedProgramming ProceduralProgramming EmphasisonData Data hidingfeature preventsaccidentalchangeindata Featureslike data arepresent Emphasisondoingthings (functions) Presence Suchfeaturesare notavailable Q7. DifferentiatebetweenaCallbyValueandCallbyReference,givingsuitableexamplesofeach? Ans: CallbyValue CallbyReference original valuessent toit. originalvaluesarenotreflected. Thecalledfunctionaccessesandworkswiththe originalvalues usingtheirreferences. Anychangesthatoccur inthefunction run,changesinthe originalvaluesarereflected. void change(intb) { b=10; } voidmain() { inta=5; } Outputwillbe: voidchange(int&b) { b=10; } voidmain() { inta=5; } Outputwillbe: Q8.Whatisaparameter?Differentiatebetweenanactualandaformalparameterwithanexample? Example: void change(intb) //bistheformalparameter { b=10; } voidmain() { inta=5; change(a); } Q9. Enlistanyfourjump statementswith theiruses. Ans:(i)goto: A gotostatementcantransferthe programcontrolanywhereintheprogram. anycode inbetween. continue:Abreakstatementenablesaprogramtoforcethenextiterationtotakeplace,skipping anycode inbetween.
1499140907master_card_and_practice_set_cs.docx