You are on page 1of 20
[Programming Paradigms Poneranaru FRenorems Hthal: ig meant by programming paradign 2 A programaing shyte or eQanifcation or the Fentucts hat: progeo ming Gonaschos @® Lome @_Tmeranive @ Onsrer-Onrenreo @ Decrnnerave, Asseneuy Lanausas. Frowrever comune : Bicong Mattie ication ns pw p 4 pt 2 3M oot © 0 O10 Coe ys Maly by 2 vett chift tet 7 2:22 os wb wp wp. b glo 1000400 Case 21 Mallchy by 4 Ft shift + oT nsw 2 bh gp 4 gt oo}! 00 O01 000 =\36 + We con nal” emltigly wth aumbers whidh ace _eot includ im _the _toble vy A_ond © For divide ase Logica shift Right Tweegeert To fM Vacracee Lod _couwr Ine Ace Sro Cane Question 4 (Op code veneer ae ranedeecreaing Load he navbar nw ACE. cect dressing. Load contents of loeton aha ven dest rs rat aoang Te aces ois grea Lond ‘raosed aeressina For he aarss fm +e covers ot ence Roget Copy he cata fs clote ass Ww AC aa iors ersang, Lod he marten WK = Str he comers of AGC ale von ars. co dese adress Fore ares for aaeass +e carers a te noon Pepe Copy De cones Ho ACC is cad ASS 7s aaceas> Aa we contents ce grenades 1 ACE ier [Add te contents of re oper ACE oD. Eas [ceegisce=> | Sanat hom tw conens of he repr ACC od [ai [aadeess> _[ Jump the gro ass ‘aur caaaess> | Comeare a contents ot ACG wie coos aa ee [Compare the covers of ADS wih rarer. sre[aaicany [FORGO an ip ase aNSEN ae Tru |saanseser [Fatwa a compar ratucton jp io a compare was Fate! male ‘wise AND pean oe Sot ACE wi ie epara ‘Braise AND operation of re contre ACC wi corte ot ia Bros XOR opera lh eoriat TAGE wih eran causes? [Biwi XOR operation af contots f ACE wi the cores aasreae re aise OF apraton ab contra of ACE wah i oraand ‘Braise OF operation cite comers of ACC war cote sess can bean absolve 5804 sy ass ne Bis ACC ae sean paces to et. Zre ar ircuced one hand ond Bis in ACC we sie acoso wT Zao ao HvOaaDT on a enna od my Key ea cherie and sets ASC vale HACE or [Out he seen he hci whose ASC vaub saved HAGE. Bo] Res conto te cpwag sto. (2) Apraranmer nee program hat RNS = nay AURE OFS, ‘The pogranmerhes stated wre he progam nto fotowng ae, Te coment olsT, mare exparator rina masng eeyam maruciene ete he progtam using We gen nstucton se Labo comment Opcode| Operand UDO | Nomecn |// 2004 contents of WoER se [aaa |// pester shies to mlciply by « S00 [Menbe | /7 store contents of Aer in ween fm 77 00a program (©) Aproramenr nee a program hat counts he ruber tower cas ters asin, ‘Tm rogranmne as sates mee sera te totowe able Th comment clan arian epananos forte main program ratuesone Compl te program singe pron nrcten set Acie lhe uct ete proies Serve ceoste rae = Laver Comment Sncate| Opera Le | Seetne [77 tose the none alee fro the Ann [ong pctore bovine WD operation vith OE Gp | Manse [ot rn ie pet to ar fw | Wiper [700 rae, jmp to orn 00 | cmt Tre | ace | terse: coor sto | cont LOO | Lenarw pec [Ae STO | tymaree leap [| wO | imam JPN | staRe Question 2. 12 The otowngbeshos pt of marcon st a proces whch has on one pon epaer Accom WCC) au an aa ge ‘Gacose| Oped = cae re ined eadecang Load noe DAE at ates. en cons en a hn ao ‘rec aes Te aos abe ada en eos Lond Tar] caamanan | rd tteang. For atts Fam aes he ars oe rx epee Copy cores cated areas ACE aa Ineeaat a55s5ng Loa re nok 5 | aaacens> | Sw cores ACE a he an ae Tes ares Fom he aes Fm cass «he caso | nx hepa Coby fe cones tom ACC hr eae ease Ta | aan [ ad eer ote gre ase oe ACS Tne | eepiote= [Aad oe conten tbe gtr ACC oS see [ eepiates> | Saeco conan of einer AGO GD. ar aaacess> [amp oe gro sas ‘| casress> | Compe corso AGE wah nso aaa orf Congas corer t ACC we eer are [area Fehonrg wcnper etn jp eateen He coger es Tn Fotowgeenpee stucion ara asoea5> fw cree ns Foe ie AND epwaton contents of ACC whe pean se AND epwaten of core ACL we oes odes ewe XOR owaton ce comers ACC wh eer non | caareas> | Biwee XOR oprah conte ACC wie coos oad cal oie OR operon cones HACC ni owen Bee OR operation cones ACC wi cores oad _aesss crt nase sso sym 088 sn ACC we edn pices we WR Zee we asad co Be Tale bn ACE we wince Dn Pw = yn a chara ad re ASCH vam AGE oor ‘Oupato we scene cara whes ASCH va waxed ACE. ‘A programener writes & wo ibs together and outputs the res. The ror ‘amber restored as ve an ese ‘Te programmer ha sated o we the program in the folowing tate. The comment column cortansexplanabons lor same othe massing Program ntact an ta Comite te program using tegen instucton set ‘abel_| Opeode | Operand ‘Comment Teor: re DD | Nansonle [77 238 the valve from NaWEne ‘gio [Answers [LOD | Comer | 7 tend the valve Foon Comm cup | Ace 7] increnent the Accanslator St9 | Count [een | omer | 7 Sa owen = Comm > few | Loop |// 48 faise, Sup vo 1008 fub0 | Rivsyge | toad the value fron RNER Oar 77 output NISHER to the wereen real 77 end of program (© Te programmer now tarts to wre a propa tat zen sour ogame op nto gn ton wt tat] 23] cpwana Comment Seat: |LOD | Nunc 1 00 fhe = s7o | Weaker 2 NaS: [Beer 7/ show value of mask in binary here Sorve Quastrows Fao Fite Question 22 Question 34 Faow Fite Oustion 9 Dusstion 1b JOuestion 18 Qustion 20 Quetion 25° Question 36 Tercactrve Whal is eéort- by Topeative + A sequence of steps that: change the stoke of the proqe. + The skeps are in order they shold be conied ote PF seapee or aus ee Genge me styas or ee prope + Tre sleps are_in order they should be coniel owt + eq _procedurok preqcowning LSet tre prazromn into moduhes + which are _gubroukines Note: Frogans written using the imperative pacadign moy be smaller ond take fess ime bo excerke This is becouse thee are Rewer tnshuclions and teas storage is requicod For the compiled object code. Nenpecalive proyarning works weil For grail ond singe progam Plogcoms wiitter usiog this meltadslagy can be easier for_dhers to cond ond undedeal Oescer- Onrewren - Ronnanmernes Whol is meant by objec osien ed peoyeorwniog ? 7 Amore. orqonged woy of proyomming, } +The data ook the Rando thok beloms to sinfle nbity can be gute uty single O@yect Kcousses Lowte sTuoent| «Goch objed hulds its epecfe infarmallion sTuoent| Mone, conlodé , email age , fathers nome ATTRIBUTES Engiog Cea) 5 Ruto/Macueh f \onbee Poke Nee Stats Ro _gbjeck not only contoins adtribules bul ales some adions + Tose actions ace basi cally Pundions - known os Method which defines Are methods. ond alkcibukes of ond alkcibukes of a cettoin type of dyuks CLASS, obrEct Methods, Aitsibekes \S Functions , Faceduce - voridh\es,, Constant Marc. Pattiog the dato (aktidutes) and methods together a single uait ( cus) we cobled ErucAosurrrton Feeruses Or Osseer Oarowren Ronaamnrctt + Ieheritance, + Raiarphsen Coatonwent | agycgthion Twvcarmuce s on mm Pact Tione EempSoye Fallfime employee, 4a a of 8 Some Pepertion raat Fonction € and Funckions ave Faction Poor, ‘opocMed Peery € Now Fu deve other Souurion Dosen Fioer tnls PRRONT AAS Whol is meaot by Tehaitooce 2 Fic doived + Is hey methods of redefined Far decived eDasros Ona bing is when a meth is defined ovorc than one no clin so it con he used in diferent: sihedtian Conrarumene oan seroplane 8 Z — = fain oe coat pea = ONE oBjecr Gehan Dice Thasiteace, Ciccle_onS redone were shone tromber of things inte 0 usler’ Whak is meant_by Containment 2 + A Qos clude on instance ot onther clas +g gregebion |. the contained object can evist oubside of sts super cow - Obj is dotrayed when supe Dow 1s destroyed Encapslbion Rieke f Public Inhesitonce. Methods Featuaes Os 00° Methods r Features Oe 00° Ropecties, ICPoanes Po lymorphisen Serngs : Is 0 methal uyed to conti? cherges to any varichle tak to declored within og object. When a vericble is decloved os erwdt, only the setters dedlarce con be ved to make chory es Gesras, Iso wethal thor gels the wHue of 0 property Aan _objod- Enlbio how get ond sch wethads ore usel to support secatity ond integetty 2 + Used to choage the properties tha ore set to private + by only wing get/set methods + Provide facapubchion « Prevents scridenth domage + Vo make sure dato 13 vais a Hide dbo |. Fe qd_methol Mow tte doke ty be cetumed Tre set method tow the dle to be changed, Rewsscone O- OOP - Deficing a_ SORES | 04 emsnomtaonanm . } Fats 05 SBEEEGBEERLD 06 SEEGER) 07 SSzENEEEERRE) 08 sport (vottevbalty 09 plays Gin, SGESER 10 phays(stetti, cricket). 2 URLS EEE 12 WHAMRBELpIay (Pradeep, EXERC). “Those clauses have the following meanings: Clause Meaning 01 | Jessica @ person 05 | Footballis a sport 09 | Johann plays football 12 | Pradoop refuses to play cricket (@) heise person wo pays agby bu eis to lay hacky Wit adonal dass to represent is infomation. as posse £M Ds... ua sacl {esta ss Ploy Ceme.__,sagby).- re Mi Art Ply Cee, hockey). (©) Wte the result etumed by the goa plays (%, footbait) « ngohonn. Jesse... ° ee Yeon Wie this a8 a ne. re porsen OY), AND, speck Cx), Ano wot {estat psy C4,x) > Fino Tue Mastawe co) Z should be gmah m [Question 2 '_Adedlarative programming language is used 1 represent he folowing Krowedge base. (aged) imeghan, spain). “These clauses have the folowing meanings: Clause Meaning Deeraj is a person 05 | Englands a country 11 | Willam has visited Spain (2) Gina's a person who has visited Cyprus. tes stata does pen i een we persen (gira). « re Ceeateg Coypas) « vested C gira Rr) ‘. ia 6 te rn aed by on x= waion , deeco}, pine. a (0) Prigt isc Pisa person Cis acon and Phas ted ia ost poser (PY. ARQ ceonky (C) Amd wor Conites (CY) ua Qustion 3 A ecaratve language is used to represent facts and rules about tights. ‘These clauses have the folowing meaning Clause Explanation hy Jet operates fights o Pas. Ts possible oy tom Xio Vil fight rom Z10 (8) More tacts need o be included “Ther crac ight om London to « dicod Corder , come.) vs Ries (rome, beitish gir), () Using the variable 0, the goal f stuns ies(@, fly jet) ‘Write the result returned bythe goa! (©) Useire ns» salgbeory “Ther a dect eve rom Edabuoh te Pars tore Grocfght Wom Xo Zand a vec and Bish Ai tes to Rome. faible to wit te goalto find where you can fy direct rom Glasgow, dbired:.( sfesjou..M) Wie a rule to represent tis contin, fies, on Plies. (@) State what the folowing goa returns YEs. n aifine fles o an airport, that atin aso fles every rect route out ofthat airport. (1x) ann Seok (2) afarer Rhee Polaa be Poor a 21 3) a

You might also like