Tamilnadu State Board New Syllabus Samacheer Kalvi 11th Computer Science Guide Pdf Chapter 6 Specification and Abstraction Text Book Back Questions and Answers, Notes.

## Tamilnadu Samacheer Kalvi 11th Computer Science Solutions Chapter 6 Specification and Abstraction

### 11th Computer Science Guide Specification and Abstraction Text Book Questions and Answers

Part I

Question 1.
Which of the following activities is algorithmic in nature?
a) Assemble a bicycle
b) Describe a bicycle
c) Label the parts of a bicycle
d) Explain how a bicycle works
a) Assemble a bicycle

Question 2.
Which of the following activities is not algorithmic in nature?
a) Multiply two numbers
b) Draw a kolam
c) Walk in the park
d) Braid the hair
d) Braid the hair Question 3.
Omitting details inessential to the task and representing only the essential features of the task is known as
a) specification
b) abstraction
c) composition
d) decomposition
b) abstraction

Question 4.
Stating the input property and the as :-output relation a problem is known
a) specification
b) statement
c) algorithm
d) definition
a) specification

Question 5.
Ensuring the input-output relation is
a) the responsibility of the algorithm and the right of the user
b) the responsibility of the user and the right of the algorithm
c) the responsibility of the algorithm but not the right of the user
d) the responsibility of both the user and the algorithm
d) the responsibility of both the user and the algorithm

Question 6.
If i = 5 before the assignment i := i-1 after the assignment? the value of i is
a) 5
b) 4
c) 3
d) 2
b) 4 Question 7.
If 0 < i before the assignment S := i-1 after the assignment, we cars conclude that
a) 0 < i
b) 0 < i c) i = 0 d) 0 >i
b) 0 < i Part II

Question 1.
Define an algorithm
An algorithm is a step-by-step sequence of statements intended to solve a problem. An algorithm starts execution with the input data, executes the statements, and finishes execution with the output data.

Question 2.
Distinguish between an algorithm and a process.
An algorithm is a sequence of instructions to accomplish a task or solve a problem.
An instruction describes an action. When the instructions are executed, a process evolves which accomplishes the intended task or solves the given problem.
We can compare an algorithm to a recipe, and the resulting process to cooking.

Question 3.
Initially, farmer, goat, grass, wolf = L, L, L, L, and the farmer crosses the river with a goat. Model the action with an assignment statement.
The sequence of assignments for goat, grass, and wolf problem.

 1. farmer, goat, grass, wolf = L, L, L, L 2. farmer, goat = R, R 3. farmer, goat, grass, wolf = R, R, L, L 4. farmer = L 5. farmer, goat, grass, wolf = L, R, L, L 6. farmer, grass = R, R 7. farmer, goat, grass, wolf = R, R, R, L 8. farmer, goat = L, L 9. farmer, goat, grass, wolf = L, L, R, L 10. farmer, wolf = R, R 11. farmer, goat, grass, wolf = R, L, R, R 12. farmer = L 13. farmer, goat, grass, wolf = L, L, R, R 14. farmer, goat =R, R 15. farmer, goat, grass, wolf = R, R, R, R

Question 4.
Specify a function to find the minimum of two numbers.

1. – – minimum (a,b)
2. – – inputs: a, b are real numbers.
3. – – output: result: = minimum (a,b) Question 5.
If √2 = 1.414, and the square_root() function returns -1.414, does it violate the following specification?
— square_root (x)
— inputs: x is a real number, x ≥ 0
— outputs: y is d real number such that y2 = x
— square_root (x)
— inputs: x is a real number, x > 0
— outputs: y is d real number such that y2 = x
Yes. It violates the specification. For a positive input (x > 0), the output square-root value should also be positive.

Part III

Explain in brief.

Question 1.
When do you say that a problem is algorithmic in nature?
A Problem is algorithmic in nature when its solution involves the construction of an algorithm. Also when the

1. Input data and output data of the problem are specified.
2. The relation between the input data and the output data is specified.

Question 2.
What is the format of the specification of an algorithm?
An algorithm is specified by the properties of the given input and the relation between the input and the desired output. In simple words, the specification of an algorithm is the desired input-output relation.

Let P be the required property of the inputs and Q the property of the desired outputs. Then the algorithm S is specified as;

