
Strings
Presentation
•
Computers
•
9th - 12th Grade
•
Practice Problem
•
Medium
J. Moore
Used 3+ times
FREE Resource
9 Slides • 12 Questions
1
Storing Strings
Based on Kahn Academy and Daily Videos
2
When we're making a program, we often want to store sequences of letters, like storing “easy” as a game's difficulty level. In programming lingo, we call each letter a character and we call the sequence a string.
3
A string can contain any number of characters, including none at all, and those characters can be letters, numbers, or symbols.
Notice how each string is surrounded by double quotes on either side. If you don’t put any quotes around a string, JavaScript will get confused.
4
Open Ended
Tell me what is wrong with these variables?
5
Multiple Select
Which of these are valid lines of JavaScript to store a string?
Choose all answers that apply:
var age = "35";
var greeting = "Ahoy, matey;
var empty = " ";
var nickname = Polly";
var title = "I, Robot";
6
Explanation
Several of the strings are invalid as they do not have a quote on both sides:
var nickname = Polly";
var greeting = "Ahoy, matey;
var store = BotsRUs;
The rest of the strings are valid, as they are fully quoted and are made up of letters, numbers, spaces, and symbols.
7
Pseudocode for strings
What's pseudocode?
Pseudocode is a language that represents programming concepts generally but doesn't actually run anywhere. Pseudocode is useful for planning programs and for thinking about code independently of a specific programming language. The AP CSP exam uses pseudocode for all the questions, so we use pseudocode for our exercises here.
8
Pseudocode for strings
What's pseudocode?
This pseudocode represents storing a string:
a ← "STRING"
Whenever you see that pseudocode, it means that the variable a (or whatever it's called) is storing the string inside the double quotes.
For example, you might see pseudocode like this:
difficulty ← "medium"
That means the variable difficulty is storing the string "medium".
9
Multiple Choice
What is the pseudocode equivalent of this JavaScript?
var hair = "curly";
hair = "curly"
hair ← curly
hair ← "curly"
hair = curly
10
Explanation
hair = curly
This pseudocode is using = instead of ←. In the pseudocode used here (and on the AP CSP exam), ← represents variable assignment. In addition, this pseudocode is missing quotation marks around the string value.
hair ← curly
This pseudocode is missing quotation marks around the string value.
hair = "curly"
This pseudocode is using = instead of ←. In the pseudocode used here (and on the AP CSP exam), ← represents variable assignment.
11
Multiple Choice
What is the pseudocode equivalent of this JavaScript?
var password = "2278";
password = 2278
password = "2278"
password ← 2278
password ← "2278"
12
Explanation
password = 2278
This pseudocode is using = instead of ←. In the pseudocode used here (and on the AP CSP exam), ← represents variable assignment. In addition, this pseudocode is missing quotation marks around the string value.
password = "2278"
This pseudocode is using = instead of ←. In the pseudocode used here (and on the AP CSP exam), ← represents variable assignment.
password ← 2278
This pseudocode is missing quotation marks around the string value.
13
Fill in the Blanks
Type answer...
14
The following variable assignments are from an online music app.
Identify which variables store numbers and which store strings:
15
Multiple Choice
title ← "I am a rock"
String
Number
16
Multiple Choice
minutes ← 2
String
Number
17
Multiple Choice
seconds ← 50
String
Number
18
Multiple Choice
artist ← "Simon & Garfunkel"
String
Number
19
Multiple Choice
recorded ← "Dec 14, 1965"
String
Number
20
Multiple Select
Google Maps lets users search for anything in the world:
The code to display the map and search results relies on many variables.
Which of these variables are storing a string data type?
👁️Note that there may be multiple answers to this question.
Choose all answers that apply: Choose all answers that apply:
city ← "Beverly Hills"
temp ← 63
weather ← "Partly Cloudy"
state ← "CA"
searchQuery ← "90210"
21
Multiple Choice
Isabel is programming an app called Plantwatch, which lets users monitor the health of their plants.
Which variable would she most likely use a string data type for?
Choose 1 answer:
species: The name of the plant species
numLeaves: The number of leaves on the plant
moisture: The percentage of water in the soil
acidity: The pH level of the soil
height: The height of the plant in centimeters
Storing Strings
Based on Kahn Academy and Daily Videos
Show answer
Auto Play
Slide 1 / 21
SLIDE
Similar Resources on Wayground
16 questions
Adjectives
Presentation
•
9th - 12th Grade
16 questions
Air Masses
Presentation
•
9th - 12th Grade
16 questions
Cell Cycle and Cancer Lesson
Presentation
•
9th - 12th Grade
17 questions
Social Media
Presentation
•
9th - 12th Grade
18 questions
Drama Intro
Presentation
•
9th - 12th Grade
16 questions
Lists Pseudocode
Presentation
•
9th - 12th Grade
17 questions
Study Skills 1
Presentation
•
9th - 11th Grade
16 questions
Linear and Exponential Functions
Presentation
•
9th - 12th Grade
Popular Resources on Wayground
20 questions
STAAR Review Quiz #3
Quiz
•
8th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
6 questions
Marshmallow Farm Quiz
Quiz
•
2nd - 5th Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
20 questions
Inferences
Quiz
•
4th Grade
19 questions
Classifying Quadrilaterals
Quiz
•
3rd Grade
12 questions
What makes Nebraska's government unique?
Quiz
•
4th - 5th Grade
Discover more resources for Computers
7 questions
Warm Up 04.01.2026
Quiz
•
9th Grade
50 questions
STAAR English 2 Review
Quiz
•
10th Grade
20 questions
Graphing Inequalities on a Number Line
Quiz
•
6th - 9th Grade
20 questions
Figurative Language Review
Quiz
•
10th Grade
20 questions
Linear Functions Review
Quiz
•
9th Grade
30 questions
English 1 STAAR Review
Quiz
•
9th Grade
10 questions
Pythagorean Theorem and its Converse
Quiz
•
7th - 9th Grade
14 questions
Ecological Succession: Primary and Secondary
Quiz
•
9th Grade