Summative #7 Flashcards

1
Q

What are the mandatory parts of a function declaration?

A

return type and function name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

A function that can be made to return a single value to the calling program.

A

void

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The program that calls a function is often referred to as the calling program.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Recursion is a method in which the solution of a problem depends on ____________

A

the solutions to smaller instances of the same problem.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which data structure is used to perform recursion?

A

Stack

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which of the following problems can’t be solved using recursion?

A

Problems without base case

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

The case in which the routine calls itself to perform a subtask is called as

A

recursive case

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Recursion is similar to which of the following?

A

a loop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which of the following problems can be solved using recursion?

A

i. Factorial of a number
ii. Nth Fibonacci number
iii. Length of a string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

The correspondence between actual and formal parameter is one-to-one basis according to the respective orders.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Function prototype provides the basic information about a function which tells the compiler that the function is used correctly or not.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

A function that can be made to return a single value to the calling program is referred to as void function.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

The function prototype contains different information than the function header contains.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

If a variable is declared inside a function, what kind of variable is this?

A

Local Variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

If the function returns a value then the return_type must be void.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

The following are problems that often have simple recursive solutions except ________.

A

display an output

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Recursion itself cannot be used as a replacement to iteration or looping

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

The recursive routine always contains a selection statement-either an “if” or a “switch”.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Any problem that can be solved recursively cannot also be solved iteratively.

20
Q

How many recursive calls does the following method contain?

21
Q

When a recursive function is executed, the recursive calls are implemented instantly.

22
Q

A ____________________ structure is the main control structure in a recursive routine, and a ____________________ structure is the main control structure in an iterative routine

A

branching, looping

23
Q

In for loop, the part that defines how the loop control variable will change each time the loop is repeated.

A

increment decrement

24
Q

A continue statement causes execution to skip to ______

A

the next iteration of the loop

25
Which looping process is best used when the number of iterations is known
For loop
26
Which looping process is best used when the number of iterations is known?
For Loop
27
In do-while, statements in the loop are executed first at least once
True
28
Where should the prototype be?
before the int main()
29
What is the value returned as a result when mystery(3) is called?
27
30
Running out of memory may occur due to ______
Recursive function call
31
Recursion makes our code shorter and cleaner.
True
32
A recursive routine performs a task in part by calling itself to perform the subtasks.
True
33
What is the scope of the variable declared in the user defined function?
only inside the { } block
34
If we have a function int stop (int n) , can we send it a different variable in the main program? For example, stop (x)
Yes
35
Only predefined functions can be involved in recursion.
False/ only user defined
36
All the recursive calls are pushed onto the stack
Yes
37
How many times is the recursive function called, when the following code is executed?
11
38
It provides one-way communication of data from the calling program to the function.
Arguments
39
Which of the following is used to terminate the function prototype?
;
40
Recursion can be more difficult to debug compared to an equivalent iterative program.
True
41
What will be the output of the following code? my_recursive_function(100);
cannot be determined
42
Any routine that calls itself is recursive.
True
43
Which of the following statement is correct?
All the parameters of a function can be default parameters.
44
Where does the return statement returns the execution of the program?
calling function
45
A recursive program cannot call itself always, or it would never stop at some point, the routine encounters a subtask that it can perform without calling itself.
Base Case