Students can Download Computer Science Chapter 6 Specification and Abstraction 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 6 Specification and Abstraction

### Samacheer Kalvi 11th Computer Science Specification and Abstraction Text Book Back Questions and Answers

PART – 1

I. Choose The Correct Answer

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

Answer:

(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

Answer:

(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

Answer:

(b) abstraction

Question 4.

Stating the input property and the input-output relation a problem is known ………………..

(a) specification

(b) statement

(c) algorithm

(d) definition

Answer:

(a) specification

Question 5.

Ensuring the input – output relation is ………………..

(a) the responsibility of an 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.

Answer:

(a) the responsibility of an algorithm and the right of the user.

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

Answer:

(b) 4

Question 7.

If O < i before the assignment i : = i – 1 after the assignment, we can conclude that

(a) 0 < i

(b) 0 ≤ i

(c) i = 0

(d) 0 ≥ i

Answer:

(b) 0 ≤ i

PART – 2

II. Very Short Answers

Question 1.

Define an algorithm.

Answer:

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.

Answer:

Algorithm:

- An Algorithm is a sequence of instructions to solve a problem.
- Elements of a process are abstracted in algorithms.
- Example: Algorithm can be compared to a recipe

Process:

- A process is executing of instructions to accomplish the intended task.
- A process is actual execution of the steps to solution.
- Example: A process can be compared to cooking.

Question 3.

Initially, farmer, goat, grass, wolf = L, L, L, L and the farmer crosses the river with goat. Model the action with an assignment statement. Model of the action with an assignment statement:

Answer:

- — farmer, goat,grass,wolf = L,L,L,L.
- Farmer,goat: = R,R
- – farmer,goat,grass,wolf = R,R,L,L
- – farmer: = L
- — farmer,goat,grass,wolf = L,R,L,L
- farmer,grass: = R,R
- — farmer,goat,grass,wolf = R,R,R,L
- farmer,goat: = L,L
- — farmer,goat,grass, wolf = L,L,R,L
- farmer, wolf: = R,R
- — farmer,goat,grass, wolf = R,L,R,R
- farmer: = L
- — farmer,goat,grass,wolf = L,L,R,R
- farmer, goat: = R,R
- — farmer,goat,grass,wolf = R,R,R,R

Question 4.

Specify a function to find the minimum of two numbers.

Answer:

- – – minimum (a,b)
- – – inputs : a, b are real numbers.
- – – output: result: = minimum (a,b)

Question 5.

If \(\sqrt{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 a real number such that y
^{2}= x

Answer:

No, because (- 1.414)^{2} = 2, which satisfies input – output relation (y^{2} = x)

PART – 3

III. Short Answers

Question 1.

When do you say that a problem is algorithmic in nature?

Answer:

A Problem is algorithmic in nature when its solution involves the construction of an algorithm. Also when the

- Input data and output data of the problem is specified.
- Relation between the input data and the output data is specified.

Question 2.

What is the format of the specification of an algorithm?

Answer:

Let P be the required property of the inputs and Q the property of the desired outputs.

Format of specification of an algorithm:

- Algorithm name (Inputs)
- Inputs – P
- Outputs – Q

Question 3.

What is abstraction?

Answer:

Abstraction:

It is the facility to define objects. It also involves 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 state represented in algorithms?

Answer:

The state represented in a algorithm is set of variables. At any place the value of the variables are substituted and evaluation is done.

Question 5.

What is the form and meaning of assignment statement?

Answer:

Assignment statement is used to assign values to the variables.

The variable on the left side of the assignment operator and a value on the right side.

Variable : = Value

Question 6.

What is the difference between assignment operator and equality operator?

Assignment Operator:

Assignment operator is used to assign the values to the variable.

Equality Operator:

The equality operator is used to compare the values of both the variables and the result is true or false.

PART – 4

IV. Explain in Detail

Question 1.

Write the specification of an algorithm hypotenuse w hose inputs are the lengths of the two shorter sides of a right angled triangle, and the output is the length of the third side.

Answer:

- hypotenuse (a, b)
- – – inputs: a, b are real numbers, a > 0, b > 0
- – – outputs: c
^{2}= a^{2}+ b^{2}wrhere c is real number, c > 0

Question 2.

Suppose you want to solve the quadratic equation ax^{2} + bx + c – 0 by an algorithm. quadratic_solve (a, b, c)

— inputs : ?

— outputs: ?

You intend to use the formula and you are prepared to handle only real number roots. Write a suitable specification.

Answer:

- Quadratic – solve (a, b, c)
- – – inputs: b
^{2}– 4 ac > = 0 where a, b, c are real numbers, a ≠ 0 - – – outputs: and x
^{2}are real numbers such that a(x_{1})^{2}+ bx_{1}+ c = 0 and a(x_{2})^{2}+ bx_{2}+ c = 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.

Answer:

Let the variables a, b, c represent the glass A, glass B and Glass C respectively. Variables A, B, C can store values APPLE, GRAPE or EMPTY.

Specification:

- Exchange ( )
- – – inputs: a, b, c := APPLE, GRAPE, EMPTY
- – – outputs: a, b,c: = GRAPE, APPLE, EMPTY

### Samacheer kalvi 11th Computer Science Specification and Abstraction Additional Questions and Answers

PART – 1

I. Choose the correct answer

Question 1.

Which one of the following is an example of process?

(a) Braid the hair

(b) Adding three numbers

(c) Cooking a dish

(d) Walk in the Road

Answer:

(c) Cooking a dish

Question 2.

Who was a Hungarian Mathematician?

(a) G. Polya

(b) John Wiley

(c) Krysia Broda

(d) Steve Vickers

Answer:

(a) G. Polya

Question 3.

How many basic building blocks construct an algorithm?

(a) 3

(b) 4

(c) 5

(d) 8

Answer:

(b) 4

Question 4.

……………….. state the properties of the given input and the relation between the input and the output.

(a) Composition

(b) Abstraction

(c) Decomposition

(d) Specification

Answer:

(d) Specification

Question 5.

……………….. how many control flow statement are there to alter the control flow depending on the state?

(a) 5

(b) 6

(c) 3

(d) 8

Answer:

(c) 3

Question 6.

What is the specification of the algorithm?

Answer:

(a) divide (A + B)

(b) square – root (n)

(c) square – root (x)

(d) adding (A, B)

Answer:

(b) square – root (n)

Question 7.

……………….. statement is used to store a value in a variable.

(a) Assignment

(b) Sequential control flow

(c) Alternative control flow

(d) Iterative

Answer:

(a) Assignment

Question 8.

The data stored in a variable is also called a ………………..

(a) process

(b) data

(c) value

(d) constant

Answer:

(c) value

Question 9.

Each part of algorithm is known as ………………..

(a) input

(b) function

(c) variable

(d) program

Answer:

(b) function

Question 10.

……………….. is the left side of the assignment.

(a) variable

(b) value

(c) operator

(d) all the above

Answer:

(c) operator

Question 11.

If i: = 3 before the assignment, i: = i + 1 after the assignment ………………..

(a) 3

(b) 4

(c) 5

(d) 0

Answer:

(b) 4

Question 12.

If i: = 2 before the assignment, then i: = i * 3 after the assignment is ………………..

(a) 6

(b) 5

(c) 0

(d) 1

Answer:

(a) 6

Question 13.

If i: = 10 before the assignment, then i: = i % 2 after the assignment

(a) 10

(b) 5

(c) 0

(d) 1

Answer:

(c) 0

Question 14.

If – – m, n = 22, 5 and m, n : = m + 3, n – 1 then the value of m and n are ………………..

(a) 25, 4

(b) 24,5

(c) 22, 5

(d) 23,21

Answer:

(a) 25, 4

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

Answer:

(c) 5 and 5

Question 16.

What are the values of variable m and n after the assignments in line (1) and line (3)?

1. m, n : = 2, 5

2. – – m, n = ?, ?

3. m, n : = m + 3, n – 1

4. – – m, n = ?, ?

(a) 4, 5

(b) 5, 4

(c) 5,5

(d) 4, 4

Answer:

(b) 5, 4

Question 17.

How many Algorithmic designing techniques are there?

(a) 2

(b) 3

(c) 4

(d) 5

Answer:

(c) 4

Question 18.

which one of the following is the assignment operator?

(a) =

(b) = =

(c) + = =

(d) + +

Answer:

(a) =

Question 19.

which one of the following is the equality operator?

(a) =

(b) = =

(c) + +

(d) – –

Answer:

(b) = =

Question 20.

which one of the following is the comment line in algorithm?

(a) + +

(b) 1 1

(c) – –

(d) = =

Answer:

(c) – –

Question 21.

Which one of the following statements are not executed the computers?

(a) Comment line

(b) Header file

(c) cin

(d) cout

Answer:

(a) Comment line

Question 22.

The values of the variables when the algorithm starts is ………………..

(a) stage

(b) initial stage

(c) initial state

(d) starting state

Answer:

(c) initial state

Question 23.

The values of the variables when the algorithm finishes is ………………..

(a) final stage

(b) final state

(c) last stage

(d) last state

Answer:

(b) final state

Question 24.

Instructions of a computer are also known as ………………..

(a) commands

(b) statements

(c) Abstractions

(d) Functions

Answer:

(b) statements

Question 25.

Which one of the following is not a building block of algorithm

(a) data

(b) state

(c) variables

(d) functions

Answer:

(b) state

Question 26.

Which are the named boxes used for storing data?

(a) data

(b) variables

(c) control flow

(d) functions

Answer:

(b) variables

Question 27.

Reasoning:

I. We can store a value in a variable using assignment operator.

II. We can change the value in a variable using assignment operator.

III. Assignment operator is = =

(a) I and III is true

(b) I and II is true

(c) II and III is true

(d) I, II, III is true

Answer:

(b) I and II is true

Question 28.

The order of execution of statement is called :

(a) Composition

(b) Functions

(c) Control flow

(d) Specifications

Answer:

(c) Control flow

Question 29.

In which one of the control flow statements, if the condition is false, then alternative statement will be executed ………………..

(a) Sequential

(b) iterative

(c) selection

(d) alternative

Answer:

(d) alternative

Question 30.

In which one of the following control flow, the statements are repeated until the conditon becomes false ………………..

(a) Sequential

(b) iterative

(c) selection

(d) alternative

Answer:

(b) iterative

Question 31.

If the statement are executed one after the other, then it is control flow.

(a) Sequential

(b) iterative

(c) selection

(d) alternative

Answer:

(a) Sequential

Question 32.

A is like a sub algorithm.

(a) function

(b) data

(c) variable

(d) state

Answer:

(a) function

Question 33.

Which one of the following is not a techniques for designing algorithms?

(a) specifications

(b) abstraction

(c) encapsulation

(d) composition

Answer:

(c) encapsulation

Question 34.

Fill in the box given below figure ………………..

(a) processing

(b) solving

(c) algorithm

(d) functions

Answer:

(c) algorithm

Question 35.

How many parts are there in specification is ………………..

(a) 2

(b) 3

(c) 4

(d) 5

Answer:

(b) 3

Question 36.

The first part of the specification is ………………..

(a) Input

(b) Output

(c) property of inputs

(d) The name of the algorithm and the inputs

Answer:

(d) The name of the algorithm and the inputs

Question 37.

Identify the statement which is not true?

(a) An instruction describes an object

(b) specification is one of the algorithm design techniques

(c) An algorithm is a step by step sequence of instructions

Answer:

(a) An instruction describes an object

Question 38.

In multiple variable assignment statement, the number of variables and the number of expressions must ………………..

(a) differ at least by 1

(b) not equal to 1

(c) equal to 0

(d) be equal

Answer:

(d) be equal

Question 39.

Sequential, Alternative and Iterative comes under the classification of ……………….. :

(a) Building blocks of algorithm

(b) control flow statements

(c) Algorithm design techniques

(d) Abstraction

Answer:

(b) control flow statements

Question 40.

To execute in a computer, an algorithm must be expressed using the statement of ………………..

(a) Object code

(b) Machine Language

(c) Assembler

(d) Programming Languages

Answer:

(d) Programming Languages

Question 41.

If the variable already has a value, and you are assigning a new value, what will happen to the old variable?

(a) retained

(b) added

(c) lost

(d) becomes 0

Answer:

(c) lost

Question 42.

Identify the function name: square (A + B) ………………..

(a) A

(b) B

(c) A + B

(d) square

Answer:

(d) square

Question 43.

Identify the correct statement ………………..

(a) The first part of specification is name of the algorithm with input

(b) Second one is input properties with comments

(c) Third one is relation between input – output

(d) All the three are correct statements

Answer:

(d) All the three are correct statements

Question 44.

Find the wrong statement from the following ………………..

(a) The state of a process can be represented by a set of variables in an algorithm

(b) The state at any point of execution is simply the values of the variables at that point.

(c) As the values of the variables are changed, the state remains constant.

(d) As a process evolves, the state changes.

Answer:

(c) As the values of the variables are changed, the state remains constant.

Question 45.

The input and output are passed between an algorithm and the user through ………………..

(a) data

(b) assignment

(c) stage

(d) variables

Answer:

(d) variables

Question 46.

Match the following

(a) 2, 1, 4, 3

(b) 1, 2, 3, 4

(c) 4,3,2, 1

(d) 4, 2, 3, 1

Answer:

(a) 2, 1, 4, 3

Question 47.

Match the following

(a) 3, 1, 4, 2

(b) 1,2, 3, 4

(c) 4,3,2, 1

(d) 4, 2, 3, 1

Answer:

(a) 3, 1, 4, 2

Question 48.

Which one of the following statements are used to annotate a program for the human readers?

(a) comments

(b) state

(c) variables

(d) functions

Answer:

(a) comments

Question 49.

In specification, the input and output can be written using ………………..

(a) English

(b) Mathematical notation

(c) Binary format

(d) Both a and b

Answer:

(d) Both a and b

Question 50.

Which one of the following defines the rights and responsibilities of the designer and the user?

(a) Abstraction

(b) Composition

(c) Decomposition

(d) Specification

Answer:

(d) Specification

Question 51.

Which one of the following is the most effective mental tool used for managing complexity?

(a) Specification

(b) Abstraction

(c) Composition

(d) Decomposition

Answer:

(b) Abstraction

Question 52.

How will be the input and output passed between an algorithm and the user ………………..

(a) comments

(b) Assignment

(c) Variable

(d) Functions

Answer:

(c) Variable

Question 53.

The goal of the algorithm is ………………..

(a) to state the input properties

(b) to state the output properties

(c) to divide into functions

(d) to establish the input output relation

Answer:

(d) to establish the input output relation

PART – 2

II. Short Answers

Question 1.

Define State.

Answer:

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.

Mention the three different types of Chameleons.

Answer:

There are three different types of chameleons: red chameleons, green chameleons, and blue chameleons.

Question 3.

Define variable.

Answer:

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 variable, using an assignment statement.

Question 4.

Write the basic building blocks of algorithms.

Answer:

- Data
- Variables
- Control flow
- Functions

Question 5.

Define control flow.

Answer:

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 are the basic principles and techniques for designing Algorithms.

Answer:

- Specification
- Abstraction
- Composition
- Decomposition

PART – 3

III. Explain in Brief

Question 1.

Define Alternative control flow statement.

Answer:

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.

What is Decomposition?

Answer:

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. When we use the functions, it is enough to know the specification of the function. It is not necessary to know how the function is implemented.

Question 3.

Write the Iterative control flow statement.

Answer:

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.

Define functions.

Answer:

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 a desired input output relation.

Question 5.

Write the following (i) initial state (ii) final state

Answer:

The values of the variables when the algorithm starts is known as the initial state, and the values of the variables when the algorithm finishes is known as the final state.

Question 6.

What is the desired relation between the inputs A and B, and the output q and r?

Answer:

1. The two outputs q (quotient) and r (remainder) should satisfy the property

A = q X B + r,

and

2. The remainder r should be less than the divisor B,

0 < r < B

Combining these requirements, we will specify the desired input-output relation as

– outputs: A = q X B + r and 0 < r < B.

PART – 4

IV. Explain in Detail

Question 1.

Explain the three control flow statement.

Answer:

There are three important control flow statements to alter the control flow depending on the state.

- In sequential control flow, a sequence of statements are executed one after another in the same order as they are written.
- 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.
- 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.

Explain Algorithm Design Techniques.

Answer:

There are a few basic principles and techniques for designing algorithms.

1. 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.

2. 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.

3. 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.

4. 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. When we use the functions, it is enough to know the specification of the function. It is not necessary to know how the function is implemented.

Question 3.

Explain the specification format.

Answer:

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 4.

What are the values of variables m and n after the assignments in line (1) and line (3)?

- m, n : = 2, 5
- – – m, n = ?, ?
- m,n: = m + 3, n – 1
- – – m, n = ?, ?

The assignment in line (1) stores 2 in variable m, and 5 in variable n.

The assignment in line (3) evaluates the expressions m + 3 and n – 1 using the current values of m and n as

m + 3 , n – 1

= 2 + 3, 5 – 1

= 5, 4

and stores the values 5 and 4 in the variables m and n, respectively.

- m, n : = 2, 5
- – – m, n = 2, 5
- m, n : = m + 3, n – 1
- – – m, n = 2 + 3, 5 – 1 = 5, 4

Values of the variables after the two assignments are shown in line (2) and line (4).

Question 5.

Explain the Basic Building Blocks of Algorithms.

Data:

Algorithms take input data, process the data, and produce output data. Computers provide instructions to perform operations on data. For example, there are instructions for doing arithmetic operations on numbers, such as add, subtract, multiply and divide. There are different kinds of data such as numbers and text.

Variables:

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 variable, using an assignment statement.

Control flow:

An algorithm is a sequence of statements. However, after executing a statement, the next statement executed need not be the next statement in the algorithm. The statement to be executed next may depend on the state of the process. Thus, 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.

There are three important control flow statements to alter the control flow depending on the state.

- In sequential control flow, a sequence of statements are executed one after another in the same order as they are written.
- 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.
- 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.

Functions:

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 a desired input output relation.

Question 6.

Explain specification.

Answer:

Specification:

To solve a problem, first we must state the problem clearly and precisely. A problem is specified by the given input and the desired output. To design an algorithm for solving a problem, we should know the properties of the given input and the properties of the desired output. The goal of the algorithm is to establish the relation between the input and the desired output.

An algorithm is specified by the properties of the given input and the relation between the input and the desired output. In simple words, specification of an algorithm is the desired input – output relation. The inputs and outputs are passed between an algorithm and the user through variables. The values of the variables when the algorithm starts is known as the initial state, and the values of the variables when the algorithm finishes is known as the final state.

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. A double dash – indicates that the rest of the line is a comment. Comments are statements which are used to annotate a program for the human readers and not executed by the computer. Comments at crucial points of flow are useful, and even necessary, to understand the algorithm. In our algorithmic notation, we use double dashes (-) to start a comment line. (In C++, a double slash // indicates that the rest of the line is a comment).

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.

Specification as contract:

Specification of an algorithm serves as a contract between the designer of the algorithm and the users of the algorithm, because it defines the rights and responsibilities of the designer and the user. Ensuring that the inputs satisfy the required properties is the responsibility of the user, but the right of the designer. The desired input-output relation is the responsibility of the designer and the right of the user. Importantly, if the user fails to satisfy the properties of the inputs, the designer is free from his obligation to satisfy the desired input – output relation.