Questions And Answers
Define balgorithm b- bcorrect banswers✔✔An balgorithm bis ba bsequence bof bsteps bthat
bcan bbe bfollowed bto bcomplete ba btask.
Explain bdecomposition b- bcorrect banswers✔✔Decomposition bmeans bbreaking ba
bproblem binto ba bnumber bof bsub-problems, bso bthat beach bsubproblem baccomplishes
ban bidentifiable btask, bwhich bmight bitself bbe bfurther bsubdivided.
Define babstraction b- bcorrect banswers✔✔Abstraction bis bthe bprocess bof bremoving
bunnecessary bdetail bfrom ba bproblem.
Define bpseudocode b- bcorrect banswers✔✔Pseudo-code bis ba bsimple bway bof
bdescribing ba bset bof binstructions bin ba bmanner bthat bresembles ba bprogramming
blanguage.
Describe bflowcharts b- bcorrect banswers✔✔A bflowchart bis ba bdiagram bthat bshows ban
boverview bof ban balgorithm. bFlowcharts buse ba bvariety bof bstandard bsymbols bto
brepresent bdifferent belements, band barrows bto bshow bthe bflow bor bdirection. bThese
bsymbols bare bused bto bconstruct bthe bflowchart band bshow bthe bstep-by-step bsolution
bto bthe bproblem.
num b← bUSERINPUT
FOR bnumber b← b1 bTO b10 b
bOUTPUT bnumber b* bnum b
ENDFOR
If bthe buser binputs b7, bwhat bwould bbe bthe b5th bnumber bto bbe boutputted? b- bcorrect
banswers✔✔35
What bdoes ba brectangle brepresent bin bflowcharts? b- bcorrect banswers✔✔Process
What bdoes ba bparallelogram brepresent bin bflowcharts? b- bcorrect
banswers✔✔Input/Output
, What bdoes ba brhombus brepresent bin bflowcharts? b- bcorrect banswers✔✔Decision
What bdoes ban boval brepresent bin bflowcharts? b- bcorrect banswers✔✔Start/End
IF bgame b== bTRUE bTHEN:
bOUTPUT b"Hello!"
ELSE:
bOUTPUT b"Bye!"
(03)
What bshould bbe bwritten bon b(03) b? b- bcorrect banswers✔✔ENDIF
Efficiency blooks... b- bcorrect banswers✔✔at bhow bmuch btime bit btakes bto brun ba
bparticular balgorithm band bhow bmuch bspace bis bneeded.
What bare bthe btwo btypes bof bsearch bmethods byou bneed bto bknow bin bAQA? b-
bcorrect banswers✔✔-linear bsearch
-binary bsearch
What bare bthe btwo btypes bof bsort bmethods byou bneed bto bknow bin bAQA? b- bcorrect
banswers✔✔-bubble bsort
-merge bsort
How bdoes blinear bsearch bwork? b- bcorrect banswers✔✔1. bIdentify ba bsearch bterm.
2. bLook bat bthe bfirst bitem bin bthe blist.
3. bCompare bthe bitem bwith bthe bsearch bterm.
Is bthe bcurrent bitem bthe bsame bas bthe bsearch bterm? bIf bso, bthe bitem bhas bbeen
bfound. bIf bnot, bmove bto bthe bnext bitem.
4. bRepeat bfrom bstep btwo buntil bthe blast bitem bin bthe blist bhas bbeen breached.
5. bIf bthe bend bof bthe blist bhas bbeen breached band bthe bsearch bterm bhas bnot bbeen
bfound, bthen bthe bsearch bterm bis bnot bin bthe blist band bthe balgorithm bcan bstop.
Here bis ba blist: b3, b2, b4, b1, b5
If blinear bsearch bis bused, bhow bmany bsearches bwill bbe bneeded bto bfind bthe bnumber
b1? b- bcorrect banswers✔✔4
How bdoes bbinary bsearch bwork? b- bcorrect banswers✔✔1. bStart bby bsetting bthe
bcounter bto bthe bmiddle bposition bin bthe blist.
2. bIf bthe bvalue bheld bthere bis ba bmatch, bthe bsearch bends.
3. bIf bthe bvalue bat bthe bmidpoint bis bless bthan bthe bvalue bto bbe bfound, bthe blist bis
bdivided bin bhalf, bthe blower bhalf bof bthe blist bis bignored band bthe bsearch bkeeps bto
bthe bupper bhalf bof bthe blist.