• algorithm_name (inputs)
• – inputs: P
• – outputs: Q

This specification means that if the algorithm starts with inputs satisfying P, then it will finish with the outputs satisfying Q. Question 3.
What is abstraction?
Abstraction:
It is the facility to define objects. It also involves the removal of unnecessary attributes and defining only essential attributes. For example, when we represent the state of a process we select only the variables essential to the problem and ignore inessential details.

Question 4.
How is the state represented in algorithms?
Computational processes in the real-world have stated. As a process evolves, the state changes.
The state of a process can be represented by a set of variables in an algorithm. The state at any point of execution is simply the values of the variables at that point. As the values of the variables are changed, the state changes.

Example:
State: A traffic signal may be in one of the three states: green, amber, or red. The state is changed to allow a smooth flow of traffic. The state may be represented by a single variable signal which can have one of the three values: green, amber, or red.

Question 5.
What is the form and meaning of the assignment statement?
Variables are named boxes to store values. The assignment statement is used to store a value in a variable. It is written with the variable on the left side of the assignment operator and a value on the right side.
variable := value

When this assignment is executed, the value on the right side is stored in the variable on the left side. The assignment
m := 2 stores value 2 in variable m. If the variable already has a value stored in it, the assignment changes its value to the value on the right side. The old value of the variable is lost.
The right side of an assignment can be an expression.
variable := expression
In this case, the expression is evaluated and the value of the expression is stored in the variable. Question 6.
What is the difference between assignment operator and equality operator?

 Assignment operator Equality operator It assign right-hand side of the assignment operator value(constant / variable/ expression) to the left-hand side variable. It compares both operands and returns True if it is equal otherwise False. It is a relational operator.

Part IV

Explain in detail

Question 1.
Write the specification of an algorithm hypotenuse whose inputs are the lengths of the two shorter sides of a right-angled triangle, and the output is the length of the third side.
hypotenuse(sl, s2).
— inputs: si and s2 both are real numbers
— outputs: I is a real number such that
l2 = s12+ S22.

Question 2.
Suppose you want to solve the quadratic equation ax2 + bx + c = 0 by an algorithm.
— inputs : ?
— outputs: ?
You intend to use the formula and you are prepared to handle only real number roots. Write a suitable specification.
$$x=\frac{-b \pm \sqrt{b^{2}-4 a c}}{2 a}$$
Solution;
– inputs : a,b,c all are real numbers, a ≠ 0.
– outputs: x is a real number.
$$x=\frac{-b \pm \sqrt{b^{2}-4 a c}}{2 a}$$
such that b2 – 4ac > 0. Question 3.
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. For exchanging the contents of glasses A and B, represent the state by suitable variables, and write the specification of the algorithm.
The specification of the algorithm:
exchange (A, B)
–inputs: A,B are real and >0
–outputs: A,B are real and >0
State representation
TEMP:=A
A:=B
B := TEMP

### 11th Computer Science Guide Specification and Abstraction Additional Questions and Answers

Part I

Question 1.
Which one of the following is an example of a process?
(a) Braid the hair
(c) Cooking a dish
(c) Cooking a dish

Question 2.
An instruction describes an __________
a) action
b) input
c) output
d) flow
a) action Question 3.
How many basic building blocks construct an algorithm?
(a) 3
(b) 4
(c) 5
(d) 8
(b) 4

Question 4.
Instructions of a computer are also known as _________
a) statements
b) structures
c) procedures
d) None of these
a) statements

Question 5.
……………….. how many control flow statement is there to alter the control flow depending on the state?
(a) 5
(b) 6
(c) 3
(d) 8
(c) 3

Question 6.
__________ is a step in solving a mathematical problem suggested by G Polya.
a) Understand the problem and Devise a plan
b) Carry out the plan
d) All the above
d) All the above Question 7.
……………….. statement is used to store a value in a variable.
(a) Assignment
(b) Sequential control flow
(c) Alternative control flow
(d) Iterative
(a) Assignment

Question 8.
__________takes input data, process the data, and produce output data.
a) Function
b) Algorithm
c) Procedure
d) None of these
b) Algorithm

Question 9.
Each part of the algorithm is known as ………………..
(a) input
(b) function
(c) variable
(d) program
(b) function

