subjects

Dropdown Menu

Friday, 20 November 2020

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