![](https://static.isu.pub/fe/default-story-images/news.jpg?width=720&quality=85%2C50)
1 minute read
Strings
The content covered in this chapter is aligned with the following CSTA Standard
● 1B-AP – 08 Algorithms
This chapter is divided into the following lab sessions
1. Strings I
2. Strings II
3. Strings III
4. Strings IV
5. Project – My Profile
1. Strings I
Objectives
In this session, students will learn about -
● What are Strings
■ Length of String
■ Empty String
Keywords
● Strings: Are values put inside double quotes (“ ”) in the text block. These values can be words, numbers, symbols, characters, or a combination of all these.
● Length of String: Is a function that gives the length of the input String as the result
● Empty String: Gives a true or false output depending on whether the String is empty or not
WEBS at a Glance
Recall the concepts covered in the previous coding session
Play the video given in the panel to introduce the concepts to be covered in this session
● Instruct: Go to the Panel and open the Lab on Strings I.
● Play the video given in the panel.
● Discuss the Quiz questions given in the Panel.
● Invite answers from as many students as possible.
● Conduct the activity Let’s learn String basics given in the Panel:
■ Say: Let’s see how we can add our name and find its length.
■ Instruct: Click on the Assignment section.
■ Instruct: Click the Go to Practice button to attempt the activity.
■ Walk around in the classroom and observe the activity done by the students.
■ Instruct: Click on the Yes button to submit the activity.
Note
● If time permits, conduct the additional activity given in the panel.
● Ask the following probing questions:
■ What can you store in a string? Give a few examples of strings. Possible Responses: Names; Places or Addresses; A sentence; Numbers; Special characters. Examples – “Newt”; “I love coding”; “Hello, Koi”; “123”; “Hi!”.
■ Do you think we can perform addition and subtraction in strings?
Possible Responses: No, we cannot perform general mathematical operations in strings. Addition of strings is possible though. It adds or joins two strings together.
● Assign the following project as homework:
■ Compare and check if two strings are equal or not.
Note
● The project is optional. Assign it if feasible.