0% found this document useful (0 votes)
404 views10 pages

CSP Unit 3

The document is a quiz for AP Computer Science Principles Unit 3, covering topics such as programming languages, algorithms, and Boolean expressions. It includes multiple-choice questions that assess understanding of key concepts in programming and computer science. Explanations for each question provide insights into the correct answers and the reasoning behind them.

Uploaded by

Bhuvi Irigi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
404 views10 pages

CSP Unit 3

The document is a quiz for AP Computer Science Principles Unit 3, covering topics such as programming languages, algorithms, and Boolean expressions. It includes multiple-choice questions that assess understanding of key concepts in programming and computer science. Explanations for each question provide insights into the correct answers and the reasoning behind them.

Uploaded by

Bhuvi Irigi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

AP‌‌Computer‌‌Science‌‌Principles‌‌Unit‌‌3‌‌Quiz‌

1. What‌‌distinguishes‌‌programming‌‌languages‌‌from‌‌spoken‌‌languages?‌
a. There‌‌are‌‌a‌‌lot‌‌of‌‌people‌‌who‌‌speak‌‌programming‌‌languages.‌
b. There‌‌is‌‌only‌‌one‌‌programming‌‌language,‌‌but‌‌there‌‌are‌‌several‌‌different‌‌spoken‌
languages.‌
c. Both‌‌spoken‌‌and‌‌programming‌‌languages‌‌are‌‌the‌‌same.‌
d. Spoken‌‌languages‌‌are‌‌harder‌‌to‌‌comprehend.‌

2. An‌‌algorithm‌‌is‌‌defined‌‌as….‌
a. A‌‌precise‌‌sequence‌‌of‌‌instructions‌‌for‌‌processes‌‌that‌‌can‌‌be‌‌executed‌‌by‌‌a‌‌computer‌
b. A‌‌step-by-step‌‌procedure‌‌for‌‌scientific‌‌calculations‌
c. A‌‌procedure‌‌for‌‌finding‌‌the‌‌greatest‌‌common‌‌divisor‌‌of‌‌two‌‌numbers‌
d. A‌‌a‌‌set‌‌of‌‌rules‌‌to‌‌follow‌‌in‌‌a‌‌household‌

3. What‌‌are‌‌the‌‌building‌‌blocks‌‌of‌‌an‌‌algorithm?‌
a. Sequencing‌
b. Sequencing‌‌and‌‌selection‌
c. Selection‌
d. ‌Iteration‌
e. ‌Iteration‌‌and‌‌Selection‌
f. Iteration‌‌and‌‌Sequencing‌
g. ‌None‌‌of‌‌the‌‌above‌
h. Sequencing‌‌and‌‌selection‌‌and‌‌iteration.‌
4. John‌‌B‌‌created‌‌a‌‌very‌‌simple‌‌algorithm‌‌for‌‌eating‌‌breakfast‌‌cereal‌‌everyday.‌‌In‌‌his‌
algorithm‌‌he‌‌included‌‌the‌‌steps:‌‌‌put‌‌cereal‌‌in‌‌a‌‌bowl.‌‌add‌‌milk‌‌to‌‌cereal,‌‌eat‌‌cereal,‌‌wash‌
bowl.‌‌What‌‌building‌‌blocks‌‌did‌‌he‌‌use?‌
a. Sequencing‌ ‌and‌‌selection‌
b. Selection‌
c. ‌Iteration‌
d. Sequencing‌
e. Iteration‌‌and‌‌Sequencing‌
f. Sequencing‌‌and‌‌selection‌‌and‌‌iteration.‌
g. ‌None‌‌of‌‌the‌‌above‌
h. ‌Iteration‌‌and‌‌Selection‌

5. What‌‌building‌‌block‌‌is‌‌being‌‌utilized‌‌in‌‌the‌‌following‌‌function?‌