Question 10.
When we do operations on data, we need to store the results in________
a) Function
b) Algorithm
c) Constant
d) Variable
d) Variable

Question 11.
If i: = 3 before the assignment, i: = i + 1 after the assignment ………………..
(a) 3
(b) 4
(c) 5
(d) 0
(b) 4 Question 12.
In algorithm, the statement to be executed next may depend on the __________
a) algorithm step
b) state of the process
c) user direction
d) None of these
b) state of the process

Question 13.
If i: = 10 before the assignment, then i: = i % 2 after the assignment
(a) 10
(b) 5
(c) 0
(d) 1
(c) 0

Question 14.
There are control flow statements to alter the control flow depending on the state.
a) two
b) five
c) four
d) three
d) three

Question 15.
Initially the values of P and C are 4 and 5 respectively
– – P, C : = 4, 5
P : = C
C : = P. Then find P and C
(a) 4 and 4
(b) 5 and 4
(c) 5 and 5
(d) 4 and 5
(c) 5 and 5

Question 16.
__________ control flow, a condition of the state is tested, and if the condition is true, one statement is executed; if the condition is false, n alternative statement is executed.
a) alternative
b) iterative
c) random
d) sequential
a) alternative Question 17.
How many Algorithmic designing techniques are there?
(a) 2
(b) 3
(c) 4
(d) 5
(c) 4

Question 18.
A ___________ takes an input and produces an output, satisfying a desired input-output relation.
a) function
b) union
c) structures
d) None of these
a) function

Question 19.
which one of the following is the equality operator?
(a) =
(b) = =
(c) + +
(d) – –
(b) = =

Question 20.
___________ is the basic principle and technique for designing algorithm.
a) Specification
b) Abstraction
c) Composition and Decomposition
d) All the above
d) All the above Question 21.
Which one of the following statements are not executed on the computers?
(a) Comment line
(c) cin
(d) cout
(a) Comment line

Question 22.
Ignoring or hiding unnecessary details and modeling an entity only by its essential properties is known as __________
a) data hiding
b) abstraction
c) data analysis
d) None of these
b) abstraction

Question 23.
The values of the variables when the algorithm finishes is ………………..
(a) final stage
(b) final state
(c) last stage
(d) last state
(b) final state

Question 24.
An algorithm is composed of__________
statement.
a) assignment
b) control flow
c) both A and B
d) None of these
c) both A and B Question 25.
Which one of the following is not a building block of the algorithm?
(a) data
(b) state
(c) variables
(d) functions
(b) state

Question 26.
To solve a problem, we must state the problem__________
a) clearly and precisely
b) with ambiguity
c) with data hiding
d) None of these
a) clearly and precisely

Question 27.
Reasoning:
I. We can store a value in a variable using the assignment operator.
II. We can change the value in a variable using the assignment operator.
III. Assignment operator is = =
(a) I and III are true
(b) I and II are true
(c) II and III are true
(d) I, II, III is true
(b) I and II are true

Question 28.
Specification of an algorithm is the desired __________relation.
a) input-process
b) process-output
c) input-output
d) None of these
c) input-output Question 29.
In which one of the control flow statements, if the condition is false, then the alternative statement will be executed ………………..
(a) Sequential
(b) iterative
(c) selection
(d) alternative
(d) alternative

Question 30.
The values of the variables when the algorithm starts are known as the __________state.
a) initial
b) final
c) intermediate
d) None of these
a) initial

Question 31.
If the statement is executed one after the other, then it is a control flow.
(a) Sequential
(b) iterative
(c) selection
(d) alternative
(a) Sequential

Question 32.
We can write the specification in a standard __________part format.
a) three
b) four
c) two
d) many
a) three

Question 33.
Which one of the following is not a technique for designing algorithms?
(a) specifications
(b) abstraction
(c) encapsulation
(d) composition
(c) encapsulation Question 34.
__________defines the rights and responsibilities of the designer and the user.
a) Specification
b) Abstraction
c) Composition and Decomposition
d) All the above
a) Specification

Question 35.
How many parts are there in the specification is ………………..
(a) 2
(b) 3
(c) 4
(d) 5
(b) 3

Question 36.
In algorithms, the state of a computation is abstracted by a set of __________
a) expressions
b) variables
c) functions
d) None of these
b) variables

