100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4.2 TrustPilot
logo-home
Tentamen (uitwerkingen)

Technology Algorithms Exam Questions and Answers Fully Solved Latest Version

Beoordeling
-
Verkocht
-
Pagina's
9
Cijfer
A+
Geüpload op
03-08-2025
Geschreven in
2025/2026

Technology Algorithms Exam Questions and Answers Fully Solved Latest Version An algorithm will be used to decide whether every number in a list is either a 4 or a 5. There are two proposals for the algorithm: Algorithm 1: Set only45 to false. Iterate through each number in the list. If the number is not equal to 4 and not equal to 5, set only45 to false. Otherwise, set only45 to true. Algorithm 2: Set only45 to true. Iterate through each number in the list. If the number is not equal to 4 and not equal to 5, set only45 to false. Which of these statements are true about these algorithms? I. Algorithm 1 does not work on lists where a number other than 4 and 5 occurs before the last number. II. Algorithm 2 does not work on lists which contain entirely 4s or entirely 5s.An algorithm will be used to decide whether every number in a list is either a 4 or a 5. There are two proposals for the algorithm: Algorithm 1: Set only45 to false. Iterate through each number in the list. If the number is not eq - AnswersI only he goal of the procedure computeAverage is to calculate the average of a list of numbers, ignoring any 0 values. For example, if given the list [0, 1, 3, 5], it should return the number 3. PROCEDURE computeAverage(numbers) { total ← 0 count ← 0 FOR num IN numbers { IF (num ≠ 0) { total ← total + num count ← count + 1 } ELSE { RETURN total/count } } RETURN total/count } A programmer tests the procedure with various inputs and finds multiple cases where it does not produce the expected output. Which calls to computeAverage() return an incorrect average? - AnswerscomputeAverage([22, 0, 49, 8]) computeAverage([22, 9, 0, 17]) The two algorithms below are both intended to calculate the product of squares from 1 to n, where n is any positive integer. For example, if n is 333, the algorithms should calculate a product of 363636, from 1^2 times 2^2 times 3^212×22×321, squared, times, 2, squared, times, 3, squared. Algorithm 1: i ← n product ← 0 REPEAT n TIMES { product ← product * (i * i) i ← i - 1 } Algorithm 2: i ← 0 product ← 1 REPEAT n TIMES { product ← product * (i * i) i ← i + 1 } Which statements best describe the behavior of the algorithms? - AnswersNeither algorithm calculates the correct product. A programmer develops the procedure makeNumsList() to generate lists of numbers starting at start and ending with end. For example, makeNumsList(4, 7) should return [4, 5, 6, 7]. PROCEDURE makeNumsList(start, end) { numsList ← [] numTimes ← (end - start) + 1 num ← 1 REPEAT numTimes TIMES { APPEND(numsList, num) num ← num + 1 } RETURN numsList } The programmer tests it with makeNumsList(1, 4) and sees a return value of [1, 2, 3, 4]. Can the programmer conclude that the procedure works correctly for all inputs? - AnswersNo, they've only verified that it works for that test case. Additional analysis and reasoning is necessary. An algorithm will be used to calculate the difference between the smallest and largest values in a list. For the list of [10, 3, 5, 6], it should calculate a difference of 7. There are two proposals for the algorithm: Algorithm 1: Set minVal to the first value in the list and maxVal to the last value in the list. Iterate through each number in the list. If the number is greater than maxVal, store it in maxVal. If the number is less than minVal, store it in minVal. After loop, set maxDiff to the difference between maxVal and minVal. Algorithm 2: Set minVal to 1000 and maxVal to 0. Iterate through each number in the list. If the number is greater than maxVal, store it in maxVal. If the number is less than minVal, store it in minVal. After loop, set maxDiff to the difference between maxVal and minVal. - AnswersII only The goal of the procedure longestWord is to return the longest word in a given list of words. For example, if it's given the list ["superhero", "captain", "marvel"], it should return "superhero" as the longest word. PROCEDURE longestWord(words) { maxWordLen ← 0 maxWord ← "" FOR word IN words { IF (LENGTH(word) > maxWordLen) { maxWord ← word maxWordLen ← LENGTH(word) RETURN maxWord } } RETURN maxWord } A programmer tests the procedure with various inputs and finds that there are multiple cases where it does not produce the expected output. Which calls to longestWord() do not actually return the longest word? -

Meer zien Lees minder
Instelling
Technology Algorithms
Vak
Technology Algorithms









Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Geschreven voor

Instelling
Technology Algorithms
Vak
Technology Algorithms

Documentinformatie

Geüpload op
3 augustus 2025
Aantal pagina's
9
Geschreven in
2025/2026
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

Voorbeeld van de inhoud

Technology Algorithms Exam Questions and Answers Fully Solved Latest Version 2025-2026

