0% found this document useful (0 votes)
19 views2 pages

Class Activity Strings

The document discusses strings in programming and provides examples of string methods in Python. It contains questions about strings and tasks to practice converting case and slicing strings. String methods demonstrated include upper(), lower(), len(), and indexing the first few characters.

Uploaded by

yuno nAH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views2 pages

Class Activity Strings

The document discusses strings in programming and provides examples of string methods in Python. It contains questions about strings and tasks to practice converting case and slicing strings. String methods demonstrated include upper(), lower(), len(), and indexing the first few characters.

Uploaded by

yuno nAH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Unit 2 Programming

7 Strings (Student book, pages 54–61)

1 Which of the following best describes a string? (1)

a) a sequence of letters and numbers


b) a sequence of numbers and symbols
c) a sequence of letters, numbers, symbols and punctuation marks
d) a sequence of letters, numbers and symbols

2 Cycling through each character in a string is called ………… (1)

a) string concatenation
b) string traversal
c) string formatting
d) string slicing

3 Which of the following is the process of joining two or more or strings together? (1)

a) string concatenation
b) string traversal
c) string formatting
d) string slicing

4 Which of the following is the index of the letter ‘o’ in the string ‘Edexcel Examinations
Board’? (1)

a) 23
b) 18
c) 17
d) 22

6 Complete the following algorithm to concatenate the variables in lines 1 and 2 to produce a
message welcoming the user. (2)
1 RECEIVE firstName FROM (STRING) KEYBOARD
2 RECEIVE surname FROM (STRING) KEYBOARD
3 SEND firstName , surname TO DISPLAY

© Pearson Education Ltd, 2020. Copying permitted for purchasing institution only. This material is not copyright free.
7 A student used the following line in an algorithm:

SEND ‘Please enter the person’s name’ TO DISPLAY

It did not give the expected result. Explain why and write a correct version. (2)

It didn’t give a correct result as the student made it a string instead of a variable, the outut
would be – please enter the person’s name – and that’s it, not letting the user input their
name. the correct pseudocode would be:

SET name TO “ “
SEND “Please enter the person’s name” TO DISPLAY
RECEIVE name FROM (STRING) KEAYBOARD

Extra quote in “peron’s”

Task 2
The string
Text = Computer Science

1. Using python convert the string to all upper case


print(text.upper())

2. Using python convert the string to all lower case


print(text.lower())

3. Show the output using the len() function


4. Print the first 3 characters.

Paste the code into your VEB book under the title “Strings”

© Pearson Education Ltd, 2020. Copying permitted for purchasing institution only. This material is not copyright free.

You might also like