Students can Download Computer Science Chapter 10 Flow of Control Questions and Answers, Notes Pdf, Samacheer Kalvi 11th Computer Science Book Solutions Guide Pdf helps you to revise the complete Tamilnadu State Board New Syllabus and score more marks in your examinations.

## Tamilnadu Samacheer Kalvi 11th Computer Science Solutions Chapter 10 Flow of Control

### Samacheer Kalvi 11th Computer Science Flow of Control Text Book Back Questions and Answers

PART – 1
I. Choose The Correct Answer

Question 1.
What is the alternate name of null statement?
(a) No statement
(b) Empty statement
(c) Void statement
(d) Zero statement
Answer:
(b) Empty statement

Question 2.
In C++, the group of statements should enclosed within:
(a) { }
(b) []
(c) ()
(d) <>
Answer:
(a) { } Question 3.
The set of statements that are executed again and again in iteration is called as:
(a) condition
(b) loop
(c) statement
(d) body of loop
Answer:
(d) body of loop

Question 4.
The multi way branching statement:
(a) if
(b) if … else
(c) switch
(d) for
Answer:
(c) switch

Question 5.
How many types of iteration statements exist?
(a) 2
(b) 3
(c) 4
(d) 5
Answer:
(b) 3

Question 6.
How many times the following loop will execute? for (int i = 0; i < 10; i++)
(a) 0
(b) 10
(c) 9
(d) 11
Answer:
(b) 10

Question 7.
Which of the following is the exit control loop?
(a) for
(b) while
(c) do … while
(d) if … else
Answer:
(c) do … while Question 8.
Identify the odd one from the keywords of jump statements:
(a) break
(b) switch
(c) goto
(d) continue
Answer:
(a) break

Question 9.
A loop that contains another loop inside its body:
(a) Nested loop
(b) Inner loop
(c) Inline loop
(d) Nesting of loop
Answer:
(a) Nested loop

PART – 2
II. Answers to all the questions

Question 1.
What is a null statement and compound statement?
Answer:
Null statement:
The “null or empty statement” is a statement containing only a semi colon. It takes the following form:
;// it is a null statement.
Null statement are commonly used as place holders in iteration statements or as statements on which to place labels at the end of compound statements or functions.

Compound statement:
C++ allows a group of statements enclosed by pair of braces { }. This group of statements is called as a compound statement or a block.
The general format of compound statement is: Question 2.
What is selection statement? Write it’s types.
Answer:
The selection statement means the statements are executed depends – upon a condition. If a condition is true, a true block (a set of statements) is executed, otherwise a false block is executed. This statement is also called decision statement or selection statement because it helps in making decision about which set of statements are to be executed.

Types:

1. Two way branching
2. Multiway branching

Question 3.
Correct the following code segment:
Answer: Question 4.
What will be the output of the following code: If the input given is

1. 2000
2. 2003
3. 2010?

Answer:
1. Output
(Input = 2000)
Leap

2. Output
(Input = 2003)
Not leap Year

3. Output (Input = 2010)
Not leap Year

Question 5.
What is the output of the following code?
for (int i = 2; i < = 10 ; i + = 2)
cout<<i;
Answer:
Output:
2 4 6 8 10 Question 6.
Write a for loop that displays the number from 21 to 30.
Answer:
# include
using namespace std;
int main()
{

for (int = 21; i < 31; i++)
cout << “value of i:” << i << endl;
return 0;
}
Output:
Value of i: 21
Value of i: 22
Value of i: 23
Value of i: 24
Value of i: 25
Value of i: 26
Value of i: 27
Value of i: 28
Value of i: 29
Value of i: 30

Question 7.
Write a while loop that displays numbers 2,4, 6, 8 ……………… 20.
Answer: Output:
2 4 6 8 10 12 13 14 16 18 20

Question 8.
Compare an if and a? : operator.
Answer: PART – 3 III.
III. Answers to all the questions Question

Question 1.
Convert the following if – else to a single conditional statement: Answer:
a = (x> =10)? m + 5:m;

