Page 125 - trackpad v5.1 class 8 flipbook
P. 125
1. Tick ( ) the correct option.
a. Which of the following is a built-in function in Python?
(i) custom_function() (ii) print()
(iii) my_function() (iv) user_function()
b. Which of the following is the correct syntax to define a function in Python?
(i) function my_function() (ii) def my_function[]
(iii) define my_function(): (iv) None of these
c. Which of the following is used to repeat the string a given number of times?
(i) String Concatenation operator (ii) String Replication operator
(iii) len() function (iv) range() function
d. Which of the following escape sequence inserts a new line in a string?
(i) \t (ii) \n
(iii) \r (iv) \b
e. Identify the operator used to concatenate two strings in Python.
(i) * (ii) &
(iii) + (iv) %
2. Fill in the blanks using the words from the help box.
string, append, length, lower, function
a. The _______________ function inserts the object passed to it at the end of the list.
b. A _______________ can be defined as a block of reusable code that performs a specific task.
c. The _______________ function converts all uppercase letters to lowercase.
d. A consecutive sequence of characters that is enclosed or surrounded by single or double quotes is
known as a _______________.
e. The _______________ function calculates and returns the length of a string supplied as an argument.
3. Write 'T' for true and 'F' for false.
a. Traversing means visiting each element and processing it as required by the program.
b. A single-line string in Python begins and ends with either three single quotes or three
double quotes.
c. A list is a type of container that is used to store a list of values of any type.
d. A del( ) function to remove a sublist.
e. The print() and input() belong to the category of user-defined functions.
Functions, String and List in Python 123

