Page 224 - Computer Science V2.0 Class 11
P. 224
C. Fill in the blanks.
1. This process of dividing a computer program into separate independent blocks of code is known as _____________
programming.
2. _____________ keyword is used to define a function.
3. In the absence of any return statement, the function returns _____________ to the calling function.
4. A _____________ is a sub-program that acts on data and often returns a value.
5. _____________ are pre-defined functions that can be directly used anywhere in the program.
6. The function header always ends with a _____________.
7. This list of values given during the function call are called _____________.
8. The functions which do not return any value are called _____________ functions.
D. Answer the following questions:
1. Define modular programming.
Ans. This process of dividing a computer program into separate independent blocks of code or sub-programs with different
names and functionalities is known as modular programming.
2. Give any two advantages of computers.
Ans. Functions increase reusability of code.
The program is better organized and easy to understand.
3. Name different types of functions.
Ans. User defined functions, built-in functions, and functions defined in modules.
4. Will the following code execute successfully? If yes, what will be the output produced on its execution. If not, identify the
errors in the given code:
side = input('Enter side of a square: ')
perimeter = 4*side
print('The perimeter of square is ', perimeter)
Ans. The above code will execute successfully and will produce the following output on its execution.
Enter side of a square: 12
The perimeter of square is 12121212
5. The following code is intended to compute the perimeter of a square. Will it achieve the desired goal? If yes, what will be
the output produced on its execution? If not, identify the errors in the given code:
side = input('Enter a number')
perimeter = 4*Side
PRINT('The area is ', area)
Ans. side = int(input('Enter a number')) # Need to convert str to int
perimeter = 4*side # Identifiers are case sensitive
print('The perimeter is ' , perimeter) # no function by the name
#PRINT. Identifiers are case sensitive
6. Consider the following function which give an example of a function call (Statement 1) for the following function definition:
def tourAmount(no_of_pax):
return no_of_pax * 1500
no_of_pax = int(input("Enter the number of passengers : "))
_________________________________ #Statement 1
print(amount)
Ans. amount=tourAmount(no_of_pax)
210 Touchpad Computer Science (Ver. 2.0)-XI

