Python: Strings

Python: Strings

University

9 Qs

quiz-placeholder

Similar activities

A3 IB - Introducción a Python

A3 IB - Introducción a Python

11th Grade - University

10 Qs

Python Basics

Python Basics

University

10 Qs

Python Basics Quiz for KS3

Python Basics Quiz for KS3

11th Grade - University

9 Qs

PYTHON DAY 2

PYTHON DAY 2

University

12 Qs

Python Basics

Python Basics

University

12 Qs

J277 - 2.2 - Functions in Python

J277 - 2.2 - Functions in Python

10th Grade - University

10 Qs

Exploring Python: Input and Output Essentials

Exploring Python: Input and Output Essentials

9th Grade - University

10 Qs

PF Unit  10

PF Unit 10

9th Grade - University

10 Qs

Python: Strings

Python: Strings

Assessment

Quiz

Computers

University

Medium

Created by

Dr.SL Rao

Used 8+ times

FREE Resource

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()

8.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

what is the output of this code?

data = 'From ArunaRao.SL@gmail.com Sat December 11 11:20:16 2020'

pos = data.find('.')

print(data[pos:pos+3])

.SL

.gma

gma

SL@

9.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

what is the output of this code?

print(len('banana')*7)

banana7

42

-1

banana banana banana banana banana banana banana