11th Standard Syllabus & Materials
11th Standard
TN 11th English Supplementary - 3 - The First Patient (Play) Sample Question Papers Study Material - QB365 Set A
NEW11th Standard
TN 11th English Prose - 3 - Forgetting Sample Question Papers Study Material - QB365 Set A
NEW11th Standard
TN 11th English Prose - 2 - The Queen of Boxing Sample Question Papers Study Material - QB365 Set A
NEW11th Standard
TN 11th English Poem - 1 - Once Upon A Time Sample Question Papers Study Material - QB365 Set A
NEW11th Standard
TN 11th English Prose - 1 - The Portrait of a Lady Sample Question Papers Study Material - QB365 Set A
NEW11th Standard
TN 11th Computer Applications Tamil Computing Sample Question Papers Study Material - QB365 Set A

Published on: 02/08/2018
In this question paper, some of the important one mark, two and five marks questions from the chapter Iteration and Recursion are covered. The questions are prepared from the book back and PTA question.
Download Tamil Nadu 11th Standard Computer Science question papers, model tests, one-mark questions, important questions, and public exam papers in PDF format. Free study materials and answer keys for TN State Board students.
Questions + Answers key
Take MCQ Computer Science Test

1.
___________is an algorithm design technique, closely related to induction.
Iteration
Invariant
Loop invariant
Recursion
2.
How many base case at least must be in recursion?
1
2
4
3
3.
How many important points the loop variant is true?
1
2
3
4
4.
Which of the following is a recursive solver case?
Base case
Recursive case
loop case
Both a and b
5.
Which statements executed repeatedly as long as the loop condition is true?
Sequential
Abstraction
Iteration
Assignment
6.
Which of the following algorithm design techniques to execute the same action repeatedly?
Assignment
Iteration
Recursion
Both b and c
7.
Which of the following is not an invariant of the assignment? m, n := m+2, n+3
m mod 2
n mod 3
3 x m - 2 x n
2 x m - 3 x n
8.
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
m = 8, n = 7
m = 7, n = -8
m = 7, n = 8
m = 8, n = -7
9.
A loop invariant need not be true
at the start of the loop
at the start of each iteration
at the end of each iteration
at the start of the algorithm
10.
When will the loop variant be true?
11.
Define factorial of a natural number recursively
12.
What is recursive problem solving?
13.
Define a loop invariant.
14.
What is an invariant?
15.
Write a note on Iteration.
16.
Write a note on Recursion.
17.
Using a loop variant how will you construct a loop?
18.
Consider two variable m and n under the assignment m, n : = m + 3, n - 1. Is the expression m + 3n an invariant?
19.
Show that p - c is an invariant of the assignment. P, C : = P + 1, C + 1
20.
How will you solve a problem using recursion?
21.
Write a note on loop variant?
22.
Give an example for loop invariant.
23.
Explain Loop invariant with a neat diagram.
1.
(d)
Recursion
2.
(a)
1
3.
(d)
4
4.
(d)
Both a and b
5.
(c)
Iteration
6.
(d)
Both b and c
7.
(d)
2 x m - 3 x n
8.
(b)
m = 7, n = -8
9.
(d)
at the start of the algorithm
10.
The loop invariant is true before the loop body and after the loop body, each time.
11.
\(\text { Fact }(\mathrm{n})=\left\{\begin{array}{l}
1 \text { if } \mathrm{n}=0 \\
\mathrm{n} * \text { fact }(\mathrm{n}-1) \text { otherwise }
\end{array}\right.\)
Recursive Algorithm:
Fact (n)
-- inputs: n
outputs: Fact=n!
if(n-0)- --base case
otherwise
1
else
n fact (n-1)--recursive step
12.
1. Recursion is a method of solving problems that involves breaking a problem down into smaller and smaller sub problems until user gets in to a small problem that it can be solved trivially.
2. Usually recursion involves a function calling itself. While it may not seem like much on the surface, recursion allows us to write elegant solutions to problems that may otherwise be very difficult to program.
13.
In iteration, the loop body is repeatedly executed as long as the loop condition is true. Each time the loop body is executed, the variables are updated.
However, there is also a property of the variables which remains unchanged by the execution of the loop body. This unchanging property is called the loop invariant.
14.
An expression involving variables, which remains unchanged by an assignment to one of these variables is called as an invariant of the assignment.
15.
Iteration:
In iteration, the loop body is repeatedly executed as long as the loop condition is true. Each time the loop body is executed, the variables are updated. However, there is also a property of the variables which remains unchanged by the execution of the loop body, This unchanging property is called the loop invariant. Loop invariant is the key to construct and to reason about iterative algorithms.
16.
Recursion:
Recursion is another algorithm design technique, closely related to iteration, but more powerful. Using recursion, we solve a problem with a given input, by solving the same problem with" a part of the input, and constructing a solution to the original problem from the solution to the partial input.
17.
(i) Establish the loop invariant at the start of the loop.
(ii) The loop body should so update the variables as to progress toward the end and maintain the loop invariant, at the same time.
(iii) When the loop ends, the termination condition and the loop invariant should establish the input-output relation
18.
Let P(m, n) = m + 3n. Then
P(m, n) [m, n := m + 3, n -1]
= m + 3n [m, n := m + 3, n -1]
= (m + 3) + 3(n -1)
= m + 3 + 3n - 3
= m + 3n
= P(m, n)
Since (m + 3n) [m, n : = m + 3, n - 1] = m + 3n, m + 3n an invariant of the assignment m, n := m + 3, n-1.
19.
Let P (p, c) = p - c. Then
P (p, c) [p, c := p + 1, c + 1]
= p - c [p, c := p + 1, c + 1]
= (p + 1)-(c + 1)
= p-c
= p(P, c)
Since (p - c) [p, c := p + 1, c + 1] = p - c, p - c is an invariant of the assignment p, c := p + 1, c + 1.
20.
Recursion is another algorithm design technique, closely related to iteration. Using recursion, we solve a problem with a given input, by solving the same problem with a part of the input, and constructing a solution to the original problem from the solution to the partial input.
21.
(I) In iteration, the loop body is repeatedly executed as long as the loop condition is true. Each time the loop body is executed, the variables are updated.
(ii) However, there is also a property of the variables which remains unchanged by the execution of the loop body.
(iii) This unchanging property is called the loop invariant. Loop invariant is the key to construct and to reason about iterative algorithms.
22.
The loop invariant is true in four crucial points in a loop. Using the loop invariant, we can construct the loop and reason about the properties of the variables at these points.
Example:
Design an iterative algorithm to compute an , Let us name the algorithm power(a, n).
For example,
power(10, 4) = 10000
power (5 , 3) = 125
power (2 , 5) = 32
Algorithm power (a, n) computes an by multiplying a cumulatively n times.

The specification and the loop invariant are shown as comments.
power (a, n)
-- inputs: n is a positive integer
-- outputs: p = an
p, i := 1 ,0
while i \(\neq \) n
-- loop invariant: p = a i
p, i:=p x a, i+ 1
The step by step execution of power (2, 5) is shown in Table. Each row shows the values of the two variables p and i at the end of an iteration, and how they are calculated. We see that p = a' is true at the start of the loop, and remains true in each row. Therefore, it is a loop invariant.
| iteration | p | p\(\times \)a | i | i+1 | ai |
| 0 1 2 3 4 5 |
1 2 4 8 16 32 |
1 \(\times \) 2 2 \(\times \) 2 4 \(\times \) 2 8 \(\times \) 2 16 \(\times \) 2 |
0 1 2 3 4 5 |
0+1 1+1 2+1 3+! 4+1 |
20 21 22 23 24 25 |
When the loop ends, p = a' is still true, but i = 5. Therefore, p = a5. In general, when the loop ends, p = an. Thus, we have verified that power(a, n) satisfies its specification.
23.
In a loop, if L is an invariant of the loop body B, then L is known as a loop invariant.
while C
--L
B
-- L
The loop invariant is true before the loop body and after the .loop body, each time. Since L is true at the start of the first iteration, L is true at the start of the loop also (just before the loop). 'Since L is true at the end of the last iteration, L is true when the loop ends also (just after the loop). Thus,.if L is a loop variant, then it is true at four important points in the algorithm, as annotated in the algorithm.
1. At the start of the loop (just before the loop)
2. at the start of each iteration (before loop body)
3. at the end of each iteration (after loop body)
4. at the end of the loop (just after the loop)
1. -- L, start of loop
while
C
2. -- L, start of iteration
B
3. -- L, end of the iteration
4. -- L, end of the loop

11th Standard Syllabus & Materials
11th Standard
TN 11th Computer Applications Computer Ethics and Cyber Security Sample Question Papers Study Material - QB365 Set A
NEW11th Standard
TN 11th Computer Applications JavaScript Functions Sample Question Papers Study Material - QB365 Set A
NEW11th Standard
TN 11th Computer Applications Control Structure in JavaScript Sample Question Papers Study Material - QB365 Set A
NEW11th Standard
TN 11th Computer Applications Introduction to JavaScript Sample Question Papers Study Material - QB365 Set A
Tamilnadu Stateboard 11th Standard Subjects

Maths

Commerce

Economics

Biology

Business Maths and Statistics

Accountancy

Computer Science

Physics

Chemistry

Maths

Biology

Economics

Physics

Chemistry

History

Business Maths and Statistics

Computer Science

Accountancy

Computer Applications

History

Computer Technology

Commerce

Computer Applications

Computer Technology

Tamil

English

French
Tamilnadu Stateboard Standards