Python: Strings

Python: Strings

University

9 Qs

quiz-placeholder

Similar activities

Lists

Lists

University

10 Qs

PYTHON BASICS PART 1

PYTHON BASICS PART 1

University

10 Qs

DSA quiz 3 set 1

DSA quiz 3 set 1

University

10 Qs

Types of Mass Media

Types of Mass Media

10th Grade - Professional Development

11 Qs

IP-Com3 - Clase 2

IP-Com3 - Clase 2

University

12 Qs

DC024 QUIZ

DC024 QUIZ

University

11 Qs

Introduction to Computer Programs

Introduction to Computer Programs

University

10 Qs

Python: Strings

Python: Strings

Assessment

Quiz

Computers

University

Practice Problem

Medium

Created by

Dr.SL Rao

Used 8+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

9 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the following Python Program print out?

str1 = "Hello"

str2 = 'there'

s = str1 + str2

print(s)

Hello

there

Hellothere

Hello there

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the following Python Program print out?

x = '40'

y = int(x) + 2

print(y)

42

402

int402

x2

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How would you use the index operator [] to print out the letter h from the following string

x = 'Python Programming Strings'

print(x[4])

print(x[h])

print(x[3])

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How would you use the slicing [:] to print out the letter 'gram' from the following string

x = 'Python Programming Strings'

print(x[10:13])

print(x[10:14])

print(x[9:12])

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the iteration variable in the following Python code?

for letter in 'banana' :

print(letter)

in

letter

for

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How would you print out the following variable in all upper case in Python?

greet = 'Hello Everyone'

print(greet.ucase())

print(greet.touppercase())

print(greet.upper())

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following string methods removes whitespace from both the beginning and end of a string?

strip()

rstrip()

strtrunc()

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Computers