Search Header Logo

CPT C04 Programming (math, random, string, logical)

Authored by woai chemhepython

Information Technology (IT)

10th Grade

Used 2+ times

CPT C04 Programming (math, random, string, logical)
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

32 questions

Show all answers

1.

FILL IN THE BLANKS QUESTION

1 min • 1 pt

What will be the output of the following Python code? (Please ignore the erratic indentation)

text = "Hello World"

print(text.lower())

(a)  

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the split() method do in Python?

Joins a list of strings into a single string

Splits a string into a list based on a delimiter

Finds the index of a substring

Replaces a substring with another string

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following statements correctly removes whitespace from both ends of a string?

text.strip()

text.trim()

text.remove_spaces()

text.split()

4.

FILL IN THE BLANKS QUESTION

1 min • 1 pt

What will be the output of the following Python code? (Please ignore the erratic indentation)

word = "Python"

print(word[::-1])

(a)  

5.

FILL IN THE BLANKS QUESTION

1 min • 1 pt

What will be the output of the following Python code? (Please ignore the erratic indentation)

s = "apple,banana,cherry"

print(s.split(","))

(a)  

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following Python expressions will correctly extract "Python" from the string

text = "Learn Python Programming"?

test[6:12]

text.split()[1]

text.find("Python")

text[6:11]

7.

FILL IN THE BLANKS QUESTION

1 min • 1 pt

What will be the output of the following code? (Please ignore the erratic indentation)

s = "O-Level Computing"

print(s[-9:])

(a)  

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

Microsoft

Continue with Microsoft

or continue with

Facebook

Facebook

Apple

Apple

Others

Others

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?