An algorithm will be used to decide whether every number in a list is either a 4 or a 5.

There are two proposals for the algorithm:

Algorithm 1: Set only45 to false. Iterate through each number in the list. If the number is not equal to 4
and not equal to 5, set only45 to false. Otherwise, set only45 to true.

Algorithm 2: Set only45 to true. Iterate through each number in the list. If the number is not equal to 4
and not equal to 5, set only45 to false.

Which of these statements are true about these algorithms?

I. Algorithm 1 does not work on lists where a number other than 4 and 5 occurs before the last number.

II. Algorithm 2 does not work on lists which contain entirely 4s or entirely 5s.An algorithm will be used to
decide whether every number in a list is either a 4 or a 5.

There are two proposals for the algorithm:

Algorithm 1: Set only45 to false. Iterate through each number in the list. If the number is not eq -
AnswersI only

he goal of the procedure computeAverage is to calculate the average of a list of numbers, ignoring any 0
values. For example, if given the list [0, 1, 3, 5], it should return the number 3.

PROCEDURE computeAverage(numbers) { total ← 0 count ← 0 FOR num IN numbers { IF (num ≠ 0)
{ total ← total + num count ← count + 1 } ELSE { RETURN total/count } } RETURN total/count }

A programmer tests the procedure with various inputs and finds multiple cases where it does not
produce the expected output.

Which calls to computeAverage() return an incorrect average? - AnswerscomputeAverage([22, 0, 49, 8])

computeAverage([22, 9, 0, 17])

The two algorithms below are both intended to calculate the product of squares from 1 to n, where n is
any positive integer.

For example, if n is 333, the algorithms should calculate a product of 363636, from 1^2 \times 2^2
\times 3^212×22×321, squared, times, 2, squared, times, 3, squared.

Algorithm 1:

i ← n product ← 0 REPEAT n TIMES { product ← product * (i * i) i ← i - 1 }

Algorithm 2:

, i ← 0 product ← 1 REPEAT n TIMES { product ← product * (i * i) i ← i + 1 }

Which statements best describe the behavior of the algorithms? - AnswersNeither algorithm calculates
the correct product.

A programmer develops the procedure makeNumsList() to generate lists of numbers starting at start
and ending with end. For example, makeNumsList(4, 7) should return [4, 5, 6, 7].

PROCEDURE makeNumsList(start, end) { numsList ← [] numTimes ← (end - start) + 1 num ← 1 REPEAT
numTimes TIMES { APPEND(numsList, num) num ← num + 1 } RETURN numsList }

The programmer tests it with makeNumsList(1, 4) and sees a return value of [1, 2, 3, 4].

Can the programmer conclude that the procedure works correctly for all inputs? - AnswersNo, they've
only verified that it works for that test case. Additional analysis and reasoning is necessary.

An algorithm will be used to calculate the difference between the smallest and largest values in a list.
For the list of [10, 3, 5, 6], it should calculate a difference of 7.

There are two proposals for the algorithm:

Algorithm 1: Set minVal to the first value in the list and maxVal to the last value in the list. Iterate
through each number in the list. If the number is greater than maxVal, store it in maxVal. If the number
is less than minVal, store it in minVal. After loop, set maxDiff to the difference between maxVal and
minVal.

Algorithm 2: Set minVal to 1000 and maxVal to 0. Iterate through each number in the list. If the number
is greater than maxVal, store it in maxVal. If the number is less than minVal, store it in minVal. After loop,
set maxDiff to the difference between maxVal and minVal. - AnswersII only

The goal of the procedure longestWord is to return the longest word in a given list of words. For
example, if it's given the list ["superhero", "captain", "marvel"], it should return "superhero" as the
longest word.

PROCEDURE longestWord(words) { maxWordLen ← 0 maxWord ← "" FOR word IN words { IF
(LENGTH(word) > maxWordLen) { maxWord ← word maxWordLen ← LENGTH(word) RETURN
maxWord } } RETURN maxWord }

A programmer tests the procedure with various inputs and finds that there are multiple cases where it
does not produce the expected output.

Which calls to longestWord() do not actually return the longest word? - AnswerslongestWord(["crown",
"diamond", "castle"])

longestWord(["frog", "seagull", "mermaid"])
€9,20
Krijg toegang tot het volledige document:

100% tevredenheidsgarantie
Direct beschikbaar na je betaling
Lees online óf als PDF
Geen vaste maandelijkse kosten


Ook beschikbaar in voordeelbundel

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
TutorJosh Chamberlain College Of Nursing
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
336
Lid sinds
1 jaar
Aantal volgers
16
Documenten
28401
Laatst verkocht
10 uur geleden
Tutor Joshua

Here You will find all Documents and Package Deals Offered By Tutor Joshua.

3,6

53 beoordelingen

5
18
4
14
3
12
2
0
1
9

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Veelgestelde vragen