String Data Type(Python)

Quiz
•
Computers
•
12th Grade
•
Hard
Namal (ITNamal)
Used 3+ times
FREE Resource
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code?
s = "Python"
print(s[1:4])
a) 'ytho'
b) 'Pyt'
c) 'yth'
d) 'tho'
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code?
s = "hello"
print(s.capitalize())
a) 'HELLO'
b) 'Hello'
c) 'hELLO'
d) 'hello'
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following methods would you use to convert all characters in a string to lowercase?
a) toLowerCase()
b) lowercase()
c) lower()
d) to_lower()
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code?
s = "Hello, World!"
print(s.split(","))
a) ['Hello', 'World!']
b) ['Hello', ' World!']
c) ['Hello, ', 'World!']
d) ['Hello', 'World']
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you concatenate two strings, 'str1' and 'str2', in Python?
a) str1.concat(str2)
b) str1 + str2
c) str1.append(str2)
d) str1 & str2
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the result of the following code?
s = "Python"
print(s[-1])
a) P
b) o
c) n
d) h
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which method would you use to remove whitespace from the beginning and end of a string?
a) strip()
b) trim()
c) remove()
d) delete()
Create a free account and access millions of resources
Similar Resources on Wayground
25 questions
Introduction to Python

Quiz
•
KG - University
20 questions
Python while loops

Quiz
•
12th Grade
20 questions
Python Programming Quiz

Quiz
•
9th Grade - University
20 questions
Unit 3 Python TEST

Quiz
•
11th - 12th Grade
20 questions
ASK T2 - Kod Arahan (Python)

Quiz
•
7th Grade - University
18 questions
CS Unit 1, Programming part 1: Sequences

Quiz
•
9th - 12th Grade
25 questions
PYTHON QUIZ 1

Quiz
•
11th - 12th Grade
15 questions
Quiz on String

Quiz
•
12th Grade
Popular Resources on Wayground
50 questions
Trivia 7/25

Quiz
•
12th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
11 questions
Negative Exponents

Quiz
•
7th - 8th Grade
12 questions
Exponent Expressions

Quiz
•
6th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
20 questions
One Step Equations All Operations

Quiz
•
6th - 7th Grade
18 questions
"A Quilt of a Country"

Quiz
•
9th Grade