Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 3 out of 19 pages
Exam (elaborations)

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

Document preview thumbnail
Preview 3 out of 19 pages

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

Content preview

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?

Document information

Uploaded on
July 25, 2026
Number of pages
19
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$27.08

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
2
Followers
0
Items
655
Last sold
1 month ago


Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions