subjects

Dropdown Menu

Friday, 20 November 2020

Decision Table



 Decision tables are compact and precise ways of modelling complicated logic we use in a computer program. They do this by mapping the different states of a program to an action that a program should perform.

It maps conditions against actions: it expresses the fact that certain actions are to be performed only if certain conditions are satisfied.

Decision table helps to check all possible combinations of conditions for testing and testers can also identify missed conditions easily.

It is a table of rows and columns, separated into four quadrants

A FEW GUIDELINES FOR CONSTRUCTING A DECISION TABLE:

1) Draw boxes for the top and bottom left quadrants.

2) List the conditions in the top left quadrant.

When possible, phrase the conditions as questions that can be answered with a Y for yes and an N for a no.

3) List the possible actions in the bottom left quadrant.

4) Count the possible values for each condition and multiply these together to determine how many unique combinations of conditions are present. Draw one column in the top and bottom right quadrants for each combination. For example, if there are two conditions and the first condition has two possible values while the second has three possible values, draw six (2 * 3) columns.

5) Enter all possible combinations of values in the columns in the top right quadrant of the table.

6) For each column, that is, each unique combination of conditions, mark an X in the bottom right quadrant in the appropriate action row. The X marks the intersection between the required action and each unique combination of condition values. If the user provides correct username and password the user will be logged in. If any of the input is wrong or blank an error message will be displayed.






Flowchart:

1.5 Flowchart: Flowchart is a pictorial (diagrammatic) representation of an algorithm. It is constructed using different types of symbols, each symbol is used for a specific purpose

While drawing flowchart we need to follow these rules

1. A flowchart should have a start and an end.

2. The direction of flow in a flow chart must be from top to bottom and left to right.

3. The relevant symbols must be used while drawing a flowchart.





Algorithm:

1.4  Algorithm: An algorithm is a method of representing step by step logical procedure for solving a particular task


1. Write an algorithm to add two numbers

Step1: start

Step2: declare a, b

Step2: read a, b values

Step3: display a+b

Step4: stop


2. Write an algorithm to find average of six subjects

Step1: start

Step2: declare tel, hin, eng, mat, sc, cs, tot, avg

Step3: read subject marks tel, hin, eng, mat, sc, cs

Step4: tot = tel+hin+eng+mat+sc+cs

Step5: avg = tot / 6

Step6: display avg

Step7: stop


3.Write an algorithm to find the largest between two different numbers entered by user.

Step 1: Start

Step 2: Declare variables a,b

Step 3: Read variables a,b

Step 4: If a>b

    Display a is the largest number.

Else

    Display b is the largest number.

.Step 5: Stop


4.Write an algorithm to print n natural numbers

Step 1: Start

Step 2: Declare variables i , num

Step 3: i=1

Step 4: Read the value for num

Step 5: if(i<num) then

Display i value

i = i+1

Step 6: if(i<num) go to Step 5 else goto step 7

Step 7: Stop

Debugging:

 1.3 Debugging: Programming is error-prone. Programming errors are called bugs and the process of identifying and removing errors from a program is called debugging.

Three kinds of errors can occur in a program:

1.Syntax errors

2.Runtime errors

3.Semantic errors

It is useful to distinguish between them in order to track them down more quickly.

Syntax errors:

Python can only execute a program if the syntax is correct otherwise the interpreter displays an error message.

Syntax refers to the structure of a program and the rules about that structure.

For example, parentheses have to come in matching pairs,

so print(“Hello World”) is legal but print(“Hello World” is a syntax error.

Runtime errors:

The second type of error is a runtime error. Run time errors are detected during the execution of a program. These errors are also called exceptions. When exception occurs the program stops the normal execution and terminates abruptly

For example, division by zero is not defined in mathematics which can lead to arithmetic exception

Semantic errors:

The third type of error is the semantic error. If there is a semantic error in our program, it will run successfully in the sense that the computer will not generate any error messages, but it will not do the right thing. It will do something else.

Computer Fundamentals

Unit1: Computer Fundamentals

1. Introduction to Computers

1.1 Computer Definition : Computer is an electronic device which accepts data as input, process the data, and gives the desired output. Computers are data processing machines.

The term computer derived from the word compute which means to calculate.


1.2 Problem solving: Problem solving means the ability to formulate solution to problems, think creatively about solutions, and express a solution clearly and accurately. Computers are problem solvers , as part of problem solving we can write either algorithms, flowcharts , decision tables or programs

1.3 Program development

A program is a set of instructions written for performing a specific task. An instruction in a program have three essential parts

1. Instruction to accept the input data that has to be processed,

2. Instructions that will act upon the input data and process it, and

3. Instructions to provide the output to user

The steps involved in writing a program

1. Problem analysis

2. Program Design

3. Program Development

4. Program Documentation and Maintenance

Problem Analysis: The programmer first understand the problem to be solved.

The programmer finds different ways and decides which the most suited solution is

Program Design: while preparing a solution the three steps we follow are

1. We write an algorithm

2. We will draw a flowchart

3. We will write pseudo code

Program Development:

1. We use some high-level language to write code.

2. We use either compiler or interpreter to convert the source code to object code.

3. During compilation, the syntax errors if any, are removed.

4. The successfully compiled program is ready for execution.

5. The executed program generate output results.

6. Successfully tested program is ready for execution

Program Documentation and Maintenance:

The program is properly documented, so that later on, anyone can use it and understand its working.

Any changes made to the program, after installation, forms part of the maintenance of the program