Question 2.
Rewrite the following code so that it is functional:
Answer: Question 3.
Write a C++ program to print multiplication table of a given number.
Answer:
# include
using namespace std;
int main ()
{

int num;
cout << “Enter Number to find its multiplication table”; cin >> num;
for (int a = 1; a < = 10; a++)
{
cout << num << “*” << a << “=” << num*a << endl;
}
return( );

}

Question 4.
Write the syntax and purpose of switch statement.
Answer:
The switch statement is a multi – way branch statement. It provides an easy way to dispatch execution to different parts of code based on the value of the expression. The switch statement replaces multiple if – else sequence.
The syntax of the switch statement is; Question 5.
Write a short program to print following series:
(a) 1 4 7 10 …… 40
Answer:
# include
using namespace std;
int main ()
{

cout << “\n PRINT SERIES” ;
for (int i = 1; i< 40; i = i + 3)
cout << i << “1+”;
cin.get();
return ();
}

PART – 4
IV. Answers to all the questions

Question 1.
Explain control statement with suitable example.
Answer:
Control statements are statements that alter the sequence of flow of instructions.
Types of control statements:
1. Selection statement:
The selection statement means the statement (s) executed, depends upon a condition. If a condition is true, a true block (a set of statements) is executed otherwise a false block is executed. This statement is also called decision statement or selection statement because it helps in making decision about which set of statements are to be executed.
Example:

1. If
2. Switch 2. Iteration (or looping) statement:
An iteration (or loop) is a sequence of one or more statements that are repeatedly executed until a condition is satisfied. These statements are also called as control flow statements. It is used to reduce the length of code to reduce the time to execute program and takes less memory space.

Example:

1. While
2. do ….. while
3. for Question 2.
What is entry control loop? Explain any one of the entry control loop with suitable example.
Answer:
An entry control loop checks the condition at the time of entry and if condition or expression becomes true then control transfers into the body of the loop, for loop and while loop are the examples of Entry Controlled Loop. A while loop is a control flow statement that allows the loop statements to be executed as long as the condition is true.
Type: Entry control loop
Syntax: Control flow:
Step 1 : Test – expression is evaluated to either True or False;
Step 2 : If test – expression is true;
(a) The body of the loop is executed.
(b) Control is transferred to step 1.
Step 3: If test – expression is false, the control exits the while loop.
Example:
int a = 1;
while (a<=10)
{

cout << a << ‘\t+’;
a+=2;

}

Output:
1 3 5 7 9

Question 3.
Write a program to find the LCM and GCD of two numbers.
Answer: Question 4.
Write programs to find the sum of the following series:
(a) x – $$\frac{x^{2}}{2 !}$$ + $$\frac{x^{3}}{3 !}$$ + $$\frac{x^{4}}{4 !}$$ + $$\frac{x^{5}}{5 !}$$ – $$\frac{x^{6}}{6 !}$$
(b) x + $$\frac{x^{2}}{2}$$ + $$\frac{x^{3}}{3}$$ + ……… + $$\frac{x^{n}}{n}$$
Answer:
(a) (b) # include
using namespace std;
# include int main()
{

int M, L;
float sum = 0;
cout << “Enter the value for M:”; cin >> M;
cout << “Enter the number of terms”; cin >> L;
for (int i = 1; i<=m; i++)
sum = Sum + Pow(m,i)/i;
cout << “Sum=” << Sum << endl;
cin.get();
return 0;

}

Question 5.
Write a program to find sum of the series
S = 1 + x + x2 + ………….. + xn
Answer:
# include
using namespace std;
# include int main()
{

int x, n;
float sum = 0;
cout << “Enter the value for x:”; cin >> x;
cout << “Enter the number of terms”; cin >> n;
for (int i = 0; i<=n; i++)
sum = Sum + Pow(x,i);
cout << “Sum=” << Sum << endl;
cin.get( );
return 0;

}

### Samacheer kalvi 11th Computer Science Flow of Control Additional Questions and Answers

PART – 1
I. Choose the correct answer

Question 1.
The empty statement is otherwise called as ………………..
(a) Control statement
(b) Zero statement
(c) Null statement
(d) Block statement
Answer:
(c) Null statement

