NEW
Font size
WorksheetsPython String Methods Quiz
Total questions: 15
Worksheet time: 8mins
What is the result of the following string concatenation in Python: "Hello" + " " + "World"?
"HelloWorld"
"Hello World"
"Hello World"
"HelloWorld "
Which of the following operators is used for string concatenation in Python?
*
+
-
/
What will be the output of the following code: print("Python" + "Programming")?
Python Programming
PythonProgramming
Python+Programming
Python Programming
How can you concatenate the strings "Data" and "Science" with a space in between?
"Data" + "Science"
"Data" + " " + "Science"
"Data" * "Science"
"Data" - "Science"
What is the result of slicing the string "HelloWorld" with [:5]?
"Hello"
"World"
"HelloWorld"
"oWorld"
If s = "PythonProgramming", what does s[6:12] return?
"Python"
"Program"
"Progra"
"onProg"
What will be the output of the following code: s = "abcdef"; print(s[2:5])?
"abc"
"bcd"
"cde"
"cdef"
How can you extract the substring "World" from the string "HelloWorld"?
s[5:]
s[6:]
s[5:10]
s[6:11]
What is the result of slicing the string "DataScience" with [-7:]?
"Science"
"Data"
"taScien"
"aScience"
If s = "Business", what does s[:4] return?
"Busi"
"ness"
"Busin"
"Busi"
What will be the output of the following code: s = "abcdef"; print(s[-3:])?
"abc"
"def"
"cde"
"bcd"
How can you concatenate the strings "Grade" and "10" without any space?
"Grade" + "10"
"Grade" + " " + "10"
"Grade" * "10"
"Grade" - "10"
What is the result of slicing the string "Programming" with [3:8]?
"Progr"
"gramm"
"gram"
"rammi"
If s = "Economics", what does s[1:5] return?
"Econ"
"cono"
"cono"
"cono"
What will be the output of the following code: s = "abcdef"; print(s[1:4])?
"abc"
"bcd"
"cde"
"def"
