0% found this document useful (0 votes)
16 views

COMP 002 - Reviewer - Programming Concepts

Reviewer

Uploaded by

jisoo0186
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

COMP 002 - Reviewer - Programming Concepts

Reviewer

Uploaded by

jisoo0186
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

‭COMP 002 Reviewer: Programming Concepts‬ ‭COMP 002‬

‭IBITS Year 17 | A.Y. 2023-2024 First Semester Midterms‬

‭OVERVIEW OF COMPUTER HARDWARE AND SOFTWARE‬ ‭PROGRAM AND PROGRAMMING‬

‭●‬ ‭ hat is a Computer?‬


W ‭●‬ ‭ ‬ ‭computer‬ ‭i s ‬ ‭a ‬ ‭tool ‬ ‭u s ed‬ ‭for‬ ‭p roces s i ng‬ ‭d a ta ‬ ‭i nto‬
A
‭○‬ ‭A‬ ‭computer‬ ‭i s ‬ ‭a n‬ ‭e l ectroni c‬ ‭d evi ce‬‭tha t‬‭a ccepts ‬‭d a ta ‬ ‭i nforma tion.‬
‭from‬ ‭the‬ ‭u s er,‬ ‭p roces s es ‬ ‭i t,‬ ‭p roduces ‬ ‭res ul ts ,‬ ‭●‬ ‭A‬ ‭s et‬ ‭o f‬ ‭d eta i l ed‬ ‭s tep-by-s tep‬ ‭i ns tructions ‬ ‭control s ‬ ‭the‬
‭d i s pl a ys ‬ ‭them‬ ‭to‬ ‭the‬ ‭u s ers ,‬ ‭a nd‬ ‭s tores ‬ ‭the‬ ‭res ul ts ‬ ‭p roces s i ng.‬ ‭The‬ ‭l i s t‬ ‭o f‬ ‭i ns tructions ‬ ‭tha t‬ ‭the‬ ‭computer‬
‭for future us a ge.‬ ‭m us t‬ ‭fol l ow‬ ‭to‬ ‭b e‬ ‭a bl e‬ ‭to‬ ‭p roces s ‬ ‭d a ta ‬ ‭i nto‬ ‭i nforma tion‬
‭i s ca l l ed a progra m or s oftwa re.‬
‭●‬ ‭ ardware Components?‬
H ‭●‬ ‭Thes e‬ ‭i ns tructions ‬ ‭cons i s t‬ ‭o f‬ ‭s ta tements ‬ ‭w ri tten‬ ‭i n‬ ‭a ‬
‭○‬ ‭Computer‬ ‭h a rdwa re‬ ‭i s ‬ ‭a ‬ ‭col l ection‬ ‭o f‬ ‭s evera l ‬ ‭s peci fic progra mmi ng l a ngua ge.‬
‭components ‬ ‭w orki ng‬ ‭together.‬ ‭S ome‬ ‭p a rts ‬ ‭a re‬ ‭●‬ ‭When‬ ‭a ‬ ‭p rogra m‬ ‭i s ‬ ‭w ri tten.‬ ‭We‬ ‭a re‬ ‭b a s i ca l l y‬ ‭s ol vi ng‬ ‭a ‬
‭e s s entia l ‬ ‭a nd‬ ‭o thers ‬ ‭a re‬ ‭a dded‬ ‭a dva nta ges .‬ ‭p robl em.‬ ‭To‬ ‭s ol ve‬ ‭a ‬ ‭p robl em,‬ ‭w e‬ ‭m us t‬ ‭u s e‬ ‭o ur‬ ‭m i nd‬
‭Computer‬ ‭h a rdwa re‬ ‭i s ‬ ‭m a de‬ ‭u p‬ ‭o f‬ ‭CPU‬ ‭a nd‬ ‭p ower or l ogi c to devel op deta i l ed i ns tructions .‬
‭p eri phera l s .‬
‭PROGRAM LIFE CYCLE‬
‭●‬ ‭ hat is software?‬
W
‭○‬ ‭A‬ ‭s et‬ ‭o f‬ ‭i ns tructions ‬ ‭tha t‬ ‭d ri ves ‬ ‭the‬ ‭computer‬ ‭to‬ ‭d o‬
‭●‬ ‭ rogram/Problem Definition‬
P
‭s tipul a ted‬ ‭ta s ks ‬ ‭i s ‬ ‭ca l l ed‬ ‭a ‬ ‭p rogra m.‬ ‭S oftwa re‬
‭○‬ ‭There‬ ‭s houl d‬ ‭b e‬ ‭a ‬ ‭cl ea r‬ ‭u nders ta ndi ng‬ ‭o f‬ ‭the‬
‭i ns tructions ‬ ‭a re‬ ‭p rogra mmed‬ ‭i n‬ ‭a ‬ ‭computer‬
‭p robl em‬
‭l a ngua ge,‬ ‭tra ns l a ted‬ ‭i nto‬ ‭m a chi ne‬ ‭l a ngua ge,‬ ‭a nd‬
‭○‬ ‭Know‬ ‭the‬ ‭o bjectives ‬ ‭a nd‬ ‭i dentify‬ ‭the‬ ‭u s ers ‬ ‭o f‬ ‭the‬
‭e xecuted‬ ‭b y‬ ‭a ‬ ‭computer.‬ ‭The‬ ‭s oftwa re‬ ‭ca n‬ ‭b e‬ ‭p rogra m‬ ‭then‬ ‭k now‬ ‭the‬ ‭requi rements ‬ ‭tha t‬ ‭n eed‬ ‭to‬
‭ca tegori zed i nto two types :‬ ‭b e‬ ‭ful fil l ed‬ ‭b y‬ ‭the‬ ‭p rogra m‬ ‭s uch‬ ‭a s ‬ ‭the‬ ‭i nput,‬
‭p roces s ,‬ ‭a nd‬ ‭o utput‬‭requi rements .‬‭Mos t‬‭i mporta ntl y,‬
‭■‬ S‭ ystem‬ ‭Software‬‭:‬ ‭A‬ ‭s et‬ ‭o f‬ ‭p rogra ms ‬ ‭to‬ ‭control ‬ ‭k now‬ ‭i f‬‭the‬‭p rogra m‬‭i s ‬‭fea s i bl e‬‭to‬‭i mpl ement.‬‭La s tl y,‬
‭a nd‬ ‭m a na ge‬ ‭the‬ ‭o pera tions ‬ ‭o f‬ ‭a ‬ ‭computer‬ ‭from‬
‭d ocument the a na l ys i s .‬
‭runni ng‬ ‭e s s entia l ‬ ‭p rogra ms ‬ ‭to‬ ‭runni ng‬ ‭a nd‬
‭u til i zi ng‬ ‭the‬ ‭h a rdwa re‬ ‭to‬ ‭runni ng‬ ‭the‬ ‭s oftwa re‬
‭●‬ ‭ rogram Design‬
P
‭w e‬ ‭w a nt‬ ‭to‬ ‭u s e.‬ ‭Al s o‬ ‭ca l l ed,‬ ‭G enera l ‬ ‭Purpos e‬
‭○‬ ‭D etermi ni ng‬ ‭the‬ ‭p rogra m‬ ‭l ogi c‬ ‭through‬ ‭the‬ ‭u s e‬ ‭o f‬ ‭a ‬
‭S oftwa re.‬ ‭top-down‬ ‭a pproa ch,‬ ‭m odul a ri za tion,‬ ‭a nd‬ ‭h i era rchy‬
‭■‬ ‭Types of System Software‬‭:‬
‭cha rts .‬
‭●‬ ‭Operating System‬
‭○‬ ‭Ma ke us e of ps eudo-code or flowcha rts ‬
‭○‬ ‭Mi cros oft Wi ndows ‬ ‭○‬ ‭Conduct‬ ‭s tructura l ‬ ‭w a l kthroughs ‬ ‭w i th‬ ‭o ther‬
‭○‬ ‭Li nux‬
‭p rogra mmers ,‬ ‭to‬ ‭u nders ta nd‬ ‭m ore‬ ‭h ow‬ ‭the‬ ‭p rogra m‬
‭○‬ ‭Ma cOS‬ ‭o r‬ ‭s ys tem‬ ‭w i l l ‬ ‭w ork‬ ‭o r‬ ‭i n‬ ‭o ther‬ ‭w ords ‬ ‭s ys tem‬
‭●‬ ‭Utility Programs‬ ‭a na l yzi ng.‬
‭○‬ ‭Antivi rus ‬
‭○‬ ‭F i l e Compres s i on‬ ‭●‬ ‭ rogram Coding‬
P
‭●‬ ‭D evice Drivers‬ ‭○‬ ‭Tra ns l a tes ‬ ‭the‬ ‭l ogi c‬ ‭o f‬ ‭the‬ ‭p rogra m‬ ‭b a s ed‬ ‭o n‬ ‭the‬
‭○‬ ‭Moni tor Dri ver‬ ‭a l gori thm‬ ‭o r‬‭flowcha rt‬‭i nto‬‭a ‬‭h i gh-l evel ‬‭p rogra mmi ng‬
‭○‬ ‭Pri nter Dri ver‬
‭l a ngua ge.‬
‭○‬ ‭D etermi ne‬ ‭the‬ ‭p rogra mmi ng‬ ‭l a ngua ge‬ ‭to‬ ‭u s e‬ ‭a nd‬
‭■‬ ‭ pplication‬ ‭Software‬‭:‬ ‭Us ed‬ ‭to‬ ‭p erform‬ ‭va ri ous ‬
A
‭code i t i n tha t s peci fic l a ngua ge‬
‭a ppl i ca tions ‬ ‭o n‬ ‭the‬ ‭computer.‬ ‭Performs ‬ ‭a ‬
‭s peci fic‬‭ta s k‬‭to‬‭b e‬‭a ‬‭tool ‬‭for‬‭u s ers ‬‭to‬‭u s e‬‭to‬‭e a s e‬
‭●‬ ‭ rogram Testing‬
P
‭the ta s k.‬
‭○‬ ‭To‬ ‭tes t‬ ‭the‬ ‭p rogra m‬ ‭for‬ ‭p robl ems ‬ ‭through‬ ‭the‬
‭●‬ ‭Word Proces s or l i ke M.S WORD‬
‭p roces s ‬ ‭o f‬ ‭D ebuggi ng.‬ ‭D ebuggi ng‬ ‭m ea ns ‬ ‭d etecting,‬
‭●‬ ‭Vi deo Edi tor l i ke Ca pCut‬
‭l oca ting,‬ ‭a nd‬ ‭removi ng‬ ‭computer‬ ‭p rogra m‬ ‭e rrors ‬ ‭b y‬
‭●‬ ‭B rows er l i ke Chrome‬ ‭d es k checki ng or runni ng rea l da ta .‬

