0.4.18 Module 4 Quiz Study Guide

Number Systems Represent Values in Different Bases

Module 4 began by comparing decimal, binary, and hexadecimal.

Decimal

Base 10.

Digits:

Activity diagram showing Memory current running state, then File storage information that can survive after the program closes.
MemoryCurrentRunningState.
  • New
  • Changed
  • Removed
Writing Moves Information to Persistent Storage

A simple C# write is:

System.IO.File.WriteAllText("lineup.txt", lineupNote);

Conceptually:

Activity diagram showing runtime text, then write, then text file.
RuntimeText.
  • New
  • Changed
  • Removed

WriteAllText writes the supplied text as the file's complete content.

Reading Brings Information Back Into Memory

A simple C# read is:

string lineupNote =
    System.IO.File.ReadAllText("lineup.txt");

Conceptually:

Activity diagram showing text file, then read, then runtime string.
TextFile.
  • New
  • Changed
  • Removed

The file remains persistent.

The program now also has the contents available in memory.

Writing and Reading Do Not Automatically Save Whole Objects

A Player object may contain several fields.

Writing a text file stores only the text the program chooses to write.

Reading a text file returns text.

Turning complex object state into a structured file representation is a separate problem.

That work is outside the current module.

Activity Diagrams Can Model Information Movement

A simple save process can be represented as:

Activity diagram showing Start, then Enter information, then Hold information in running application, then Write information to text file, then End.
Start.
  • New
  • Changed
  • Removed

A load process can be represented as:

Activity diagram showing Start, then Read information from text file, then Hold information in running application, then Display information, then End.
Start.
  • New
  • Changed
  • Removed

The diagram shows the process.

C# supplies the executable instructions.

The Module 4 Story

The major progression is:

Represent values → Identify their types → Model class structure → Distinguish runtime memory from persistent storage → Write information → Read information

These ideas connect representation and storage.

A digital system needs both:

  • a way to describe what information means;
  • and a way to decide where that information exists over time.