100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4.2 TrustPilot
logo-home
Examen

Technology Algorithms Exam Questions and Answers Fully Solved Latest Version

Puntuación
-
Vendido
-
Páginas
9
Grado
A+
Subido en
03-08-2025
Escrito en
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? -

Mostrar más Leer menos
Institución
Technology Algorithms
Grado
Technology Algorithms









Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Escuela, estudio y materia

Institución
Technology Algorithms
Grado
Technology Algorithms

Información del documento

Subido en
3 de agosto de 2025
Número de páginas
9
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

Vista previa del contenido

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"])
$10.49
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada


Documento también disponible en un lote

Conoce al vendedor

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
TutorJosh Chamberlain College Of Nursing
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
337
Miembro desde
1 año
Número de seguidores
16
Documentos
28401
Última venta
17 horas hace
Tutor Joshua

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

3.6

53 reseñas

5
18
4
14
3
12
2
0
1
9

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes