WorksheetsUnit 7 quiz on strings AP CSP
Total questions: 14
Worksheet time: 10mins
What is the output from this code?
ell
llo
ello,
Hello
What is the output from this code?
, W
Wor
orl
lro
What will be the output of the “hello” +1+2+3?
hello123
hello
Error
hello6
which of the following is incorrect?
String is immutable.
Strings are stored in a list when we save them.
lower() function in string is used to return a string by converting the whole given string into lowercase.
str.pop(), will remove the last value of the string called, str
For string symbol + means........................
addition
swapp
concatenation
multiplication
str1='101'
x=int(str1)
z=x+400
print(z)
101400
x400
501
none of above
fruit1="kiwi"
fruit2="strawberry"
print(len(fruit1))
print(len(fruit2))
kiwi and strawberry
4
10
4 10
410
Slicing string
x="BOnvoyage
print(x[4: ])
BOnvo
bonvo
oyage
VOYAGE
Select the characters that can be found in a String
Letters
Numbers
Symbols
What does the following code return?
str = 'Python'
print(str[1:4])
Pyt
yth
tho
ytho
What is printed by the following statement?
print("A" in "APCSP")
Prints True
Prints False
Prints, 0 for index where it is found
What will the output be from the following code?
print("3+4")
7
34
3+4
SyntaxError
Fill in the blank to check if 2 consecutive letters are the same:
for i in range(len(str)):
if ________:
print("same")
str(i)==str(i+1)
str[i]==str[i+1]
str[i] ==str[i:i+1]
str[i]==str[i:i+2]
Mathematical operations can be performed on a string
True
False