a. Selection‌
b. ‌Iteration‌
c. Sequencing‌
d. Iteration‌‌and‌‌Sequencing‌
e. Sequencing‌‌and‌‌selection‌‌and‌‌iteration.‌
6. When‌‌naming‌‌functions,‌‌what‌‌should‌‌you‌‌consider?‌
a.‌‌The‌‌name‌‌of‌‌a‌‌function‌‌should‌‌specify‌‌how‌‌long‌‌it‌‌takes‌‌to‌‌run.‌
b.‌‌A‌‌function‌‌name‌‌should‌‌be‌‌appealing‌‌to‌‌the‌‌eye.‌
c.‌‌The‌‌name‌‌of‌‌a‌‌function‌‌should‌‌be‌‌as‌‌descriptive‌‌as‌‌possible‌‌to‌‌reflect‌‌what‌‌it‌
does.‌
d.‌‌The‌‌names‌‌of‌‌two‌‌functions‌‌with‌‌identical‌‌purposes‌‌should‌‌be‌‌the‌‌same.‌
f.‌‌Functions‌‌must‌‌be‌‌listed‌‌in‌‌alphabetical‌‌order.‌

7. In‌‌programming,‌‌an‌‌expression‌‌that‌‌evaluates‌‌to‌‌true‌‌or‌‌false‌‌is...‌
a.‌‌Expression‌‌with‌‌Variables‌
b.‌‌Mathematical‌‌Expression‌
c.‌‌Overarching‌‌Expression‌
d.‌‌Boolean‌‌Expression‌


8. You're‌‌working‌‌on‌‌a‌‌code‌‌project‌‌and‌‌want‌‌to‌‌use‌‌a‌‌piece‌‌of‌‌code‌‌your‌‌friend‌‌had‌‌written‌
in‌‌your‌‌program.‌‌What‌‌is‌‌the‌‌most‌‌basic‌‌method‌‌your‌‌friend‌‌could‌‌have‌‌written‌‌the‌‌code‌‌to‌
make‌‌it‌‌easier‌‌for‌‌you‌‌to‌‌make‌‌modifications‌‌later?‌
a.‌‌Attach‌‌a‌‌list‌‌of‌‌project‌‌requirements‌
b.‌‌Create‌‌a‌‌video‌‌illustrating‌‌the‌‌project´s‌‌interface‌‌and‌‌functionality‌
c.‌‌Use‌‌procedure‌‌and‌‌variable‌‌names‌‌that‌‌describe‌‌their‌‌content‌‌and‌‌capabilities‌
d.‌‌Make‌‌a‌‌blog‌‌about‌‌the‌‌different‌‌programming‌‌concepts‌‌that‌‌were‌‌used‌‌in‌‌the‌
project‌
9. In‌‌some‌‌programming‌‌languages,‌‌constants‌‌(a‌‌value‌‌or‌‌variable‌‌that‌‌is‌‌not‌‌changed‌‌by‌‌the‌
program‌‌throughout‌‌execution)‌‌are‌‌implemented.‌‌Which‌‌of‌‌the‌‌following‌‌is‌‌a‌‌valid‌
argument‌‌for‌‌using‌‌a‌‌constant?‌

I. To‌‌represent‌‌mathematical‌‌concepts‌‌like‌‌Pi,‌‌Apéry's‌‌constant,‌‌a‌ nd‌‌Belphegor's‌‌
prime‌‌number‌
II. To‌‌represent‌‌fixed‌‌values‌‌like‌‌the‌‌number‌‌of‌‌hours‌‌in‌‌a‌‌day‌
III. To‌‌represent‌‌the‌‌score‌‌of‌‌a‌‌lacrosse‌‌game‌

a.‌‌II‌‌only‌
b.‌‌I‌‌and‌‌III‌‌only‌
c.‌‌II‌‌and‌‌III‌‌only‌
d.‌‌I‌‌and‌‌II‌ ‌only‌
e.‌‌I,‌‌II‌‌and‌‌III‌

