Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Unit 1: Foundations of Computing

Overview

This unit covers computer science, hardware/software, algorithms, first program, variables, primitive types. Follow the same problem progression as Python so that the main comparison is language syntax and semantics. Use the worked examples as starting points, then complete the activities independently.

Lesson 1.1: Computer science and problem solving

Reading References

  • Official C# language guide and standard-library documentation.
  • Corresponding Python course lesson for the shared problem context and learning objective.

Learning Objectives

  • Explain the C# concepts and runtime behavior introduced in this lesson.
  • Trace the worked example and predict its observable result.
  • Apply the shared problem context using appropriate C# types and .NET APIs.

Concept Explanation

C# executes typed statements under the .NET runtime. Focus on the concept named in this lesson and connect it to observable input, processing, and output. The compiler checks language rules, while tests are needed to establish behavior.

Worked Example

Console.WriteLine("Computer science turns problems into precise, testable steps.");

Trace: identify declarations, expressions, control flow, and observable output. Predict the result, run the example, and compare the actual output with the prediction.

Expected Behavior or Output

Output observed when the worked example was run (.NET 8; the text of the output does not depend on the operating system):

Computer science turns problems into precise, testable steps.

Common Mistakes

  • Confusing source syntax with the behavior of the running application.
  • Assuming compilation alone proves that the program meets the requirement.
  • Ignoring C# type rules or compiler diagnostics relevant to this lesson.

Activities

  1. Trace the worked example line by line and write its exact output before running it.
  2. Change one value in the example and predict the result before rebuilding.
  3. Test one boundary or invalid case that is relevant to this lesson’s concept.
  4. Explain the C# language or .NET behavior demonstrated, without relying on syntax coloring.

Accessibility Practice

Navigate the complete source file by line, word, and character using the learner’s access technology. Read punctuation and indentation, run from the terminal, and inspect standard output and errors sequentially.

Skills Checklist

  • I can explain the lesson’s concept using accurate C# terminology.
  • I can trace and predict the worked example.
  • I can modify the example while preserving its intended behavior.
  • I can test a relevant boundary or error case.
  • I can read the source and diagnostics using my access technology.

Lesson 1.2: Your first program

Reading References

  • Official C# language guide and standard-library documentation.
  • Corresponding Python course lesson for the shared problem context and learning objective.

Learning Objectives

  • Explain the C# concepts and runtime behavior introduced in this lesson.
  • Trace the worked example and predict its observable result.
  • Apply the shared problem context using appropriate C# types and .NET APIs.

Concept Explanation

C# executes typed statements under the .NET runtime. Focus on the concept named in this lesson and connect it to observable input, processing, and output. The compiler checks language rules, while tests are needed to establish behavior.

Worked Example

Console.WriteLine("Hello, World!");
Console.WriteLine("This is my first C# console program.");

Trace: identify declarations, expressions, control flow, and observable output. Predict the result, run the example, and compare the actual output with the prediction.

Expected Behavior or Output

Output observed when the worked example was run (.NET 8; the text of the output does not depend on the operating system):

Hello, World!
This is my first C# console program.

Common Mistakes

  • Confusing source syntax with the behavior of the running application.
  • Assuming compilation alone proves that the program meets the requirement.
  • Ignoring C# type rules or compiler diagnostics relevant to this lesson.

Activities

  1. Trace the worked example line by line and write its exact output before running it.
  2. Change one value in the example and predict the result before rebuilding.
  3. Test one boundary or invalid case that is relevant to this lesson’s concept.
  4. Explain the C# language or .NET behavior demonstrated, without relying on syntax coloring.

Accessibility Practice

Navigate the complete source file by line, word, and character using the learner’s access technology. Read punctuation and indentation, run from the terminal, and inspect standard output and errors sequentially.

Skills Checklist

  • I can explain the lesson’s concept using accurate C# terminology.
  • I can trace and predict the worked example.
  • I can modify the example while preserving its intended behavior.
  • I can test a relevant boundary or error case.
  • I can read the source and diagnostics using my access technology.

Lesson 1.3: Variables and data types

Reading References

  • Official C# language guide and standard-library documentation.
  • Corresponding Python course lesson for the shared problem context and learning objective.

Learning Objectives

  • Explain the C# concepts and runtime behavior introduced in this lesson.
  • Trace the worked example and predict its observable result.
  • Apply the shared problem context using appropriate C# types and .NET APIs.

Concept Explanation

C# executes typed statements under the .NET runtime. Focus on the concept named in this lesson and connect it to observable input, processing, and output. The compiler checks language rules, while tests are needed to establish behavior.

Worked Example

string name = "Avery"; int age = 16; double heightM = 1.72; string favoriteSubject = "Computer Science";
Console.WriteLine($"{name}, age {age}, height {heightM:F2} m; favorite subject: {favoriteSubject}.");

Trace: identify declarations, expressions, control flow, and observable output. Predict the result, run the example, and compare the actual output with the prediction.

Expected Behavior or Output

Output observed when the worked example was run (.NET 8; the text of the output does not depend on the operating system):

Avery, age 16, height 1.72 m; favorite subject: Computer Science.

Common Mistakes

  • Confusing source syntax with the behavior of the running application.
  • Assuming compilation alone proves that the program meets the requirement.
  • Ignoring C# type rules or compiler diagnostics relevant to this lesson.

Activities

  1. Trace the worked example line by line and write its exact output before running it.
  2. Change one value in the example and predict the result before rebuilding.
  3. Test one boundary or invalid case that is relevant to this lesson’s concept.
  4. Explain the C# language or .NET behavior demonstrated, without relying on syntax coloring.

Accessibility Practice

Navigate the complete source file by line, word, and character using the learner’s access technology. Read punctuation and indentation, run from the terminal, and inspect standard output and errors sequentially.

Skills Checklist

  • I can explain the lesson’s concept using accurate C# terminology.
  • I can trace and predict the worked example.
  • I can modify the example while preserving its intended behavior.
  • I can test a relevant boundary or error case.
  • I can read the source and diagnostics using my access technology.