Question 37.
Identify the statement which is not true?
(a) An instruction describes an object
(b) the specification is one of the algorithm design techniques
(c) An algorithm is a step by step sequence of instructions
(a) An instruction describes an object

Question 38.
_________ is a basic and important abstraction.
a) process
b) state
d) None of these
d) None of these Question 39.
Sequential, Alternative, and Iterative comes under the classification of ……………….. :
(a) Building blocks of the algorithm
(b) control flow statements
(c) Algorithm design techniques
(d) Abstraction
(b) control flow statements

Part II

Question 1.
Define State.
The state of a process can be represented by a set of variables in an algorithm. The State at any point of execution is simply the values of the variables at that point.

Question 2.
What is the statement?
Instructions of a computer are also known as statements.

Question 3.
Define variable.
The data stored in a variable is also known as the value of the variable. We can store a value in a variable or change the value of a variable, using an assignment statement.

Question 4.
What are the building blocks of algorithms?
The building blocks of algorithms are;

• Data.
• Variables.
• Control flow.
• Functions. Question 5.
Define control flow.
The order in which the statements are executed may differ from the order in which they are written in the algorithm. This order of execution of statements is known as the control flow.

Question 6.
What is a function?
The parts of an algorithm are known as functions. A function is like a sub-algorithm. It takes an input, and produces an output, satisfying the desired input, output relation.

Question 7.
How will you specify the algorithm?
The algorithm S is specified as;

• algorithm_name (inputs)
• inputs: P
• outputs: Q

This specification means that if the algorithm starts with inputs satisfying P, then it will finish with the outputs satisfying Q.

Question 8.
Define abstraction.
Abstraction is the process of ignoring or hiding irrelevant details and modeling a problem only by its essential features. Question 9.
What purpose abstraction is used?
Abstraction is the most effective mental tool used for managing complexity. If we do not abstract a problem adequately, we may deal with unnecessary details and complicate the solution.

Part III

Explain in brief

Question 1.
Define Alternative control flow statement.
In alternative control flow, a condition of the state is tested, and if the condition is true, one statement is executed; if the condition is false, an alternative statement is executed.

Question 2.
Justify goat, grass, and wolf problem is algorithmic.
goat, grass, and wolf problem:
A farmer wishes to take a goat, a grass bundle, and a wolf across a river. However, his boat can take only one of them at a time. So several trips are necessary across the river.

Moreover, the goat should not be left alone with the grass (otherwise, the goat would eat the grass), and the wolf should not be left alone with the goat (otherwise, the wolf would eat the goat).

How can the farmer achieve the task? Initially, we assume that all the four are at the same side of the river, and finally, all the four must be on the opposite side. The farmer must be in the boat when crossing the river.
A solution consists of a sequence of instructions indicating who or what should cross. Therefore, this is an algorithmic problem.

Question 3.
Write the Iterative control flow statement.
In iterative control flow, a condition of the state is tested, and if the condition is true, a statement is executed. The two steps of testing the condition and executing the statement are repeated until the condition becomes false. Question 4.
Explain variable.
Variables are named boxes for storing data. When we do operations on data, we need to store the results in variables. The data stored in a variable is also known as the value of the variable.
We can store a value in a variable or change the value of a variable, using an assignment statement.

Question 5.
Write the following
(i) initial state
(ii) final state
The values of the variables when the algorithm starts are known as the initial state, and the values of the variables when the algorithm finishes are known as the final state. Question 6.
When functions are needed?
Algorithms can become very complex. The variables of an algorithm and dependencies among the variables may be too many. Then, it is difficult to build algorithms correctly.
In such situations, we break an algorithm into parts, construct each part separately, and then integrate the parts to the complete algorithm. The parts of an algorithm are known as functions.

Question 7.
Give an example for a function?
Suppose we want to calculate the surface area of a cylinder of radius r and height h.
A = 2 πr² + 2πrh
We can identify two functions, one for calculating the area of a circle and the other for the circumference of the circle.
If we abstract the two functions as circle_area(r) and circle_circumference(r), then,
cylinder_area (r, h) can be solved as:
cylinder_area (r, h) = 2 X circle_area (r) + circle_circumference (r) X h.

Question 8.
What are the basic principles and techniques for designing algorithms?
The basic principles and techniques for designing algorithms are:

• Specification.
• Abstraction.
• Composition.
• Decomposition.

Question 9.
Write the specification format and explain.
Specification format:
We can write the specification in a standard three-part format:

• The name of the algorithm and the inputs.
• Input: the property of the inputs.
• Output: the desired input-output relation.

The first part is the name of the algorithm and the inputs. The second part is the property of the inputs. It is written as a comment which starts with – inputs: The third part is the desired input-output relation.
It is written as a comment which starts with — outputs: The input and output can be written using English and mathematical notation. Question 10.
Write the specification of an algorithm for computing the square root of a number.

• Let us name the algorithm square_root.
it takes the number as the input. Let us name the input n. n should not be negative.
• It produces the square root of n as the output. Let us name the output y. Then n should be the square of y.

Now the specification of the algorithm is
a) square_root (n).
b) inputs: n is a real number, n > 0.
c) outputs: y is a real number such that y 2= n.

Question 11.
Give an example for abstraction.

• A road map is designed for drivers. They do not usually worry about hills so most hills are ignored on a road map.
• A walker’s map is not interested in whether a road is a one-way street, so such details are ignored.

Part IV

Explain in detail

Question 1.
Explain the three control flow statement.
There are three important control flow statements to alter the control flow depending on the state.

1. In sequential control flow, a sequence of statements is executed one after another in the same order as they are written.
2. In alternative control flow, a condition of the state is tested, and if the condition is true, one statement is executed; if the condition is false, an alternative statement is executed.
3. In iterative control flow, a condition of the state is tested, and if the condition is true, a statement is executed. The two steps of testing the condition and executing the statement are repeated until the condition becomes false.

Question 2.
What are the uses of the Operating System?
The basic principles and techniques for designing algorithms are;

• Specification.
• Abstraction.
• Composition.
• Decomposition.

Specification: The first step in problem-solving is to state the problem precisely. A problem is specified in terms of the input given and the output desired. The specification must also state the properties of the given input, and the relation between the input and the output.

Abstraction: A problem can involve a lot of details. Several of these details are unnecessary for solving the problem. Only a few details are essential. Ignoring or hiding unnecessary details and modeling an entity only by its essential properties is known as abstraction. For example, when we represent the state of a process, we select only the variables essential to the problem and ignore inessential details.

Composition: An algorithm is composed of assignment and control flow statements. A control flow statement tests a condition of the state and, depending on the value of the condition, decides the next statement to be executed. Decomposition: We divide the main algorithm into functions. We construct each function independently of the main algorithm and other functions. Finally, we construct the main algorithm using the functions.

Question 3.
Explain the specification format.
Specification format: We can write the specification in a standard three-part format:

1. The name of the algorithm and the inputs
2. Input: the property of the inputs
3. Output: the desired input-output relation

The first part is the name of the algorithm and the inputs. The second part is the property of the inputs. It is written as a comment which starts with – inputs: The third part is the desired input-output relation. It is written as a comment which starts with outputs: The input and output can be written using English and mathematical notation. Question 4.
Explain the state with a suitable example.
State:
The state is a basic and important abstraction. Computational processes have stated. A computational process starts with an initial state. As actions are performed, its state changes. It ends with a final state.

The state of a process is abstracted by a set of variables in the algorithm. The state at any point of execution is simply the values of the variables at that point.

Example:
Chocolate Bars: A rectangular chocolate bar is divided into squares by horizontal and vertical grooves. We wish-to break the bar into individual squares.
To start with, we have the whole of the bar as a single piece. A cut is made by choosing a piece and breaking it along one of its grooves. Thus a cut divides a piece into two pieces. How many cuts are needed to break the bar into its individual squares? In this example, we will abstract the essential variables of the problem.

Essential variables:
The number of pieces and the number of cuts are the essential variables of the problem. We will represent them by two variables, p and c, respectively. Thus, the state of the process is abstracted by two variables p and c.

Irrelevant details:
The problem could be cutting a chocolate bar into individual pieces or cutting a sheet of postage stamps into individual stamps. It is irrelevant. The problem is simply cutting a grid of squares into individual squares. The sequence of cuts that have been made and the shapes and sizes of the resulting pieces are irrelevant too. From p and c, we cannot reconstruct the sizes of the individual pieces. But, that is irrelevant to solving the problem.