‭C OMP 002: Computer Programming‬ ‭Programming Concepts‬ ‭1 ‬


‭COMP 002 Reviewer: Programming Concepts‬ ‭COMP 002‬

‭IBITS Year 17 | A.Y. 2023-2024 First Semester Midterms‬

‭●‬ ‭ rogram Documentation‬


P ‭■‬ S‭ election‬‭:‬ ‭One‬ ‭o f‬ ‭s evera l ‬ ‭a l terna tive‬ ‭a ctions ‬ ‭i s ‬
‭○‬ ‭Us er Documenta tion‬ ‭s el ected‬ ‭a nd‬ ‭e xecuted.‬ ‭I t‬ ‭i nvol ves ‬ ‭the‬ ‭u s e‬ ‭o f‬
‭○‬ ‭The‬ ‭m a nua l ‬ ‭tha t‬ ‭i s ‬ ‭p repa red‬ ‭to‬ ‭h el p‬ ‭the‬ ‭u s er‬ ‭d eci s i ons ‬ ‭b a s ed‬ ‭o n‬ ‭the‬ ‭gi ven‬ ‭condi tion.‬ ‭I t‬ ‭u s es ‬
‭u s e the progra m‬ ‭a ‬ ‭d eci s i on‬ ‭b l ock‬ ‭o r‬ ‭a ‬ ‭d i a mond-s ha ped‬ ‭b l ock.‬
‭○‬ ‭Opera tor Documenta tion‬ ‭Al terna tive‬ ‭a ction‬ ‭w i l l ‬ ‭b e‬ ‭repres ented‬ ‭b y‬ ‭a ‬
‭○‬ ‭The‬ ‭m a nua l ‬ ‭i s ‬ ‭u s ed‬ ‭to‬ ‭gi ve‬ ‭the‬ ‭computer‬ ‭p roces s i ng bl ock.‬
‭o pera tor‬ ‭i nforma tion‬ ‭o n‬ ‭w ha t‬ ‭to‬ ‭d o‬ ‭w hen‬ ‭the‬ ‭■‬ ‭Repetition‬‭:‬ ‭One‬ ‭o r‬ ‭m ore‬ ‭s teps ‬ ‭i s ‬ ‭p erformed‬
‭p rogra m fla s hes a n error mes s a ge‬ ‭repea tedl y.‬
‭○‬ ‭Progra m Documenta tion‬
‭○‬ ‭The‬ ‭d ocumenta tion‬ ‭i nvol ves ‬ ‭tes ting‬ ‭e ntire‬ ‭ALGORITHM‬
‭p rogra ms ‬ ‭to‬ ‭tra i n‬ ‭n ew‬ ‭p rogra mmers ‬ ‭i n‬
‭m a i nta i ni ng‬ ‭the‬ ‭s ys tem,‬ ‭e ns uri ng‬ ‭i t‬ ‭rema i ns ‬ ‭●‬ ‭ n‬ ‭algorithm‬ ‭i s ‬ ‭a ‬ ‭s et‬ ‭o r‬ ‭s eri es ‬ ‭o f‬ ‭i ns tructions ‬ ‭for‬‭ca rryi ng‬
A
‭e rror-free a nd up-to-da te.‬ ‭o ut‬ ‭a ‬ ‭ta s k.‬ ‭I t‬ ‭i s ‬‭a l s o‬‭a ‬‭p rocedure‬‭to‬‭p roduce‬‭the‬‭requi red‬
‭o utput‬ ‭from‬ ‭the‬ ‭gi ven‬ ‭i nput.‬ ‭I t‬ ‭i s ‬ ‭s i mi l a r‬ ‭to‬ ‭a ‬ ‭p a ra gra ph‬
‭●‬ ‭ rogram Maintenance‬
P ‭tha t‬ ‭e xpres s es ‬ ‭a ‬ ‭s i ngl e‬ ‭thought.‬ ‭I t‬ ‭u s es ‬ ‭the‬ ‭Engl i s h‬
‭○‬ ‭Provi de Educa tion a nd s upport to end us ers ‬ ‭l a ngua ge. It i s a l s o known a s ps eudo code.‬
‭○‬ ‭Correct a ny una ntici pa ted errors tha t emerge‬
‭○‬ ‭I dentify‬ ‭u s er-reques ted‬ ‭e nha ncements ,‬ ‭o nce‬ ‭e rrors ‬ ‭●‬ ‭ lgorithm Development‬
A
‭o r‬ ‭e nha ncements ‬ ‭a re‬ ‭i dentified,‬ ‭the‬ ‭p rogra m‬ ‭○‬ ‭The‬ ‭s teps ‬ ‭tha t‬ ‭compri s e‬ ‭a n‬ ‭a l gori thm‬ ‭a re‬ ‭s i mi l a r‬‭to‬
‭d evel opment l i fe cycl e begi ns a ga i n a t s tep 1‬ ‭a ‬ ‭flowcha rt.‬ ‭I t‬ ‭m us t‬ ‭b e‬ ‭o rga ni zed‬ ‭i n‬ ‭a n‬ ‭o rderl y,‬
‭u nders ta nda bl e,‬ ‭a nd‬ ‭cl ea r‬ ‭m a nner‬ ‭s o‬ ‭tha t‬ ‭the‬
‭PROGRAM LOGIC FORMULATION‬ ‭p rogra m‬ ‭tha t‬ ‭i mpl ements ‬ ‭thi s ‬ ‭a l gori thm‬ ‭i s ‬‭s i mi l a rl y‬
‭o rderl y,‬ ‭u nders ta nda bl e,‬ ‭a nd‬ ‭cl ea r.‬ ‭The‬ ‭three‬ ‭b a s i c‬
‭●‬ ‭ evel opi ng‬ ‭a ‬ ‭s ol ution‬ ‭for‬ ‭a ‬ ‭p robl em‬ ‭i n‬ ‭computer‬
D ‭m ethods ‬‭o f‬‭control ‬‭u s ed‬‭i n‬‭a ‬‭s tructured‬‭flowcha rt‬‭a re‬
‭p rogra mmi ng‬ ‭i nvol ves ‬ ‭crea ting‬ ‭a ‬ ‭s tep-by-s tep‬ ‭p rogra m‬ ‭a l s o a ppl i ca bl e to s tructured a l gori thms .‬
‭l ogi c.‬ ‭Tra ns l a ting‬ ‭thi s ‬ ‭l ogi c‬ ‭i nto‬ ‭l a ngua ges ‬ ‭l i ke‬ ‭C‬ ‭i s ‬
‭routine.‬ ‭Thi s ‬ ‭w orkbook‬ ‭gui des ‬ ‭you‬ ‭through‬ ‭the‬ ‭p roces s ,‬ ‭ .‬
1 S‭ equentia l ‬
‭e mpha s i zi ng C-ba s ed a l gori thm devel opment.‬ ‭2.‬ ‭S el ection‬
‭●‬ ‭There‬ ‭a re‬ ‭two‬ ‭m os t‬ ‭u s ed‬ ‭tool s ‬ ‭tha t‬ ‭w i l l ‬‭b e‬‭o f‬‭grea t‬‭h el p‬ ‭3.‬ ‭R epetition‬
‭for‬ ‭you‬ ‭to‬ ‭formul a te‬ ‭a ‬ ‭b etter‬ ‭s ol ution.‬ ‭Thes e‬ ‭a re‬ ‭the‬
‭flowcha rt a nd a l gori thm.‬ ‭●‬ ‭ seudocode‬ ‭i s ‬ ‭a ‬ ‭m i xture‬ ‭o f‬ ‭l a ngua ge‬ ‭a nd‬ ‭s ymbol s ,‬ ‭terms ‬
P
‭a nd‬ ‭o ther‬ ‭fea tures ‬ ‭commonl y‬ ‭u s ed‬ ‭i n‬ ‭o ne‬ ‭o r‬ ‭m ore‬
‭h i gh-l evel ‬‭l a ngua ges .‬‭H i gh-l evel ‬‭l a ngua ges ‬‭a re‬‭p rogra ms ‬
‭F LOWCHART‬
‭u s ed‬ ‭b y‬ ‭the‬ ‭computer.‬ ‭Typi ca l l y,‬ ‭the‬ ‭common‬ ‭fea tures ‬ ‭o f‬
‭va ri ous ‬ ‭p s eudo‬ ‭codes ‬ ‭tha t‬ ‭a ppea r‬ ‭i n‬ ‭textbook‬ ‭a re‬ ‭the‬
‭●‬ T‭ ypes of Flowcharts‬
‭○‬ ‭S ys tem Fl owcha rt‬ ‭fol l owi ng:‬
‭○‬ ‭Progra m Fl owcha rt‬
‭1.‬ T‭ he‬ ‭u s ua l ‬ ‭computer‬ ‭s ymbol s ‬ ‭a re‬ ‭u s ed‬ ‭for‬
‭a ri thmetic‬ ‭o pera tions :‬ ‭“+”‬ ‭for‬ ‭a ddi tion,‬ ‭“-“‬ ‭for‬
‭●‬ F‭ lowchart Development‬
‭s ubtra ction,‬ ‭“*”‬ ‭for‬ ‭m ul tipl i ca tion,‬ ‭a nd‬ ‭“/”‬ ‭for‬
‭○‬ ‭Orga ni zi ng‬ ‭the‬ ‭s teps ‬ ‭i n‬ ‭a ‬ ‭flowcha rt‬ ‭i s ‬ ‭cruci a l ‬ ‭for‬ ‭a n‬
‭o rderl y‬ ‭a nd‬ ‭cl ea r‬ ‭p rogra m‬ ‭i mpl ementa tion.‬ ‭Thi s ‬ ‭d i vi s i on.‬
‭s tructured‬ ‭a pproa ch,‬ ‭k nown‬ ‭a s ‬ ‭a ‬ ‭S tructured‬ ‭2.‬ ‭S ymbol i c‬ ‭n a mes ‬ ‭( i dentifiers )‬ ‭a re‬ ‭u s ed‬ ‭to‬
‭F l owcha rt,‬ ‭e mpl oys ‬ ‭three‬ ‭funda menta l ‬ ‭control ‬ ‭repres ent‬ ‭q ua ntities ‬ ‭b ei ng‬ ‭p roces s ed‬ ‭b y‬ ‭the‬
‭m ethods ‬ ‭to‬ ‭e ns ure‬ ‭cl a ri ty‬ ‭a nd‬ ‭correctnes s ‬ ‭i n‬ ‭a l gori thm.‬
‭3.‬ ‭Certa i n‬ ‭k eywords ‬ ‭tha t‬ ‭a re‬ ‭common‬‭i n‬‭h i gh-l evel ‬
‭p rogra m des i gn.‬
‭l a ngua ge‬ ‭m a y‬ ‭b e‬ ‭u s ed,‬ ‭for‬ ‭e xa mpl e,‬ ‭rea d‬ ‭o r‬
‭■‬ S‭ equential‬‭:‬ ‭s teps ‬ ‭a re‬ ‭p erformed‬ ‭i n‬ ‭a ‬ ‭s tri ctl y‬ ‭e nter‬ ‭to‬ ‭i ndi ca te‬ ‭i nput‬ ‭o pera tion;‬ ‭d i s pl a y,‬‭p ri nt,‬
‭a nd wri te for output opera tions .‬
‭s equentia l ‬ ‭m a nner;‬ ‭e a ch‬ ‭s tep‬ ‭b ei ng‬ ‭e xecuted‬
‭4.‬ ‭I ndenta tion‬ ‭i s ‬ ‭u s ed‬ ‭to‬ ‭s et‬ ‭o ff‬ ‭certa i n‬‭k ey‬‭b l ocks ‬
‭e xa ctl y‬ ‭o nce.‬ ‭Thi s ‬ ‭i s ‬ ‭the‬ ‭s i mpl es t‬ ‭m ethod‬ ‭o f‬
‭control . It i s ea s y to devel op a nd unders ta nd.‬ ‭o f i ns tructions .‬

