What is the output of the following code?
s = "Python"
print(s[1:4])
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()
20 questions
Python Recap
Quiz
•
7th Grade - University
22 questions
CodeHS AP CSP Unit 3 Review
Quiz
•
11th - 12th Grade
19 questions
Programming Techniques Survey
Quiz
•
8th - 12th Grade
20 questions
Python
Quiz
•
12th Grade
20 questions
Unit 3 Python TEST
Quiz
•
11th - 12th Grade
15 questions
Grade 12-Python selection&iteration
Quiz
•
11th - 12th Grade
18 questions
CS Unit 1, Programming part 1: Sequences
Quiz
•
9th - 12th Grade
16 questions
Python Basics
Quiz
•
KG - University
15 questions
Character Analysis
Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing
Quiz
•
9th - 12th Grade
10 questions
American Flag
Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension
Quiz
•
5th Grade
30 questions
Linear Inequalities
Quiz
•
9th - 12th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25
Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers
Quiz
•
6th - 8th Grade
17 questions
Chapter 12 - Doing the Right Thing
Quiz
•
9th - 12th Grade
30 questions
Linear Inequalities
Quiz
•
9th - 12th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
20 questions
Taxes
Quiz
•
9th - 12th Grade
17 questions
Parts of Speech
Quiz
•
7th - 12th Grade
20 questions
Chapter 3 - Making a Good Impression
Quiz
•
9th - 12th Grade
20 questions
Inequalities Graphing
Quiz
•
9th - 12th Grade
10 questions
Identifying equations
Quiz
•
KG - University