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 3 fuera de 19 páginas
Examen

WGU C960 Discrete Mathematics II: The Ultimate Q&A Study Guide — 180 Essential Problems with Detailed Explanations

Document preview thumbnail
Vista previa 3 fuera de 19 páginas

WGU C960 Discrete Mathematics II: The Ultimate Q&A Study Guide — 180 Essential Problems with Detailed Explanations

Vista previa del contenido

WGU C960 Discrete Mathematics II:
The Ultimate Q&A Study Guide — 180
Essential Problems with Detailed
Explanations


Algorithms and Algorithm Analysis

What are the three building blocks of algorithms?

Assignments, conditional statements, and loops. Assignments give values to
variables, conditional statements control the flow of steps, and loops allow
steps to be repeated.

What is an algorithm?

A step-by-step procedure for solving a problem. It usually specifies the
input and output to a problem, and the sequence of steps to be followed to
obtain the output from the input.

What is pseudocode?

A detailed yet readable description of what an algorithm must do,
expressed in a formally-styled natural language rather than in a
programming language.

What is an IF statement?

,Tests a condition and executes one or more instructions if the condition
evaluates to true.

What is an IF-ELSE statement?

Tests a condition, executes one or more instructions if the condition
evaluates to true, and executes a different set of instructions if the
condition evaluates to false.

What is an iteration?

A process where a set of instructions or structures are repeated in a
sequence a specified number of times or until a condition is met.

What is a For loop?

A block of instructions is executed a fixed number of times as specified in
the first line of the for-loop, which defines an index, a starting value, and a
final value.

What is a While loop?

A while loop iterates an unknown number of times, ending when a certain
condition becomes false.

What is a nested loop?

When a loop exists within another loop.

What is the final value of abs after the following pseudocode is run? x
:= 2 If (x > 0) abs := x Else abs := -x End-if

The final value is 2. 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.

, What is the final value of abs after the following pseudocode is run? x
:= -2 If (x > 0) abs := x Else abs := -x End-if

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

What is the final value of product after the following pseudocode
runs? product := 1 count := 5 While (count > 0) product := product *
count count := count - 2 End-while

The final value is 15. First iteration: count = 5, product = 1 × 5 = 5, count
becomes 3. Second iteration: count = 3, product = 5 × 3 = 15, count
becomes 1. The loop will execute a third iteration (count = 1).

How many iterations will a loop execute if count starts at 5 and
decreases by 2 each iteration while count > 0?

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

What are the primary resources to optimize in an algorithm?

Time complexity (the time the algorithm requires to run) and space
complexity (the amount of memory used).

What factors does time complexity depend on?

The speed of the processing unit, the number of calculations that need to
be performed, the number of conditions that need to be evaluated, and the
number of iterations to be completed by the loops.

What are atomic operations?

Información del documento

Subido en
25 de julio de 2026
Número de páginas
19
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$27.08

¿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

Vendido
2
Seguidores
0
Artículos
655
Última venta
1 mes 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