‭C OMP 002: Computer Programming‬ ‭Programming Concepts‬ ‭2 ‬


‭COMP 002 Reviewer: Programming Concepts‬ ‭COMP 002‬

‭IBITS Year 17 | A.Y. 2023-2024 First Semester Midterms‬

‭SAMPLE PROBLEM WITH FLOWCHART AND PSEUDOCODE‬ ‭●‬ ‭F LOWCHART‬

‭PROBLEM #1‬

‭D es i gn‬ ‭a ‬ ‭C‬ ‭Progra m‬ ‭tha t‬ ‭w i l l ‬ ‭ta ke‬ ‭a n‬ ‭i nput‬ ‭time‬ ‭i n‬


S‭ econds ‬ ‭a nd‬ ‭convert‬ ‭i t‬ ‭i nto‬ ‭H ours ,‬ ‭Mi nutes ,‬ ‭a nd‬ ‭S econds ‬
‭forma t (HH:MM:SS).‬

‭●‬ ‭PSEUDOCODE‬

‭ LGORITHM‬‭S ECONDS‬
A
‭s ec←0 times ec←0 timemi n←0 timehr←0‬
‭OUTPUT “Pl ea s e enter the number of s econd/s : ”‬
‭I NPUT s ec‬
‭timehr ← s ec / 3600‬
‭timemi n ← (s ec % 3600) / 60‬
‭times ec ← (s ec % 3600) % 60‬
‭OUTPUT “Hour/s : ”, timehr‬
‭OUTPUT “Mi nute/s : ”, timemi n‬
‭OUTPUT “Second/s : ”, time s ec‬
‭OUTPUT “The time i s ”,timehr,“:”,timemi n,“:”,times ec“.”‬
‭END‬‭S ECONDS‬

‭*‬‭you can omit the Escape sequences (\t, \n, etc.)‬

‭C OMP 002: Computer Programming‬ ‭Programming Concepts‬ ‭3 ‬

You might also like