Page 126 - Trackpad_V4.0_C8_Flipbook
P. 126
Quick Quiz
1. What is a function in programming?
a. A collection of variables b. A reusable block of code that performs a specific task
2. In programming, a function is designed to:
a. Store data b. Perform a specific task or operation
3. Which of the following is an example of a built-in function in most programming languages?
a. User-defined function b. String manipulation function
Recap
Functions help us to break our program into smaller parts or modules.
Python functions are categorised into in-built functions and user-defined functions.
A sequence of characters that are enclosed or surrounded by single (‘ ’), double (“ ”), or triple (“‘ ’”)
quotes is known as a string.
Two basic string operators in Python are + and *. Python uses + for concatenation and * for
replication.
Assess Yourself
Choose the correct option.
1. Block of organised and reusable code used to perform a single or related action is called ___________.
a. function b. string
c. statement d. arguments
2. Identify what is not the component of Python function.
a. Arguments b. Return value
c. Name of the function d. Escape sequence
3. Mark the built-in function from the given list.
a. show() b. print()
c. myname() d. display()
4. Output of print(“Hello” + “How are you “) statement is
a. Hello How are you b. HelloHowareyou
c. HelloHow are you d. HELLO HOW ARE YOU
Premium Edition-VIII
124