10. Knowing‌‌how‌‌to‌‌operate‌‌the‌‌lawn‌‌mower‌‌without‌‌knowing‌‌every‌‌piece‌‌it‌‌contains‌‌is‌‌an‌
example‌‌of...‌
a. Algorithms‌
b. Constants‌
c. Variables‌
d. Procedures‌
e. Abstraction‌
‌Refer‌‌to‌‌the‌‌following‌

11.‌ ‌What‌‌will‌‌the‌‌code‌‌display?‌
a.‌‌bananas,‌‌grapes,‌‌oranges,‌‌apples,‌‌tomato,‌‌tomato,‌‌tomato‌
b.‌‌bananas,‌‌grapes,‌‌oranges,‌‌apples,‌‌tomato,‌‌tomato,‌‌tomato,‌‌tomato‌
c.‌‌bananas,‌‌grapes,‌‌oranges,‌‌apples,‌‌tomato,‌‌tomato‌
d.‌‌bananas,‌‌grapes,‌‌oranges,‌‌apples,‌‌tomato‌

12.‌ ‌What‌‌is‌‌the‌‌index‌‌position‌‌of‌‌grapes?‌
a.‌ ‌0‌
b.‌ ‌3‌
c.‌ ‌1‌
d.‌ ‌2‌
13.‌‌What‌‌is‌‌displayed‌‌after‌‌the‌‌following‌‌code‌‌runs?‌

a.‌ ‌Error‌‌processing‌‌this‌‌message‌
b.‌‌Believein‌‌yourself!‌
c.‌‌Believe‌‌in‌‌yourself!‌
d.‌ ‌Believe‌‌in‌
‌yourself‌

14.‌‌Why‌‌is‌‌a‌‌heuristic‌‌algorithm‌‌required‌‌for‌‌a‌‌computer‌‌to‌‌play‌‌a‌‌game‌‌like‌‌checkers?‌
a.‌ ‌It‌‌keeps‌‌the‌‌game‌‌fair‌‌by‌‌allowing‌‌the‌‌computer‌‌to‌‌only‌‌win‌‌a‌‌certain‌‌amount‌‌of‌‌times‌
b.‌ ‌It‌‌allows‌‌a‌‌human‌‌player‌‌to‌‌win‌‌due‌‌to‌‌statistics‌
c.‌‌It‌‌checks‌‌every‌‌possible‌‌combination‌‌to‌‌find‌‌the‌‌best‌‌move‌
d.‌‌It‌‌takes‌‌too‌‌long‌‌to‌‌analyze‌‌each‌‌possible‌‌solution‌‌forcing‌‌the‌‌computer‌‌to‌‌take‌‌the‌‌next‌
best‌‌move‌

15.‌‌Which‌‌of‌‌the‌‌following‌‌statements‌‌is‌‌true?‌
a.‌‌There‌‌will‌‌be‌‌problems‌‌that‌‌can‌‌not‌‌be‌‌solved‌‌by‌‌an‌‌algorithm‌
b.‌‌Every‌‌problem‌‌can‌‌be‌‌solved‌‌by‌‌an‌‌algorithm‌‌but‌‌some‌‌solutions‌‌will‌‌take‌‌more‌‌than‌‌a‌
couple‌‌hundred‌‌years‌
c.‌‌Every‌‌problem‌‌can‌‌be‌‌solved‌‌by‌‌an‌‌algorithm‌‌but‌‌some‌‌solutions‌‌just‌‌don´t‌‌exist‌‌yet‌
d.‌ ‌Every‌‌problem‌‌can‌‌be‌‌solved‌‌by‌‌an‌‌algorithm‌‌regardless‌‌of‌‌reasonable‌‌time‌‌and‌
computer‌‌brand‌
16.‌‌Which‌‌of‌‌the‌‌following‌‌Boolean‌‌expressions‌‌are‌‌equivalent‌‌to‌‌the‌‌expression‌‌num‌‌≥‌ ‌24‌‌‌?‌
(There‌‌are‌‌2‌‌Solutions‌‌to‌‌this‌‌problem)‌
a.‌‌NOT‌‌(num‌‌<‌‌23)‌
b.‌‌(num‌‌>‌‌24)‌ ‌AND‌‌(num‌‌=‌‌24)‌
c.‌‌NOT‌‌(num‌‌<‌‌24)‌
d.‌‌(num‌‌>‌‌24)‌ ‌OR‌‌(num‌‌=‌‌24)‌

