Back

Activity 1.1: Welcome to AP CSP

divider

Activity 1.1

Welcome to AP CSP

Key Concepts

Computer science is bigger than programming, but today you will run, read, change, and break your first C# program.

You Do Not Need Any Experience

This course begins at the beginning. Nothing in today's program assumes that you have written code before.

You Do Not Need Any Experience

If you have programmed before, you will recognize some ideas. By the time the course reaches data and algorithms, the gap gets small quickly.

What Is Computer Science Principles?

AP CSP studies how programs, data, networks, and computing innovations work — and how they affect people.

The Five Big Ideas

  1. Creative Development
  2. Data
  3. Algorithms and Programming
  4. Computer Systems and Networks
  5. Impact of Computing

How You Are Assessed

70% — 70 multiple-choice questions in 120 minutes.

How You Are Assessed

70% — 70 multiple-choice questions in 120 minutes.

30% — the Create performance task and written responses.

The Create Task

You design and build a program during class in Unit 3.

The Create Task

You design and build a program during class in Unit 3.

You submit the program, a video, and a Personalized Project Reference.

The Create Task

You design and build a program during class in Unit 3.

You submit the program, a video, and a Personalized Project Reference.

On exam day, you answer four prompts about your own code with no computer.

Which Is Why the Code Is Yours

Borrowed code is not only dishonest. It is code you will have to explain from memory months later.

Writing your own program is the easier deal.

What Is a Program?

A program is a sequence of instructions that a computer follows.

The computer follows exactly what you wrote, in order.Exactly is the part that will occasionally annoy you.

Your First Program

Console Template
Console.Write("What is your name? ");
string name = Console.ReadLine();
Console.WriteLine($"Nice to meet you, {name}!");

Your First Program

Console Template
Console.Write("What is your name? ");
string name = Console.ReadLine();
Console.WriteLine($"Nice to meet you, {name}!");

Today, you only need to know that Console.WriteLine displays a line of text.

Reading One Line

Console.WriteLine("Welcome to AP CSP.");
  • Console.WriteLine is the instruction.
  • The text inside quotation marks is the value to display.
  • The semicolon ends the instruction.

Today's Objectives

  • Copy and rename a course template.
  • Run a C# console program.
  • Change and add output instructions.
  • Read the useful part of a compiler error.

Key Terms

Program
A sequence of instructions that a computer follows.
Source code
The human-readable instructions written in a programming language.
Compiler
Software that checks and translates source code before it runs.
Output
Information a program sends to a user or another system.

'F' → Fullscreen

divider

Build

Keep template-console clean. Every folder you work in today must be a copy.


Task 1: Run Something You Did Not Write

  1. Copy template-console.
  2. Rename the copy 1-01-hello.
  3. Open its Program.cs.
  4. Run it, type your name, and press Enter.
  5. Record what the program asked and what it said back.
WELCOME TO AP CSP
Console.Write("What is your name? ");
string name = Console.ReadLine();
Console.WriteLine($"Nice to meet you, {name}!");
Example Output
What is your name? Sam [Enter]
Nice to meet you, Sam!

Task 2: Make It Say Something Else

  1. Add the highlighted line at the bottom.
  2. Run the program before changing anything else.
  3. Change both displayed messages to your own class-appropriate wording. Leave {name} intact.
  4. Run after each change.
WELCOME TO AP CSP
Console.Write("What is your name? ");
string name = Console.ReadLine();
Console.WriteLine($"Nice to meet you, {name}!");
Console.WriteLine("Welcome to AP Computer Science Principles.");
Example Output
What is your name? Sam [Enter]
Nice to meet you, Sam!
Welcome to AP Computer Science Principles.

Task 3: Three True Things

  1. Make another copy of template-console.
  2. Rename it 1-01-about-me.
  3. Delete everything in its Program.cs.
  4. Write three Console.WriteLine instructions containing three true, class-appropriate statements about you.
  5. Run it and confirm that three lines appear in the same order.
WELCOME TO AP CSP
Console.WriteLine("I am in tenth grade.");
Console.WriteLine("I have never written a C# program before.");
Console.WriteLine("I would rather build a game than a website.");
Example Output
I am in tenth grade.
I have never written a C# program before.
I would rather build a game than a website.

Challenge (Optional): Break It on Purpose

  1. Delete the closing quotation mark from your first line.
  2. Predict whether any part of the program will run.
  3. Run it and find the first line containing the word error.
  4. Record the error code and message, then repair the quote.
WELCOME TO AP CSP
Console.WriteLine("I am in tenth grade.);
Compiler Output
Program.cs(1,19): error CS1010: Newline in constant

No output appears. The compiler could not finish translating the program, so the program never started.

divider

Checkpoint

Before moving on, confirm that:

  • template-console is unchanged.
  • 1-01-hello asks for a name and uses it in a greeting.
  • 1-01-about-me displays three separate lines.
  • Both programs run without an error.
divider

Reflection

Answer the following questions before submitting your work.

  1. You will answer questions about your Create program without a computer on exam day. Why does that make using someone else's code a bad deal for you specifically?
  2. Give one reason copying a template is better than editing the original.
  3. Describe one thing on your screen today that did not do what you expected and what you did about it.
divider

Submit

Submit your completed activity sheet. Keep both program folders in your workspace.

Activity Complete