Strings Test a

By Mickey Arnold
Last updated 10 months ago
20 Questions

What is output by the following code?
s = "dog food";
print( s )

What is output by the following code?
s = "www.apluscompsci.com";
print( s )

What is output by the following code?
s = "dog";
print( len(s) )

What is output by the following code?
s = "dog food";
print( len(s) )

What is output by the following code?
s = "www.apluscompsci.com";
print( len(s) )

What is output by the following code?
s = "www.apluscompsci.com";
print( s[0] )

What is output by the following code?
s = "www.apluscompsci.com";
print( s[1] )

What is output by the following code?
s = "www.apluscompsci.com";
print( s[4] )

What is output by the following code?
s = "www.apluscompsci.com";
print( s[5] )

What is output by the following code?
s = "www.apluscompsci.com";
print( s[0:2] )

What is output by the following code?
s = "www.apluscompsci.com";
print( s[2:5] )

What is output by the following code?
s = "www.apluscompsci.com";
print( s[0:0] )

What is output by the following code?
s = "www.apluscompsci.com";
print( s[0:1] )

What is output by the following code?
s = "www.apluscompsci.com";
print( s[:-2] )

What is output by the following code?
s = "www.apluscompsci.com";
print( s[8:-2] )

What is output by the following code?
s = "www.apluscompsci.com";
print( s[8:-4] )

What is output by the following code?
s = "www.apluscompsci.com";
print( s.find("s") )

What is output by the following code?
s = "www.apluscompsci.com";
print( s.rfind("s") )

What is output by the following code?
s = "www.apluscompsci.com";
print( s.find("x") )

What is output by the following code?
s = "www.apluscompsci.com";
print( s.rfind("co") )