17.‌‌If‌‌the‌‌variables‌‌early‌‌and‌‌late‌‌both‌‌have‌‌the‌‌value‌‌false,‌‌what‌‌is‌‌displayed‌‌when‌‌the‌‌segment‌‌is‌
run?‌

a.‌‌Oh‌‌shoot!‌
b.‌‌Hello,‌‌how‌‌are‌‌you?‌
c.‌‌Better‌‌get‌‌to‌‌work.‌
d.‌‌Hello,‌‌how‌‌are‌‌you?‌‌Better‌‌get‌‌to‌‌work.‌

18.‌‌What‌‌are‌‌the‌‌advantages‌‌of‌‌using‌‌parameters‌‌in‌‌programming?‌
a.‌‌The‌‌number‌‌of‌‌times‌‌the‌‌function‌‌will‌‌run‌‌is‌‌determined‌‌by‌‌the‌‌parameters.‌
b.‌‌Parameters‌‌in‌‌functions‌‌allow‌‌for‌‌more‌‌flexible‌‌behavior‌
c.‌‌Parameters‌‌are‌‌beneficial‌‌to‌‌programming‌‌teams‌‌because‌‌they‌‌assist‌‌in‌‌defining‌‌the‌
boundaries‌‌of‌‌the‌‌problem‌‌they‌‌are‌‌attempting‌‌to‌‌solve.‌
d.‌‌Parameters‌‌alter‌‌the‌‌order‌‌in‌‌which‌‌operations‌‌are‌‌performed‌‌within‌‌a‌‌function.‌
19.‌‌There‌‌is‌‌a‌‌database‌‌in‌‌Sunnyvale‌‌that‌‌keeps‌‌track‌‌of‌‌kids,‌‌including‌‌variables‌‌like‌
numberOfDetentions‌‌and‌‌gradePointAverage?‌‌The‌‌following‌‌expression‌‌is‌‌used‌‌to‌‌determine‌‌who‌
gets‌‌an‌‌extra‌‌30‌‌minutes‌‌of‌‌free‌‌time.‌

(numberOfDetentions‌‌≤‌‌4)‌ ‌AND‌‌(‌gradePointAverage‌‌>‌‌3.3)‌

Which‌‌of‌‌the‌‌following‌‌pairs‌‌would‌‌be‌‌eligible‌‌for‌‌an‌‌extra‌‌30‌‌minutes‌‌of‌‌free‌‌time?‌
a.‌‌numberOfDetentions‌‌=‌‌2,‌‌(gradePointAverage‌‌=‌‌3.25)‌
b.‌‌numberOfDetentions‌‌=‌‌3,‌‌(gradePointAverage‌‌=‌‌1.5)‌
c.‌‌numberOfDetentions‌‌=‌‌5,‌‌(gradePointAverage‌‌=‌‌4.0)‌
d.‌‌numberOfDetentions‌‌=‌‌4,‌‌(gradePointAverage‌‌=‌‌3.5)‌

