Page 181 - DCAP407_DATA_STRUCTURE
P. 181
Data Structure
9.7 Keywords
Actual Arguments: The arguments defined in a caller function and provided in the function call are
termed as actual arguments.
Formal Arguments: The arguments defined in the function definition are termed as formal arguments.
Mantissa: It is the part of a floating-point number that contains its significant digits.
Stack: Stack is an abstract or a last in first out (LIFO) data type and data structure. It is characterized by
two fundamental operations like push and pop.
9.8 Self Assessment
1. State whether the following statements are true or false:
(a) The actual arguments are defined in the function definition.
(b) Recursive algorithms are mainly used for manipulating data structures which are defined
recursively.
(c) If a function is invoked with a base case, a result is returned as an output from the function.
(d) In the Tower of Hanoi problem, multiple discs can be transferred at a time.
(e) To transfer ‘n’ discs from ‘A’ to ‘C’ in Tower of Hanoi, the recursive method firstly involves
the transfer of (n-1) discs from ‘A’ to ‘B’.
(f) When a function is invoked, the run-time system allocates memory spaces dynamically for
storing parameters, variables, and constants that are defined within it.
2. Fill in the blanks:
(a) ……………………………… starts with 0 and 1 and computes the subsequent numbers using
the sum of the previous two numbers.
(b) ……………………………… is a traditional game and an example of recursion.
(c) In…………………………… the body loop terminates when the termination condition fails.
(d) ……………………………… is a block of statements that can be utilized to perform a
particular task.
(e) ……………………………… is costly in terms of memory usage and processor time.
3. Select a suitable choice for every question:
(a) Which among the following is a function that invokes an instance of itself directly or
indirectly?
(i) Iteration
(ii) Recursion
(iii) Repetition
(iv) Duplication
(b) What does recursion mean?
(i) Self reference
(ii) Self iteration
(iii) Self repetition
(iv) Self rehearsal
174 LOVELY PROFESSIONAL UNIVERSITY