Question 2.
Selection statement is also called as ………………..
(a) Decision statement
(b) Sequence statement
(c) Null statement
(d) Compound statement
Answer:
(a) Decision statement Question 3.
Iteration statement is called as ………………..
(a) Null statement
(b) Block statement
(c) Selection statement
(d) Looping statement
Answer:
(d) Looping statement

Question 4.
In C++ any non – zero is iterated as true ……………….. and zero is treated as false.
(a) positive numbers
(b) negative numbers
(c) prime numbers
(d) none of these
Answer:
(b) negative numbers

Question 5.
……………….. is a multi – path decision making statement.
(a) if
(b) if – else
(c) else – if
(d) if – else ladder
Answer:
(d) if – else ladder

Question 6.
Syntax of the conditional operator is ………………..
(a) expression 1? expression 2: expression 3
(b) expression 1: expression 2
(c) expression 1! expression 2: expression 3
(d) expression 1: expression 2: expression 3
Answer:
(a) expression 1? expression 2: expression 3

Question 7.
……………….. is more efficient than if-else statement.
(a) Control statement
(b) Switch statement
(c) Empty statement
(d) Null statement
Answer:
(b) Switch statement

Question 8.
When a switch is a part of the statement sequence of another switch, then it is called as ………………..
(a) if – else ladder
(b) Switch statement
(c) Nested switch statement
(d) Empty statement
Answer:
(c) Nested switch statement Question 9.
C++ supports types of iteration statements.
(a) 3
(b) 2
(c) 4
(d) 5
Answer:
(a) 3

Question 10.
Every loop has ……………….. elements that are used for different purposes.
(a) 3
(b) 4
(c) 5
(d) 2
Answer:
(b) 4

Question 11.
……………….. is used to transfer the control from one place to another place without any condition in a program.
(a) Break statement
(b) Continue statement
(c) goto statement
(d) All the above
Answer:
(c) goto statement

PART – 2
II. Short Answers

Question 1.
What is if statement? Write it’s syntax.
Answer:
The if statement evaluates a condition, if the condition is true then a true – block (a statement or set of statements) is executed, otherwise the true – block is skipped. The general syntax of the if statement is:
if (expression)
true – block;
statement – x;

Question 2.
Write a program to check whether a person is eligible to vote using if statement.
C++ program to check whether a person is eligible to vote using if statement
Answer: Output:
Enter your age: 23
You are eligible for voting ….
This statement is always executed.

Question 3.
What is nested if? Mention it’s types.
Answer:
An if statement contains another if statement is called nested if. The nested can have, one of the following three forms.

1. If nested inside if part
2. If nested inside else part
3. If nested inside both if part and else part

Question 4.
Write the syntax for if – else ladder.
Answer:
The syntax of if – else ladder: Question 5.
What is nested switch statement?
Answer:
When a switch is a part of the statement sequence of another switch, then it is called as nested switch statement. The inner switch and the outer switch constant may or may not be the same.

Question 6.
What are loop elements?
Answer:
Every loop has four elements that are used for different purposes. These elements are

1. Initialization expression
2. Test expression
3. Update expression
4. The body of the loop

Question 7.
Write C++ program to sum the numbers from 1 to 10.
Answer:
C++ program to sum the numbers from 1 to 10 using for loop Output:
The sum of 1 to 10 is 55

Question 8.
Rewrite the given program.
Answer:
C++ program to sum the numbers from 1 to 10 using for loop C++ program to sum the numbers from 1 to 10 using for loop Output:
The sum of 1 to 10 is 55

Question 9.
Write a program to display numbers from 1 to 10 except 6 using continue statement.
Answer:
C++ program to display numbers from 1 to 10 except 6 using continue statement
#include
using namespace std;
int main()
{
if (i = 6)
continue;
else
cout << i << ” ”
}
return 0;
}
Output:
1 2 3 4 5 7 8 9 10 Question 10.
What will be the output of the following code.
Answer:
int a, b, largest;
cout << “\n Enter any two numbers:”; cin >> a >> b;
largest = (a > b)? a:b;
cout << “\n Largest number:” << largest;
return 0;
Output:
Enter any two numbers:
5 10
Largest number: 10

