Log in
Sign up for FREE
arrow_back
Library
Strings Test a
By Mickey Arnold
star
star
star
star
star
Share
share
Last updated almost 2 years ago
20 questions
Add this activity
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
Question 1
1.
What is output by the following code?
s = "dog food";
print( s )
dog food
food
dog
food dog
Question 2
2.
What is output by the following code?
s = "www.apluscompsci.com";
print( s )
apluscompsci
www
com
www.apluscompsci.com
Question 3
3.
What is output by the following code?
s = "dog";
print( len(s) )
4
2
5
3
Question 4
4.
What is output by the following code?
s = "dog food";
print( len(s) )
8
4
7
3
Question 5
5.
What is output by the following code?
s = "www.apluscompsci.com";
print( len(s) )
10
20
15
12
Question 6
6.
What is output by the following code?
s = "www.apluscompsci.com";
print( s[0] )
a
w
s
p
Question 7
7.
What is output by the following code?
s = "www.apluscompsci.com";
print( s[1] )
s
w
p
a
Question 8
8.
What is output by the following code?
s = "www.apluscompsci.com";
print( s[4] )
w
s
p
a
Question 9
9.
What is output by the following code?
s = "www.apluscompsci.com";
print( s[5] )
s
w
p
a
Question 10
10.
What is output by the following code?
s = "www.apluscompsci.com";
print( s[0:2] )
w.a
apl
www
ww
Question 11
11.
What is output by the following code?
s = "www.apluscompsci.com";
print( s[2:5] )
ww
www
w.a
apl
Question 12
12.
What is output by the following code?
s = "www.apluscompsci.com";
print( s[0:0] )
nothing
a
w
p
Question 13
13.
What is output by the following code?
s = "www.apluscompsci.com";
print( s[0:1] )
p
w
nothing
a
Question 14
14.
What is output by the following code?
s = "www.apluscompsci.com";
print( s[:-2] )
www.apluscompsci.co
www.apluscompsci.c
w.apluscompsci.com
www.apluscompsci.com
Question 15
15.
What is output by the following code?
s = "www.apluscompsci.com";
print( s[8:-2] )
apluscompsci.c
scompsci.c
scompsci
www.apluscompsci.com
Question 16
16.
What is output by the following code?
s = "www.apluscompsci.com";
print( s[8:-4] )
Question 17
17.
What is output by the following code?
s = "www.apluscompsci.com";
print( s.find("s") )
Question 18
18.
What is output by the following code?
s = "www.apluscompsci.com";
print( s.rfind("s") )
Question 19
19.
What is output by the following code?
s = "www.apluscompsci.com";
print( s.find("x") )
Question 20
20.
What is output by the following code?
s = "www.apluscompsci.com";
print( s.rfind("co") )