20.‌‌Any‌‌computer‌‌‌program‌‌statement‌‌that‌‌evaluates‌‌to‌‌some‌‌value‌‌is‌‌called‌‌a(n)‌….‌
A.‌‌Expression‌
B.‌‌Procedure‌
C.‌‌Variable‌
D.‌‌Formula‌
Explanations‌
1. D‌‌-‌‌Programming‌‌languages‌‌are‌‌fundamentally‌‌different‌‌from‌‌the‌‌human‌‌languages‌‌we‌‌use‌
every‌‌day‌‌because‌‌they‌‌are‌‌purpose-built‌‌to‌‌provide‌‌clear‌‌instructions‌‌and‌‌overcome‌‌the‌
ambiguities‌‌of‌‌human‌‌language.‌
2. A‌‌-‌‌An‌‌algorithm‌‌is‌‌a‌‌set‌‌of‌‌steps‌‌or‌‌instructions‌‌that‌‌someone‌‌or/and‌‌a‌‌computer‌‌could‌
follow‌‌to‌‌complete‌‌a‌‌task.‌
3. H‌‌-‌‌An‌‌algorithm‌‌is‌‌made‌‌up‌‌of‌‌three‌‌basic‌‌building‌‌blocks:‌‌sequencing,‌‌selection,‌‌and‌
iteration.‌‌Sequencing‌‌is‌‌the‌‌specific‌‌order‌‌in‌‌which‌‌instructions‌‌are‌‌performed‌‌in‌‌an‌
algorithm.‌‌Selection‌‌is‌‌a‌‌programming‌‌construct‌‌where‌‌a‌‌section‌‌of‌‌code‌‌is‌‌run‌‌only‌‌if‌‌a‌
condition‌‌is‌‌met.‌ ‌Iteration‌‌is‌‌the‌‌term‌‌given‌‌to‌‌the‌‌repetition‌‌of‌‌a‌‌block‌‌of‌‌instructions‌
(code)‌‌within‌‌a‌‌computer‌‌program‌‌for‌‌a‌‌number‌‌of‌‌instances‌‌or‌‌until‌‌a‌‌condition‌‌is‌‌met.‌
4. E‌‌-‌ ‌Every‌‌day,‌‌John‌‌B‌‌makes‌‌cereal‌‌with‌‌his‌‌algorithm,‌‌which‌‌has‌‌its‌‌own‌‌method‌‌and‌
order.‌
5. A‌‌-‌ ‌The‌‌function‌‌uses‌‌selection‌‌to‌‌determine‌‌a‌‌different‌‌set‌‌of‌‌steps‌‌to‌‌execute‌‌based‌‌on‌
whatever‌‌the‌‌´letter´‌‌variable‌‌equals.‌
6. C‌ ‌-‌‌Utilizing‌‌a‌‌term‌‌with‌‌meaning‌‌(give‌‌some‌‌context)‌‌allows‌‌you‌‌to‌‌return‌‌to‌‌your‌‌project‌
at‌‌a‌‌later‌‌period‌‌and‌‌understand‌‌its‌‌purpose,‌‌as‌‌well‌‌as‌‌allowing‌‌others‌‌to‌‌understand‌‌your‌
function's‌‌purpose.‌
7. D‌‌-‌‌A‌‌Boolean‌‌expression‌‌is‌‌a‌‌logical‌‌statement‌‌that‌‌is‌‌either‌‌TRUE‌‌or‌‌FALSE.‌
8. C‌‌-‌‌Using‌‌procedure‌‌and‌‌variable‌‌names‌‌that‌‌are‌‌clear‌‌and‌‌functional‌‌makes‌‌the‌‌code‌‌more‌
readable‌‌and‌‌understandable.‌‌B‌ecause‌‌you‌‌and‌‌your‌‌friend‌‌may‌‌not‌‌be‌‌working‌‌on‌‌the‌
same‌‌project,‌‌their‌‌documentation‌‌of‌‌their‌‌work‌‌and‌‌their‌‌list‌‌of‌‌project‌‌requirements‌‌is‌
unimportant‌‌to‌‌you.‌
9. D‌‌-‌‌A‌‌lacrosse‌‌game's‌‌score‌‌is‌‌likely‌‌to‌‌vary,‌‌while‌‌quantities‌‌like‌‌pi‌‌and‌‌the‌‌number‌‌of‌
hours‌‌in‌‌a‌‌day‌‌remain‌‌constant.‌
10. ‌E‌‌-‌ ‌Abstraction‌‌is‌‌a‌‌mechanism‌‌and‌‌a‌‌practice‌‌to‌‌reduce‌‌and‌‌factor‌‌out‌‌details‌‌so‌‌that‌‌one‌
can‌‌focus‌‌on‌‌a‌‌few‌‌concepts‌‌at‌‌a‌‌time.‌
11. ‌B‌‌-‌‌Each‌‌time‌‌the‌‌word‌‌in‌‌the‌‌list‌‌is‌‌not‌‌¨tomato¨,‌‌¨tomato¨‌‌is‌‌appended‌‌to‌‌the‌‌list.‌
12. ‌D‌‌-‌‌¨grapes¨‌‌is‌‌in‌‌the‌‌second‌‌position‌‌on‌‌the‌‌list.‌
13. ‌C‌‌-‌‌The‌‌plus‌‌(+)‌‌sign‌‌glues‌‌the‌‌message‌‌together.‌
14. ‌D‌‌-‌‌When‌‌the‌‌actual‌‌solution‌‌to‌‌an‌‌issue‌‌is‌‌untraceable,‌‌a‌‌heuristic‌‌method‌‌is‌‌used.‌‌The‌
heuristic‌‌strategy‌‌improves‌‌the‌‌player's‌‌experience‌‌by‌‌speeding‌‌up‌‌the‌‌game.‌
15. ‌A‌‌-‌‌Some‌‌problems‌‌simply‌‌can‌‌not‌‌be‌‌solved‌‌by‌‌an‌‌algorithm.‌
16. ‌C‌‌&‌‌D‌‌-‌ ‌The‌‌expression‌‌(num‌‌>‌‌24)‌ ‌OR‌‌(num‌‌=‌‌24)‌‌always‌‌evaluates‌‌to‌‌true‌‌if‌‌num‌‌is‌
greater‌‌than‌‌or‌‌equal‌‌to‌‌24‌‌because‌‌of‌‌the‌‌OR‌‌statement‌‌combining‌‌the‌‌two.‌‌On‌‌the‌‌other‌
hand,‌‌the‌‌NOT‌‌(num‌‌<‌‌24)‌‌expression‌‌evaluates‌‌to‌‌true‌‌if‌‌(num‌‌<‌‌24)‌‌evaluates‌‌to‌‌false.‌
This‌‌occurs‌‌when‌‌num‌‌is‌‌greater‌‌than‌‌or‌‌equal‌‌to‌‌24.‌
17. ‌C‌‌-‌ ‌Because‌‌the‌‌variables‌‌¨early¨‌‌and‌‌¨late¨‌‌were‌‌set‌‌to‌‌false,‌‌the‌‌text‌‌included‌‌in‌‌them‌
does‌‌not‌‌appear‌‌on‌‌screen,‌‌leaving‌‌the‌‌message‌‌"Better‌‌get‌‌to‌‌work"‌ ‌to‌‌appear.‌
18. ‌B‌‌-‌ ‌Parameters‌‌help‌‌programmers‌‌identify‌‌values‌‌that‌‌are‌‌passed‌‌into‌‌a‌‌function‌‌because‌
they‌‌are‌‌a‌‌type‌‌of‌‌formal‌‌argument‌‌in‌‌which‌‌a‌‌special‌‌kind‌‌of‌‌variable‌ ‌is‌‌used‌‌in‌‌a‌
procedure‌‌to‌‌refer‌‌to‌‌one‌‌of‌‌the‌‌pieces‌‌of‌‌data‌‌provided.‌
19. ‌D‌‌-‌‌Both‌‌conditions‌‌have‌‌to‌‌be‌‌true‌‌for‌‌the‌‌AND‌‌expression‌‌to‌‌evaluate‌‌to‌‌true.‌
20. ‌A‌ ‌-‌‌An‌‌expression‌‌is‌‌a‌‌combination‌‌of‌‌values‌‌and‌‌functions‌‌that‌‌are‌‌combined‌‌and‌
interpreted‌‌by‌‌the‌‌compiler‌‌to‌‌create‌‌a‌‌new‌‌value.‌

You might also like