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
Document preview thumbnail
Vista previa 4 fuera de 50 páginas
Examen

WGU C960 – Discrete Mathematics II Pre-Assessment Review | Full Questions, Correct Answers, and Worked Solutions | Latest 2026/2027 Update | 100% Correct.

Document preview thumbnail
Vista previa 4 fuera de 50 páginas

WGU C960 – Discrete Mathematics II Pre-Assessment Review | Full Questions, Correct Answers, and Worked Solutions | Latest 2026/2027 Update | 100% Correct. WGU C960 – Discrete Mathematics II Pre-Assessment Review | Full Questions, Correct Answers, and Worked Solutions | Latest 2026/2027 Update | 100% Correct.

Vista previa del contenido

WGU C960 – Discrete Mathematics II Pre-
Assessment Review | Full Questions, Correct
Answers, and Worked Solutions | Latest
2026/2027 Update | 100% Correct.
Question:
Pre-Assessment: Algorithms - Algorithm Structures: i,- i,- i,- i,-




Question 1: i,-




Consider the following pseudocode that merges two lists of numbers into
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-


one:
Merge0(List1, List2) i,- i,-




i,- Set OUTlist to empty
i,- i,- i,- i,-




i,- While List1 is not empty OR List2 is not empty
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-




i,- If one list is empty and the other is not,
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-




i,- Remove the first number from the non-empty list and add it to OUTlist
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-




i,- If both lists are non-empty,
i,- i,- i,- i,- i,-




i,- Remove the first number from List1 and add it to OUTlist
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-




i,- Remove the first number from List2 and add it to OUTlist
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-




i,- Return OUTlist i,-




If ListA is [1, 3, 5] and ListB is [2, 4, 6] then what is the result of Merge0
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-


(ListA, Merge0 (ListB, ListA))??
i,- i,- i,-

,Answer:
[ 1, 2, 3, 1, 5, 4, 3, 6, 5 ]
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-




Step 1: i,-




To solve this, we need to understand how the Merge0 function works. It
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-



merges two lists by taking the first element of each list and adding it to
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-


the output list in ascending order. If one list is empty and the other is not,
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-


it removes the first element from the non-empty list and adds it to the
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-


output list. i,-




Using the given example, we have:
i,- i,- i,- i,- i,-




i,- ListA = [1, 3, 5] i,- i,- i,- i,-




i,- ListB = [2, 4, 6] i,- i,- i,- i,-




Now, let's analyze the innermost function Merge0(ListB, ListA):
i,- i,- i,- i,- i,- i,- i,-




1. OUTlist = empty
i,- i,- i,-




2. OUTlist = [2]
i,- i,- i,-




3. OUTlist = [2, 1]
i,- i,- i,- i,-




4. OUTlist = [2, 1, 4]
i,- i,- i,- i,- i,-




5. OUTlist = [2, 1, 4, 3]
i,- i,- i,- i,- i,- i,-




6. OUTlist = [2, 1, 4, 3, 6]
i,- i,- i,- i,- i,- i,- i,-




7. OUTlist = [2, 1, 4, 3, 6, 5]
i,- i,- i,- i,- i,- i,- i,- i,-




8. ListA is now empty, so we return OUTlist = [2, 1, 4, 3, 6, 5]
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-




Step 2: i,-




Now, let's use the result of Merge0(ListB, ListA) as the second argument
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-


for the outer Merge0 function. So we have:
i,- i,- i,- i,- i,- i,- i,-




i,- List1 = ListA = [1, 3, 5]
i,- i,- i,- i,- i,- i,-

,i,- List2 = Merge0(ListB, ListA) = [2, 1, 4, 3, 6, 5]
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-




Using the Merge0 function with these lists, we have:
i,- i,- i,- i,- i,- i,- i,- i,-




1. OUTlist = empty
i,- i,- i,-




2. OUTlist = [1]
i,- i,- i,-




3. OUTlist = [1, 2]
i,- i,- i,- i,-




4. OUTlist = [1, 2, 3]
i,- i,- i,- i,- i,-




5. OUTlist = [1, 2, 3, 1]
i,- i,- i,- i,- i,- i,-




6. OUTlist = [1, 2, 3, 1, 5]
i,- i,- i,- i,- i,- i,- i,-




7. OUTlist = [1, 2, 3, 1, 5, 4]
i,- i,- i,- i,- i,- i,- i,- i,-




8. OUTlist = [1, 2, 3, 1, 5, 4, 3]
i,- i,- i,- i,- i,- i,- i,- i,- i,-




9. OUTlist = [1, 2, 3, 1, 5, 4, 3, 6]
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-




10. OUTlist = [1, 2, 3, 1, 5, 4, 3, 6, 5]
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-




11. return OUTlist = [1, 2, 3, 1, 5, 4, 3, 6, 5]
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-




Therefore, the result of Merge0(ListA, Merge0(ListB, ListA)) is [1, 2, 3, 1, 5,
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-


4, 3, 6, 5].
i,- i,- i,-




Question:

Pre-Assessment: Algorithms - Algorithm Structures: i,- i,- i,- i,-




Question 2: i,-




Given this pseudocode: i,- i,-




S = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-

, x=2 i,- i,-




While(x<11): i,-




i,- For i in S: i,- i,- i,- i,-




i,- If 0 ≡ i mod x and i ≠ x:
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-




i,- delete i from S i,- i,- i,- i,-




i,- end-If i,-




i,- end-For i,-




i,- x=x+1 i,- i,- i,- i,-




end-While



What is S at the end of this code??
i,- i,- i,- i,- i,- i,- i,- i,-




Answer:

{2, 3, 5, 7, 11, 13, 17, 19}
i,- i,- i,- i,- i,- i,- i,-




This code is nothing but finding the prime numbers from the given set.
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-




Start from x = 2 i,- i,- i,- i,-




1) When x = 2, we have to delete that elements from S which satisfy 0 ==
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-


i mod 2 and i ≠ 2 i.e multiples of 2 except 2. So we remove {4, 6, 8, 10, 12,
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-


14, 16, 18, 20} i,- i,- i,-




x = x+1
i,- i,-




2) When x = 3, we have to delete that elements from S which satisfy 0 ==
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-


i mod 3 and i ≠ 3 i.e multiples of 3 except 3. So we remove {6, 9, 12, 15,
i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,- i,-


18}
x = x+1
i,- i,-

Información del documento

Subido en
23 de julio de 2026
Número de páginas
50
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$13.99

¿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

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.
AcademiaExpert
3.8
(510)
Vendido
1987
Seguidores
766
Artículos
4508
Última venta
19 horas hace



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