Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Examen

WGU C960 – Discrete Mathematics II Objective Assessment Review Full Questions, Correct Answers, and Worked Solutions | 2026 Update | 100% Correct

Puntuación
-
Vendido
-
Páginas
46
Grado
A+
Subido en
16-07-2026
Escrito en
2025/2026

What is the final value of abs after the following pseudocode is run? text x := 2 If (x 0) abs := x Else abs := -x End-if A) -2 B) 0 C) 2 D) 4 Answer: C Rationale: The condition (x 0) evaluates to true because x = 2. The line abs := x is executed, assigning the value 2 to abs. The Else branch is skipped entirely . Question 2 What is the final value of abs after the following pseudocode is run? text x := -2 If (x 0) abs := x Else abs := -x End-if A) -2 B) 0 C) 2 D) 4 Answer: C Rationale: The condition (x 0) evaluates to false because x = -2. The Else branch executes, setting abs := -x = -(-2) = 2 . Question 3 What is the final value of product after the following pseudocode runs? text product := 1 count := 5 While (count 0) product := product * count count := count - 2 End-while A) 3 B) 5 C) 15 D) 30 Answer: C Rationale: • Iteration 1: count = 5, product = 1 × 5 = 5, count becomes 3 • Iteration 2: count = 3, product = 5 × 3 = 15, count becomes 1 • The loop would execute a third iteration (count = 1), but the condition is checked at the start. Wait, let me recalculate: Actually, the loop executes while count 0: • Iteration 1: count=5 → product=5, count=3 • Iteration 2: count=3 → product=15, count=1 • Iteration 3: count=1 → product=15, count=-1 • Loop ends (count = -1) Final product = 15 Question 4 How many iterations will the loop in Question 3 execute? A) 1 B) 2 C) 3 D) 4 Answer: C Rationale: count values: 5, 3, 1. Each time count 0, the loop executes. When count becomes -1, the condition count 0 is false. The loop executes 3 iterations . Question 5 Consider the following pseudocode that merges two lists: text Merge0(List1, List2) Set OUTlist to empty While List1 is not empty OR List2 is not empty If one list is empty and the other is not, Remove the first number from the non-empty list and add it to OUTlist If both lists are non-empty, Remove the first number from List1 and add it to OUTlist Remove the first number from List2 and add it to OUTlist Return OUTlist If ListA = [1, 3, 5] and ListB = [2, 4, 6], what is the result of Merge0(ListA, Merge0(ListB, ListA))? A) [1, 2, 3, 4, 5, 6] B) [1, 2, 3, 1, 5, 4, 3, 6, 5] C) [2, 1, 4, 3, 6, 5] D) [2, 4, 6, 1, 3, 5] Answer: B Rationale: First compute the inner call: Merge0([2,4,6], [1,3,5]) produces [2,1,4,3,6,5]. Then the outer call: Merge0([1,3,5], [2,1,4,3,6,5]) produces [1,2,3,1,5,4,3,6,5] . Question 6 Given the following pseudocode, what is S at the end? text S = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20} x = 2 While(x 11): For i in S: If 0 ≡ i mod x and i ≠ x: delete i from S end-If end-For x = x + 1 end-While A) {2, 3, 5, 7, 9, 11, 13, 17, 19} B) {2, 3, 5, 7, 11, 13, 17, 19} C) {1, 2, 3, 5, 7, 11, 13, 17, 19} D) All numbers remain Answer: B Rationale: This is the Sieve of Eratosthenes algorithm. Starting with x=2, it removes all multiples of each number. After removing all composites, only primes remain: {2, 3, 5, 7, 11, 13, 17, 19} .

Mostrar más Leer menos
Institución
Wgu
Grado
C 960

Vista previa del contenido

WGU C960 – Discrete Mathematics II
Objective Assessment Review Full
Questions, Correct Answers, and Worked
Solutions | 2026 Update | 100% Correct.



SECTION 1: ALGORITHMS & ALGORITHM ANALYSIS
(Questions 1-30)

Question 1

What is the final value of abs after the following pseudocode is run?

text
x := 2
If (x > 0)
abs := x
Else
abs := -x
End-if


A) -2
B) 0
C) 2
D) 4

Answer: C

Rationale: The condition (x > 0) evaluates to true because x = 2. The line abs := x is
executed, assigning the value 2 to abs. The Else branch is skipped entirely .

,Question 2

What is the final value of abs after the following pseudocode is run?

text
x := -2
If (x > 0)
abs := x
Else
abs := -x
End-if


A) -2
B) 0
C) 2
D) 4

Answer: C

Rationale: The condition (x > 0) evaluates to false because x = -2. The Else branch
executes, setting abs := -x = -(-2) = 2 .




Question 3

What is the final value of product after the following pseudocode runs?

text
product := 1
count := 5
While (count > 0)
product := product * count
count := count - 2
End-while


A) 3
B) 5
C) 15
D) 30

,Answer: C

Rationale:

• Iteration 1: count = 5, product = 1 × 5 = 5, count becomes 3
• Iteration 2: count = 3, product = 5 × 3 = 15, count becomes 1
• The loop would execute a third iteration (count = 1), but the condition is checked at
the start. Wait, let me recalculate:

Actually, the loop executes while count > 0:

• Iteration 1: count=5 → product=5, count=3
• Iteration 2: count=3 → product=15, count=1
• Iteration 3: count=1 → product=15, count=-1
• Loop ends (count = -1)
Final product = 15




Question 4

How many iterations will the loop in Question 3 execute?
A) 1
B) 2
C) 3
D) 4

Answer: C

Rationale: count values: 5, 3, 1. Each time count > 0, the loop executes. When count
becomes -1, the condition count > 0 is false. The loop executes 3 iterations .




Question 5

Consider the following pseudocode that merges two lists:

, text
Merge0(List1, List2)
Set OUTlist to empty
While List1 is not empty OR List2 is not empty
If one list is empty and the other is not,
Remove the first number from the non-empty list and add it to OUTlist
If both lists are non-empty,
Remove the first number from List1 and add it to OUTlist
Remove the first number from List2 and add it to OUTlist
Return OUTlist


If ListA = [1, 3, 5] and ListB = [2, 4, 6], what is the result of Merge0(ListA,
Merge0(ListB, ListA))?
A) [1, 2, 3, 4, 5, 6]
B) [1, 2, 3, 1, 5, 4, 3, 6, 5]
C) [2, 1, 4, 3, 6, 5]
D) [2, 4, 6, 1, 3, 5]

Answer: B

Rationale: First compute the inner call: Merge0([2,4,6], [1,3,5]) produces [2,1,4,3,6,5]. Then
the outer call: Merge0([1,3,5], [2,1,4,3,6,5]) produces [1,2,3,1,5,4,3,6,5] .




Question 6

Given the following pseudocode, what is S at the end?

text
S = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}
x = 2
While(x < 11):
For i in S:
If 0 ≡ i mod x and i ≠ x:
delete i from S
end-If
end-For
x = x + 1
end-While

Escuela, estudio y materia

Institución
Grado

Información del documento

Subido en
16 de julio de 2026
Número de páginas
46
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

$14.99
Accede al documento completo:

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

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.
Brainarium Delaware State University
Ver perfil
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
1969
Miembro desde
3 año
Número de seguidores
1045
Documentos
23691
Última venta
4 horas hace

3.8

333 reseñas

5
155
4
63
3
57
2
16
1
42

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