PART – 3
III. Explain in Brief

Question 1.
What is sequence statements?
Answer:
The sequential statement are the statements that are executed one after another only once from top to bottom. These statements do not alter the flow of execution. These statements are called as sequential flow statements. They always end with a semicolon (;).

Question 2.
Write the syntax of nested switch statement.
Answer:
The syntax of the nested switch statement is; switch (expression) Question 3.
Write short notes on Test expression.
Answer:
The test expression is an expression or condition whose value decides whether the loop – body will be executed or not. If the expression evaluates to true (i.e., 1), the body of the loop is executed, otherwise the loop is terminated. In an entry – controlled loop, the test – expression is evaluated before the entering into a loop whereas in an exit – controlled loop, the test – expression is evaluated before exit from the loop. Question 4.
What is do – while loop? Write it’s syntax.
Answer:
The do – while loop is an exit-controlled loop. In do-while loop, the condition is evaluated at the bottom of the loop after executing the body of the loop. This means that the body of the loop is executed at least once, even when the condition evaluates false during the first iteration.
The do – while loop syntax is:
do {
Body of the loop;
} while(condition);

Question 5.
What are the differences between break and continue statement.
Answer:
Break:

• Break is used to terminate the execution of the loop.
• It breaks the iteration.
• When this statement is executed, control will come out from the loop and executes the statement immediate after loop.
• Break is used with loops as well as switch case.

Continue:

• Continue is not used to terminate the execution of loop.
• It skips the iteration.
• When this statement is executed, it will not come out of the loop but moves/jumps to the next iteration of loop.
• Continue is only used in loops, it is not used in switch case.

Question 6.
What are the important things to know about switch statement?
Answer:
There are some important things to know about switch statement. They are

1. A switch statement can only work for quality of comparisons.
2. No two case labels in the same switch can have identical values.
3. If character constants are used in the switch statement, they are automatically converted to their equivalent ASCII codes.
4. The switch statement is more efficient choice than if in a situation that supports the nature of the switch operation.

PART – 4
IV. Explain in Detail

Question 1.
What are the key differences between if else and switch statement?
Answer: Question 2.
Explain about parts of a loop.
Answer:
Every loop has four elements that are used for different purposes. These elements are:

1. Initialization expression
2. Test expression
3. Update expression
4. The body of the loop

1. Initialization expression(s) : The control variable(s) must be initialized before the control enters into loop. The initialization of the control variable takes place under the initialization expressions. The initialization expression is executed only once in the beginning of the loop.

2. Test Expression : The test expression is an expression or condition whose value decides whether the loop-body will be executed or not. If the expression evaluates to true (i.e., 1), the body of the loop is executed, otherwise the loop is terminated.

In an entry – controlled loop, the test – expression is evaluated before the entering into a loop whereas in an exit-controlled loop, the test – expression is evaluated before exit from the loop.

3. Update expression : It is used to change the value of the loop variable. This statement is executed at the end of the loop after the body of the loop is executed.

4. The body of the loop : A statement or set of statements forms a body of the loop that are executed repetitively. In an entry – controlled loop, first the test-expression is evaluated and if it is nonzero, the body of the loop is executed otherwise the loop is terminated. In an exit – controlled loop, the body of the loop is executed first then the test – expression is evaluated. If the test – expression is true the body of the loop is repeated otherwise loop is terminated. Question 3.
Explain about jump statements.
Answer:
Jump statements are used to interrupt the normal flow of program. Types of Jump Statements are:

1. goto statement
2. break statement
3. continue statement

The goto statement is a control statement which is used to transfer the control from one place to another place without any condition in a program. A break statement is a jump statement which terminates the execution of loop and the control is transferred to resume normal execution after the body of the loop. The continue statement works quite similar to the break statement. Instead of terminating the loop (break statement), continue statement forces the loop to continue or execute the next iteration. When the continue statement is executed in the loop, the code inside the loop following the continue statement will be skipped and next iteration of the loop will begin. Question 4.
Programs to produce the following design using nested loops.
Answer: Output
Enter number of rows: 5
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1