0.3.17 Module 3 Quiz Study Guide

Programs Follow Defined Instructions

A computer program works from instructions that have been represented in the software.

People often fill in missing information automatically.

Programs cannot safely rely on unstated assumptions.

Clear technical instructions identify:

Precision Reduces Ambiguity

An instruction is ambiguous when it allows more than one reasonable interpretation.

For example:

Display the next match.

raises questions such as:

A more precise requirement defines the intended meaning.

Precision does not mean adding unnecessary detail.

It means removing uncertainty that affects the required behavior.

Sequence Controls What Happens Next

In a simple sequence, statements execute in order.

For example:

C#
Player player1 = new Player();
player1.name = "Jordan";
player1.isAvailable = true;

The Player object is created before its fields are assigned.

Later statements operate on the state produced by earlier statements.

Changing the order can change the result or make a later instruction impossible to perform.

Boolean Values Represent True/False State

A Boolean value is either:

A name such as:

isAvailable

gives the value meaning.

Read:

Plain text
isAvailable = true

as:

The statement “the player is available” is true.

Boolean state becomes especially important when the program must choose a path.

Activity Diagrams Represent Process Flow

A UML activity diagram answers:

What happens, and what path is followed?

The basic pieces introduced in this module include:

A straight process can be represented as:

Plain text
Start
  ↓
Load roster
  ↓
Display roster
  ↓
End

Decision Nodes Represent Choices

A decision node allows one incoming flow to continue along different outgoing paths.

For example:

Plain text
Is the player available?
  ├─ [yes] → Add player to available list
  └─ [no]  → Continue without adding

The condition determines which path applies.

A useful decision diagram makes the meaning of each path clear.

Object and Activity Diagrams Answer Different Questions

A UML object diagram focuses on a snapshot:

A UML activity diagram focuses on behavior:

A useful shortcut is:

Object diagram: What exists right now?

Activity diagram: What happens next?

Violet Records the Activity Model

Violet is the diagramming tool used to create activity diagrams.

The tool can place nodes and connectors.

It does not decide whether the modeled process is correct.

The reasoning should be clear before or while the UML is constructed:

process meaning → UML flow

An editable Violet file is the source artifact that can be reopened and revised.

Solution Explorer Helps Locate Program Files

Visual Studio organizes the development workspace as:

Solution → Project → Files

Solution Explorer helps you navigate that structure.

Common file types include:

Use the supplied solution structure rather than reorganizing files before you understand their roles.

Breakpoints Create Planned Observation Points

A breakpoint tells Visual Studio to pause when execution reaches a selected location.

Choose a breakpoint based on a question.

For example:

What is player1.isAvailable immediately before the decision?

The breakpoint creates a moment where you can inspect the runtime state.

It does not fix the program.

F10 Steps Over One Statement at a Time

When the program is paused, F10 / Step Over executes the current statement and advances to the next point in the current flow.

A useful debugging rhythm is:

Predict → Step → Observe → Compare

F10 helps connect the written sequence of source statements to the state changes that occur at runtime.

The Error List Shows Build Diagnostics

The Visual Studio Error List organizes compiler and build feedback.

A build error can prevent the current source from being compiled successfully.

Use the Error List to locate and read the reported problem, then inspect the surrounding source.

A successful build does not prove that the program meets the requirement.

Code can compile successfully and still contain the wrong value or logic.

UML Flow Can Be Connected to C#

An activity diagram might show:

Plain text
Read availability
       ↓
Decision: available?
  ├─ [yes] → Display available result
  └─ [no]  → Continue

The C# source must preserve the same intended flow when it implements that behavior.

The diagram and the source are different representations.

The important question is whether they describe the same actions and paths.

A Simple if Has One Conditional Block

Example:

C#
if (player1.isAvailable)
{
    System.Console.WriteLine("Player is available.");
}

If the condition is true, the block runs.

If the condition is false, the block is skipped.

Execution then continues after the if.

A Simple if/else Chooses Between Two Blocks

Example:

C#
if (player1.isAvailable)
{
    System.Console.WriteLine("Available");
}
else
{
    System.Console.WriteLine("Unavailable");
}

If the condition is true, the if block runs.

If the condition is false, the else block runs.

Exactly one of the two branches is selected for that evaluation.

Connect the Evidence Sources

Module 3 brings several representations and tools together:

Requirement
Defines what the process should accomplish.

Activity diagram
Shows the intended actions and paths visually.

C# source
Contains executable instructions.

Boolean state
Provides true/false information used by a decision.

Breakpoint
Creates a planned pause.

F10
Lets you trace the flow statement by statement.

Debugger state
Shows the values that actually exist during execution.

Error List
Reports compiler/build diagnostics.

Strong program analysis comes from knowing which source answers which question.

The Module 3 Story

The main progression is:

Clear instructions → Sequence → Boolean state → Visual decision flow → C# decision → Runtime observation

Each step adds another way to reason about what the program should do and what it actually does.