NEW
Font size
WorksheetsBasic Programming Quiz
Total questions: 27
Worksheet time: 14mins
What is a string?
A type of list
A programming language
A collection of numbers
A collection of characters
How can you write a string?
Using brackets
Using single or double quotes
Using curly braces
Using angle brackets
What does print(text[0]) return if text = 'Python'?
P
n
y
h
What does print(text[-1]) return if text = 'Python'?
P
y
n
h
What is the output of print(text[0:6]) if text = 'PythonProgramming'?
P
Pytho
Programming
Python
What function do you use to find the length of a string?
len()
count()
length()
size()
What does the method upper() do?
Makes text uppercase
Makes text lowercase
Counts letters
Removes spaces
What is a list?
A collection of characters
A programming function
A type of string
A collection of multiple values
How do you create a list of numbers?
numbers = (1, 2, 3, 4)
numbers = [1, 2, 3, 4]
numbers = {1, 2, 3, 4}
numbers = '1, 2, 3, 4'
What does print(names[0]) return if names = ['Abhishek', 'Ravi', 'Amit']?
Ravi
Amit
None
Abhishek
What does print(nums[1:4]) return if nums = [10, 20, 30, 40, 50]?
[20, 30, 40]
[30, 40, 50]
[10, 30, 50]
[10, 20, 30]
What does the method append() do?
Adds one element
Removes an element
Clears the list
Sorts the list
What does the method remove() do?
Reverses the list
Sorts the list
Removes a value
Adds an element
What does the method pop() do?
Removes by index
Removes by value
Clears the list
Adds an element
What does the method sort() do?
Removes all elements
Adds an element
Sorts the list
Reverses the list
What is the output of print(nums[::2]) if nums = [10, 20, 30, 40, 50]?
[10, 20, 30]
[20, 30, 40]
[10, 30, 50]
[30, 40, 50]
What does the method clear() do?
Adds an element
Sorts the list
Removes all elements
Reverses the list
What is the first character of the string 'Python'?
n
t
y
P
What does the method find() do?
Finds a character
Counts characters
Removes spaces
Replaces text
What is the output of print(text[-11:]) if text = 'PythonProgramming'?
Pytho
Python
None
Programming
What does the method title() do?
Makes every word capital
Makes text lowercase
Removes spaces
Counts letters
What is the output of print(len('Abhishek'))?
7
8
9
10
What does the method reverse() do?
Reverses the list
Removes all elements
Sorts the list
Adds an element
What is the last character of the string 'Python'?
n
o
y
P
What does the method replace() do?
Counts characters
Replaces text
Finds a character
Removes spaces
What is the output of print(nums[:3]) if nums = [10, 20, 30, 40, 50]?
[20, 30, 40]
[10, 30, 50]
[10, 20, 30]
[30, 40, 50]
What does the method count() do?
Counts words
Finds position
Replaces text
Removes spaces
