#### Iteration and Recursion One Mark Questions

11th Standard

Reg.No. :
•
•
•
•
•
•

Computer Science

Time : 00:30:00 Hrs
Total Marks : 10
10 x 1 = 10
1. A loop invariant need not be true

(a)

at the start of the loop

(b)

at the start of each iteration

(c)

at the end of each iteration

(d)

at the start of the algorithm

2. We wish to cover a chessboard with dominoes, the number of black squares and the number of white squares covered by dominoes, respectively, placing a domino can be modeled by

(a)

b:= b + 2

(b)

w:= w + 2

(c)

b, w := b1+, w1+

(d)

b:= w

3. If m x a + n x b is an invariant for the assignment a, b : = a + 8, b + 7, the values of m and n are

(a)

m=8,n=7

(b)

m=7,n=-8

(c)

m=7,n=8

(d)

m =8,n=-7

4. If Fibonacci number is defined recursively as$f(n)=\begin{cases} 0n=0 \\ 1n=1 \\ f(n-1)+f(n-2)otherwise \end{cases}$to evaluate F(4), how many times F() is applied?

(a)

3

(b)

4

(c)

8

(d)

9

5. Using this recursive definition${ a }^{ n }=\begin{cases} 1\quad \quad \quad \quad \quad \quad ifn=0 \\ a\times { a }^{ n }-1\quad otherwise \end{cases}$how many multiplications are needed to calculate a10?

(a)

11

(b)

10

(c)

9

(d)

8

6. Which of the following algorithm design techniques to execute the same action repeatedly

(a)

Assignment

(b)

Iteration

(c)

Recursion

(d)

Both b and c

7. Which statements executed repeatedly as long as the loop condition is true?

(a)

Sequential

(b)

Abstraction

(c)

Iteration

(d)

Assignment

8. Which of the following is updated when each time the loop body is executed?

(a)

Data

(b)

Variables

(c)

Function

(d)

All of these

9. The unchanged variables of the loop body is called loop

(a)

condition

(b)

loop statement

(c)

loop variable

(d)

loop invariant

10. Which of the following is the key to construct iterative algorithms

(a)

loop invariant

(b)

loop updation

(c)

loop variable

(d)

lop condition