Programming Concepts

Learn about Programming Concepts

Author:Author ImageKrish Beachoo

Edu Level: CSEC,NCSE

Date: Aug 9, 2021

⏱️Read Time:



Sequence

Sequence is a control structure where instructions are written in the order they should take place.

Looping

Looping or repetition or iteration is a control structure used to repeat a certain process a number of times eg while loop, for loop, repeat-until

Selection

Selection or conditional is a control structure used in problems with instructions to be carried out if a certain condition is met. The choice will depend on whether the condition is true or false. Eg if-then-else

Conditions

  • Statement in a program which evaluates whether an action in the program is true or false.
  • Eg if (condition) then…
  • while (condition) do

Variables

Values that change during the execution of a program.

Constants

Data that do not change during the execution of a program.

Arithmetic, Relational, and Logical Operators

Arithmetic operators are utilized for conducting mathematical operations, such as addition (+), subtraction (-), division (/), and multiplication (*).

Relational operators are employed to compare values and produce results based on the comparison. Examples of relational operators include greater than (>), less than (<), greater than or equal to (>=), less than or equal to (<=), not equal to (<>), and equal to (=).

Logical operators enable the comparison of multiple conditions and yield results based on logical relationships. These operators include AND, OR, and NOT.

Algorithm

An algorithm refers to a step-by-step sequence of clear and precise instructions that, when followed, leads to a solution for a given problem.

Test

  • After an algorithm is developed checks are performed to verify its correctness before it is used in live operation.
  • There are two types of test: manual (dry run or desk checking) and using a computer.
  • Manual Testing involves working through the program on paper by using test data. A trace table is created with the variables to show the changes in values when the program is executed.
  • Computer testing uses the computer to run the program with suitable test data (both valid and invalid) for all possible conditions. The results are then compared with the expected solutions.

Error

  • There are three types of errors when testing a program:
  • Syntax error- when the program code does not follow the rules of the programming language
  • Logic error – when the reasoning in the program is incorrect i.e. the instructions are placed in the wrong order.
  • Run time error – when the program has been executed and it is stuck in an infinite loop.

Error Detection and Debugging

Error detection and debugging involve the identification and resolution of existing and potential errors within a program. Many programming languages provide tools like debug utilities or debuggers, which aid in detecting syntax errors and locating logic errors.

Dont't forget to check out our Instagram Page!
edukatte_tt