Students can Download Computer Science Chapter 7 Composition and Decomposition 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 7 Composition and Decomposition

### Samacheer Kalvi 11th Computer Science Composition and Decomposition Text Book Back Questions and Answers

PART – 1

11th Computer Science Chapter 7 Book Back Answers Question 1.
Suppose u, v = 10, 5 before the assignment. What are the values of u and v after the sequence of assignments?
1. u : = v
2. v : = u
(a) u, v = 5, 5
(b) u, v = 10, 5
(c) u, v = 5, 10
(d) u, v = 10, 10
(a) u, v = 5, 5

Composition And Decomposition In Computer Science Question 2.
Which of the following properties is true after the assignment (at line 3?
1. – – i + j = 0
2. i, j : = i + 1, j – 1
3. – – ?
(a) i + j > 0
(b) i + j < 0
(c) i + j = 0
(d) i = j
(c) i + j = 0

Class 11 Computer Science Chapter 7 Solutions Question 3.
If C1 is false and C2 is true, the compound statement (a) S1
(b) S2
(c) S3
(d) none
(b) S2

Computer Science Samacheer Kalvi Question 4.
If C is false just before the loop, the control flows through (a) S1 ; S3
(b) S1 ; S2 ; S3
(c) S1 ; S2 ; S2 ; S2 ; S3
(d) S1 ; S2 ; S2 ; S2 ; S3
(a) S1 ; S3

Samacheer Kalvi Computer Science Question 5.
If C is true, S1 is executed in both the flowcharts, but S2 is executed in (a) (1) only
(b) (2) only
(c) both (1) and (2)
(d) neither (1) nor (2)
(a) (1) only

Samacheer Kalvi Guru 7th Computer Science Question 6.
How many times the loop is iterated?
i : = 0
while i ≠ 5
i : = i + 1
(a) 4
(b) 5
(c) 6
(d) 0
(b) 5

PART – 2

Samacheer Kalvi Guru 11th Computer Science Question 1.
Distinguish between a condition and a statement. Samacheer Kalvi Computer Science Book Question 2.
Draw a flowchart for conditional statement. 11 Computer Science Samacheer Kalvi Question 3.
Both conditional statement and iterative statement have a condition and a statement. How do they differ?
Conditional Statement:

• Statements are executed only once when the condition is true.
• If condition statement.

Iterative Statement:

• Iterative statement repeatedly evaluates a condition and executes a statement until it becomes false.
• While condition statement.

Samacheer Kalvi Guru Computer Science Question 4.
What is the difference between an algorithm and a program?
Algorithm:

• Algorithm is for human readers to understand.
• Knowledge of English is needed.
• Easy to understand.

Program:

• Program is for the computers to execute directly.
• Knowledge of programming language is required.
• It is difficult to understand.

Computer Science Textbook Solutions Question 5.
Why is function an abstraction?
Once a function is defined, it can be used over and over and over again. Reusability of a single function several times is known as an abstraction.

Computer Chart For 11th Class Question 6.
How do we refine a statement?
In refinement, each statement is repeatedly expanded into more detailed statements in the subsequent levels.

PART – 3
Explain in Brief

Computer Charts For Class 11 Question 1.
For the given two flowcharts write the pseudo code.

1. Enter A,B
2. Initialise Q = 0, r = A
3. If r > B, then do Q = Q + 1; r = r – B else r, q
4. Exit

Samacheer Kalvi Guru 11 Computer Science Question 2.
If C is false in line 2, trace the control flow in this algorithm.

1. S1
2. – – C is false
3. if C
4. S2
5. else
6. S3
7. S4

S1 ; S2 ; S4

Statement Meaning In Computer Question 3.
What is case analysis?
Case Analysis statement generalizes the problem into multiple cases. Case Analysis splits the problem into an exhaustive set of disjoint cases.

Question 4.
Draw a flowchart for -3 case analysis using alternative statements. Question 5.
Define a function to double a number in two different ways:

1. n + n
2. 2 x n

1. Double (n)
– – inputs: n is a real number or an integer, n > 0
– – Outputs: y is a real number or an integer such that y = n + n

2. Double (n)
– – inputs: n is a real number or an integer, n > 0
– – Outputs: y is a real number or an integer such that y = 2 x n

PART – 4
IV. Explain in Detail

Question 1.
Exchange the contents: Given two glasses marked A and B. Glass A is full of apple drink and glass B is full of grape drink. Write the specification for exchanging the contents of glasses A and B, and write a sequence of assignments to satisfy the specification.
Let the variables a, b, c represent Glass A, Glass B and Glass C and a, b, c can store values APPLE, GRAPE or EMPTY.
Specification:

1. exchange (a, b)
2. – – inputs: a, b : = APPLE, GRAPE
3. – – outputs: a, b : = GRAPE, APPLE

Algorithm: Question 2.
Circulate the contents: Write the specification and construct an algorithm to circulate the contents of the variables A, B and C as shown below: The arrows indicate that B gets the value of A, C gets the value of B and A gets the value of C. Specifications:

1. circulate
2. – – inputs: a, b, c: = A, B, C
3. – – outputs: a, b, c: = C, A, B

Algorithm:

1. circulate (a, b, c)
2. – – a, b, c: = A, B, C
3. temp : = c
4. c : = b
5. b : = a
6. a : = temp
7. – – a, b, c: = C, A, B

Question 3.
Decanting problem. You are given three bottles of capacities 5, 8, and 3 litres. The 8L bottle is filled with oil, while the other two are empty. Divide the oil in 8L bottle into two equal quantities. Represent the state of the process by appropriate variables. What are the initial and final states of the process? Model the decanting of oil from one bottle to another by assignment. Write a sequence of assignments to achieve the final state.
(a)
Let a, b, c be the variables whose maximum value are 8L, 5L and 3L respectively.
Initial State: a, b, c: = 8, 0, 0

Final State: a, b, c: = 4, 4, 0

Specifications:

1. decant
2. – – inputs: a, b, c : = 8, 0, 0
3. – – outputs: a, b, c : = 4, 4, 0

Algorithm:
Let us assume that a: = b denote oil in b is poured into a bottle until either “a” is full or “b” becomes empty.

1. decant (a, b, c)
2. – – a, b, c : = 8, 0, 0
3. b : = a
4. – – a, b, c : = 3, 5, 0
5. c : = b
6. – – a, b, c : = 3, 2, 3
7. a : = c
8. – – a, b, c : = 6, 2, 0
9. c : = b
10. – – a, b, c : = 6, 0, 2
11. b : = a
12. – – a, b, c : = 1, 5, 2
13. c : = b
14. – – a, b, c : = 1, 4, 3
15. a : = c
16. – – a, b, c: = 4, 4, 0

Question 4.
Trace the step – by – step execution of the algorithm for factorial(4).
factorial(n)
– – inputs : n is an integer , n ≥ 0
– – outputs : f = n!
f, i : = 1,1
while i ≤ n
f, i : = f x i, i + 1 ### Samacheer kalvi 11th Computer Science Composition and Decomposition Additional Questions and Answers

PART – 1

Question 1.
Which one of the following is odd?
(a) Python
(b) C++
(c) C
(d) Ctrl + S
(d) Ctrl + S

Question 2.
………………. is a diagrammatic notation for representing algorithms.
(a) Pseudo code
(b) Flowchart
(c) Program
(d) Languages
(b) Flowchart

Question 3.
There are important control flow statements.
(a) four
(b) three
(c) two
(d) five
(b) three

Question 4.
A ………………. statement is composed of a sequence of statements.
(a) iterative
(b) conditional
(c) sequential
(d) alternative
(c) sequential

Question 5.
A ………………. is contained in a rectangular box with a single outgoing arrow, which points to the box to be executed next.
(a) statement
(b) composition
(c) notation
(d) condition
(a) statement

Question 6.
The triangle is right – angled, if ……………….
(a) C = a – b
(b) C2 = a2 + b2
(c) C2 = (a + b)2
(d) c2 = a2 – b2
(b) C2 = a2 + b2

Question 7.
The algorithm can be specified as ……………….
(a) monochromatize (a, b, c)
(b) a = b = 0
(c) C = A + B + C
(d) none
(a) monochromatize (a, b, c)

Question 8.
After an algorithmic problem is decomposed into subproblems, we can abstract the subproblems as ……………….
(a) refinement
(b) pseudo – code
(c) decomposition
(d) functions
(d) functions

Question 9.
Which one of the following is the elementary problem solving techniques?
(a) Specification
(b) Abstraction
(c) Composition
(d) decomposition
(d) decomposition

Question 10.
Which one of the following have only high level details?
(a) Flow chart
(b) Algorithm
(c) Programs
(d) Pseudocode
(b) Algorithm

Question 11.
How many different notations are there for representing algorithms?
(a) 2
(b) 3
(c) 4
(d) 5
(b) 3

Question 12.
Which one of the following notations will be executed by computers?
(a) Flow chart
(b) Pseudocode
(c) Programming languages
(d) Compiler
(c) Programming languages

Question 13.
Which one of the following algorithmic notation is used for communication among people?
(a) Flow chart
(b) Pseudo code
(c) PL
(d) Interpreter
(b) Pseudo code

Question 14.
Which one of the following algorithmic notation is used for giving visual intuition of control flow?
(a) Flow chart
(b) Programming languages
(c) Pseudo code
(d) Compiler
(a) Flow chart

Question 15.
The algorithmic notation similar to Programming language is ……………….
(a) Flow chart
(b) Pseudo code
(c) C ++
(d) C
(b) Pseudo code

Question 16.
Identify the statement which is wrong ……………….
(a) Programs must obey the grammar of the Programming language exactly.
(b) The punctuations in Programming language must be exactly.
(c) The Programming language is informal.
(d) Translator translates the programs into instructions.
(c) The Programming language is informal.

Question 17.
Which one is used for converting programs into computer executable instructions?
(a) Converter
(b) Apps
(c) Translator
(d) exe files
(c) Translator

Question 18.
Identify the correct statement from the following?
(a) Pseudo code can be executed by the computer directly.
(b) Pseudo code cannot be executed by the computer directly.
(c) Algorithm cannot be expressed in Pseudo code
(d) Algorithm are written only for python language
(b) Pseudo code cannot be executed by the computer directly.

Question 19.
The notation which is not formal nor exact is ……………….
(a) Flow chart
(b) Pseudo code
(c) Compiler
(d) Translator
(b) Pseudo code

Question 20.
Identify the correct statements.
(i) Pseudo code uses natural English for statements and conditions..
(ii) Pseudo code notation is formal one.
(iii) There is no need to follow the rules of the Programming language grammer
(iv) It must be rigorous and correct.
(a) (i) (ii) (iii)
(b) (ii) (iii) (iv)
(c) (i) (iii) (iv)
(d) (i) (ii) (iii) (iv)
(c) (i) (iii) (iv)

Question 21.
Find the pair which is wrongly matched.
(a) Rectangular boxes – Statements
(b) Diamond boxes – Output
(c) Arrow – Control flow
(d) Parallelogram – Input
(b) Diamond boxes – Output

Question 22.
Find the correct flow chart diagram from the following.  Question 23.
The inputs and outputs are drawn using ……………….. boxes.
(a) rectangular
(b) diamond
(c) Parallelogram
(d) Oval
(c) Parallelogram

Question 24.
The symbol used for representing the box to be executed next is ………………..
(a) ⇒
(b) ⇓
(c) ↓
(d) ++
(c) ↓

Question 25.
The flow of control is represented in the flowchart by ………………..
(a) arrow
(b) dot
(c) box
(d) plus
(a) arrow

Question 26.
In flow chart, rectangular boxes represents ………………..
(a) statements
(b) condition
(c) Input
(d) End
(a) statements

Question 27.
A condition is contained in a diamond shaped box with ……………….. outgoing arrows.
(a) 2
(b) 3
(c) 4
(d) 5
(a) 2

Question 28.
A collection of boxes containing statements and conditions connected by arrow are ………………..
(a) compiler
(b) Flow chart
(c) Pseudo code
(d) Algorithm
(b) Flow chart

Question 29.
Match the following: (a) (i) -4 (ii) 0 – 1 (iii) – 2 (iv) – 3
(b) (i) – 1 (ii) – 2 (iii) – 3 (iv) – 4
(c) (i) – 4 (ii) – 2 (iii) – 1 (iv) – 3
(d) (i) – 3 (ii) – 2 (iii) – 1 (iv) – 4
(a) (i) -4 (ii) 0 – 1 (iii) – 2 (iv) – 3

Question 30.
How many outgoing arrows are needed for rectangular boxes in flow chart?
(a) 0
(b) 1
(c) 2
(d) 3
(b) 1

Question 31.
Statements composed of other statements are known as:
(a) Simple Statements
(b) Compound Statements
(c) Conditional
(d) Control flow
(b) Compound Statements

Question 32.
Which one of the following is not a control flow statements?
(a) Sequential
(b) Assignment
(c) Iterative
(d) Alternative
(b) Assignment

Question 33.
Which one of the following statement is used to alter the normal flow of control of the program?
(a) Assignments
(b) Control flow
(c) Compound
(d) both b & c
(d) both b & c

Question 34.
Which one of the following statements are executed one after the other as written in the algorithm?
(a) Sequential
(b) Iterative
(c) Conditional
(d) Decisive
(a) Sequential

Question 35.
Alternative statements analyses the problem into ……………….. cases.
(a) 2
(b) 3
(c) 4
(d) 5
(a) 2

Question 36.
Case analysis statement generalizes the statement into ……………….. cases.
(a) 2
(b) 3
(c) 5
(d) multiple
(d) multiple

Question 37.
If sC is a ……………….. statement.
(a) Conditional
(b) Alternative
(c) Case Analysis
(d) Iterative
(a) Conditional

Question 38.
Which one of the following process executes the same action repeatedly?
(a) Conditional
(b) Alternative
(c) Iterative
(d) None of these
(c) Iterative

Question 39.
The iterative statement is commonly known as a ………………..
(a) loop
(b) Case Analysis
(c) Alternative
(d) Conditional
(a) loop

Question 40.
Testing the loop condition and executing the loop body once is called ………………..
(a) alternative
(b) conditional
(c) Iteration
(d) Decomposition
(c) Iteration

PART – 2

Question 1.
What is a Programming Language?

1. A programming language is a notation for expressing algorithms to be executed by computers.
2. Programs must obey the grammar of the programming language exactly. Ex. C, C++, python.

Question 2.
What is a Pseudo code?
Pseudo code is a mix of programming language like constructs and plain English. Algorithms expressed in Pseudo code are not intended to be executed by computers but for human readers to understand.

Question 3.
What is a Flow – chart?
Flow chart is a diagrammatic notation for representing algorithms. A flow chart is a collection of boxes containing statements and conditions which are connected by arrows showing the order in which the boxes are to be executed.

Question 4.
What is a control flow statement. Classify it.
Control flow statements are compound statements. They are used to alter the control flow of the process depending on the state of the process. They are classified as:

1. Sequential
2. Alternative
3. Iterative

Question 5.
What is meant by Decomposition?
Decomposition is one of the elementary problem-solving techniques. An algorithm may be broken into parts, expressing only high level details. Then, each part may be refined into smaller parts, expressing finer details or each part may be abstracted as a function.

Question 6.
When a condition statement will be executed?
It will be executed only when the condition statement is true.

Question 7.
Write the algorithm specification to find minimum of 2 numbers.
Minimum (a, b)
– – inputs : a, b
– – outputs : result = a >1 b

Question 8.
Draw the flowchart for alternative control flow. PART – 3
III. Explain in Brief

Question 1.
Draw the diagram flowchart for integer division. Question 2.
Explain conditional statement.
Conditional statement: Sometimes we need to execute a statement only if a condition is true and do nothing if the condition is false. This is equivalent to the alternative statement in which the else clause is empty. This variant of alternative statement is called a conditional statement. If C is a condition and S is a statement, then is a statement, called a conditional statement, that describes the following action:

1. Test whether C is true or false.
2. If C is true then do S; otherwise do nothing.

The conditional control flow is depicted in the flowchart. Question 3.
Write a note on refinement.
After decomposing a problem into smaller subproblems, the next step is either to refine the subproblem or to abstract the subproblem.
1. Each subproblem can be expanded into more detailed steps. Each step can be further expanded to still finer steps, and so on. This is known as refinement.

2. We can also abstract the subproblem. We specify each subproblem by its input property and the input – output relation. While solving the main problem, we only need to know the specification of the subproblems. We do not need to know how the subproblems are solved.

Question 4.
Draw various symbols used in flowchart with their usage. Question 5.
Write a Algorithm to find minimum of 2 numbers. Question 6.  Question 7.
Construct an iterative algorithm to compute the quotient and remainder after dividing an integer A by another integer B.
divide (A, B)
– – inputs: A is an integer and B ≠ 0
– – Outputs: q and r such that A = q x B + r and 0 < r < B
q : = 0, A
While r ≥ B
q, r : = q + 1, r – B

PART – 4
IV. Explain in Detail

Question 1.

1. Flowcharts are less compact than representation of algorithms in programming language or pseudo code.
2. They obscure the basic hierarchical structure of the algorithms.
3. Alternative statements and loops are disciplined control flow structures.

Question 2.
Explain the sequential statement in detail with the diagram.
A sequential statement is composed of a sequence of statements. The statements in the sequence are executed one after another, in the same order as they are written in the algorithm, and the control flow is said to be sequential. Let S1 and S2 be statements. A sequential statement composed of S1 and S2 is written as
S1
S2
In order to execute the sequential statement, first do S1 and then do S2. The sequential statement given above can be represented in a flowchart. The arrow from S1 to S2 indicates that S1 is Let the input property be P, and the input-output relation be Q, for a problem. If statement S solves the problem, it is written as

1. – – p
2. S
3. – – Q

If we decompose the problem into two components, we need to compose S as a sequence of two statements S1 and S2 such that the input-output relation of S1, say R, is the input property of S2.

1. – – P
2. S1
3. – – R
4. S2
5. – – Q

Question 3.
Write a note on case analysis.
Alternative statement analyses the problem into two cases. Case analysis statement generalizes it to multiple cases. Case analysis splits the problem into an exhaustive set of disjoint cases. For each case, the problem is solved independently. If Cl, C2, and C3 are conditions, and S1, S2, S3 and S4 are statements, a 4 – case analysis statement has the form,

1. case C1
2. S1
3. case C2
4. S2
5. case C3
6. S3
7. else
8. S4

The conditions C1, C2, and C3 are evaluated in turn. For the first condition that evaluates to true, the corresponding sttement is executed, and the case analysis statement ends. If none of the conditions evaluates to true, then the default case S4 is executed.

1. The cases are exhaustive: at least one of the cases is true. If all conditions are false, the default case is true.
2. The cases are disjoint: only one of the cases is true. Though it is possible for more than one condition to be true, the case analysis always executes only one case, the first one that is true. If the three conditions are disjoint, then the four cases are (1) C1, (2) C2, (3) C3, (4) (not C1) and (not C2) and (not C3).

Question 4.
What is a function? Explain in detail.
After an algorithmic problem is decomposed into subproblems, we can abstract the subproblems as functions. A function is like a sub-algorithm. Similar to an algorithm, a function is specified by the input property, and the desired input – output relation. To use a function in the main algorithm, the user need to know only the specification of the function – the function name, the input property, and the input – output relation. The user must ensure that the inputs passed to the function will satisfy the specified property and can assume that the outputs from the function satisfy the input – output relation. Thus, users of the function need only to know what the function does, and not how it is done by the function. The function can be used a “black box” in solving other problems.

Ultimately, someone implements the function using an algorithm. However, users of the function need not know about the algorithm used to implement the function. It is hidden from the users. There is no need for the users to know how the function is implemented in order to use it.

An algorithm used to implement a function may maintain its own variables. These variables are local to the function in the sense that they are not visible to the user of the function. Consequently, the user has fewer variables to maintain in the main algorithm, reducing the clutter of the main algorithm.

Question 5.
Draw the flowchart for Eat breakfast. Question 6.
Explain Alternative statement.
Alternative statement:
A condition is a phrase that describes a test of the state. If C is a condition and both S1 and S2 are statements, then is a statement, called an alternative statement, that describes the following action: 1. Test whether C is true or false.
2. If C is true, then do S1; otherwise do S2.

In pseudo code, the two alternatives S1 and S2 are indicated by indenting them from the keywords if and else, respectively. Alternative control flow is depicted in the flowchart. Condition C has two outgoing arrows, labeled true and false. The true arrow points to the S1 box. The false arrow points to the S2 box. Arrows out of S1 and S2 point to the same box, the box after the alternative statement.

Conditional statement:
Sometimes we need to execute a statement only if a condition is true and do nothing if the condition is false. This is equivalent to the alternative statement in which the else clause is empty. This variant of alternative statement is called a conditional statement. If C is a condition and S is a statement, then 1. Test whether C is true or false.
2. If C is true then do S; otherwise do nothing.

The conditional control flow is depicted in the flowchart.

Question 7.
Explain various symbols in Flow chart.
Flowchart is a diagrammatic notation for representing algorithms. They show the control flow of algorithms using diagrams in a visual manner. In flowcharts, rectangular boxes represent simple statements, diamond-shaped box represent conditions, and arrows describe how the control flows during the execution of the algorithm. A flowchart is a collection of boxes containing statements and conditions which are connected by arrows showing the order in which.the boxes are to be executed. 1. A statement is contained in a rectangular box with a single outgoing arrow,which points to the box to be executed next.
2. A condition is contained in a diamond shaped box with two outgoing arrows, labeled true and false. The true arrow points to the box to be executed next if the condition is true, and the false arrow points to the box to be executed next if the condition is false.
3. Parallelogram boxes represent inputs given and outputs produced.
4. Special boxes marked Start and the End are used to indicate the start and the end of an execution:

The flowchart of an algorithm to compute the quotient and remainder after dividing an integer A by another integer B is shown below, illustrating the different boxes such as input, output, condition, and assignment, and the control flow between the boxes.