0% found this document useful (0 votes)
22 views3 pages

Basic Programming Keywords in ICT

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views3 pages

Basic Programming Keywords in ICT

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SUBJECT: I.C.

CLASS: SS 2

DATE:

TERM: 3rd TERM

WEEK 2

TOPIC: BASIC PROGRAMMING I

KEYWORDS IN BASIC PROGRAMMING LANGUAGE

This is also referred to as BASIC statement or a reserved word. It is an instruction in BASIC, which has a
specific means to the compiler or interpreter.

1. REM STATEMENT

The REM statement is a remark statement. It is used to insert remarks in the program. Such remarks are used
to explain what the program is all about.

Example:

10 REM This program finds the average of 5 numbers

1. LET STATEMENT

The LET statement is used to assign (or give) values to variables.

Examples:

10 LET A = B + C

1. INPUT STATEMENT

Input is used to assign or give values to variables while program is running. It can be used with both numeric
and string variables.

Examples:

10 INPUT A, B, C

1. PRINT STATEMENT

The print statement tells your computer to display the output of the executed program on the screen of the
monitor (VDU).

Example:

10 PRINT SUMS

1. END STATEMENT
End Statement is an instruction used to terminate the program. One the computer encounters END statement,
it automatically terminates the program.

50 END

1. RUN STATEMENT

The RUN statement is used to execute a program. In Q-BASIC, F5 is used to RUN a program. Note that the
program will not RUN if any mistake or error is detected in it.

BASIC ARITHMETIC OPERATORS

The following are arithmetic operators in BASIC organized in their order of execution:

() Bracket

˄ Exponential

/ Division

* Multiplication

+ Addition

Subtraction

Basic must follow the above order during the execution of the program. In Mathematics, we are familiar with
the principle of evaluating algebraic expression using BODMAS but in BASIC programming Language, it is
called BEDMAS

BASIC ARITHMETIC EXPRESSION

Algebraic expressions are similar in a way to BASIC arithmetic expressions except for differences in some of
their operators.

The following are algebraic expressions and their corresponding BASIC arithmetic expression.

Algebraic Expression BASIC Arithmetic Expression


a+b A+B
a-b A-B
a÷b A/B
b5 B˄5
a=b*h A=B*H
X=am-by+c/z X=A*M-B*Y+C/Z
A=(-b+d)
A=(-B+D)/(2*C)
2c
X= -B+ (SQR(B˄2-4*A*C))/(2*A)
X
X= -B -(SQR(B˄2-4*A*C))/(2*A)
(x-y)
(X-Y)/(X+Y)
(x+y)
READING ASSIGNMENT: HiiT @ School, Computer Studies for Senior Secondary Education. Chapter Five,
pages 34-36, 110.

WEEKEND ASSIGNMENT

OBJECTIVES

1. ……………….. statement is used to assign (or give) values to variables (a) REM (b) INPUT (c) LET
2. ………………… statement is used to execute a program (a) INPUT (b) RUN (c) END
3. ………………… Statement is an instruction used to terminate the program. (a) INPUT (b) RUN (c)
END
4. ……………… principle of evaluating arithmetic expression in BASIC programming Language. (a) BODMAS
(b) BODMES (c) BEDMAS
5. …………….. statement is used to assign or give values to variables while program is running (a) INPUT
(b) RUN (c) END

THEORY

1. Write the function of the following BASIC keywords (a) LET (b) INPUT (c) PRINT (d) REM (e) RUN
2. Rewrite the following algebraic expressions as BASIC arithmetic expression. (a) Y= hk2 (b) (c)
(d)

Common questions

Powered by AI

In BASIC programming, the BEDMAS rule is essential for correctly evaluating arithmetic expressions. It dictates the precedence of operations as Brackets, Exponentiation, Division/Multiplication, and Addition/Subtraction. This ensures consistent and predictable results when executing expressions, as the operations are performed in the correct sequence . Correctly applying BEDMAS prevents logical errors in calculations, crucial for program validity .

The PRINT statement displays output data to the monitor, acting as an interface for user interaction by showing results of executed commands. This is critical for debugging and provides users with feedback or results from the program, facilitating understanding and interaction .

When converting algebraic expressions to BASIC expressions, consider operator differences (e.g., using '/' for division instead of '÷'), respect BEDMAS for operation order, and ensure correct syntax for function calls (e.g., using SQR for square root). Proper variable naming and inclusion of necessary parentheses are also crucial for preserving the expression's logic .

Reserved words and keywords in BASIC streamline programming by providing a set of predefined, recognizable commands that aid in building programs rapidly. They reduce syntax errors and enhance readability and maintainability of code by enforcing standard conventions. Their usage ensures consistent interpretation by the compiler for precise execution .

The RUN statement in BASIC executes the program, but it requires error-free code to function correctly. Potential errors include syntax errors (e.g., missing operators), logical errors (e.g., incorrect arithmetic), or runtime errors (e.g., divide by zero). Detecting these before running prevents crashes or undefined behavior, ensuring accurate program execution .

The REM statement in BASIC is used to include comments within the program. This helps to explain what the program is doing, making it easier for others to understand and maintain. Comments can clarify complex logic, note changes, and provide context, which is essential for maintaining and updating the code .

Both algebraic and BASIC expressions include variables and operators, but differ structurally. BASIC uses specific characters like '/' for division ('÷') and mandates explicit syntax like parentheses '()' to determine operation precedence due to BEDMAS. Algebraic expressions are more flexible in notation and implicitly follow BODMAS. The evaluation follows the same precedence logic but BASIC requires precise syntax for compiler interpretation .

The INPUT statement is used to accept data from users during program execution, while the LET statement assigns predefined values to variables within the program. INPUT is interactive and dynamic, altering variable values at runtime based on user input. Meanwhile, LET sets or updates values based on expressions or constants, typically without user interaction .

The END statement is crucial as it indicates the program's termination point. It signals to the compiler that no further instructions will follow, preventing unexpected behavior or errors. Without it, the program may continue running or attempt to execute non-existent code, leading to potential issues .

The LET statement is fundamental in BASIC as it assigns values to variables. It is used to initialize or update variable values, which facilitates data manipulation within programs. For example, 'LET A = B + C' would compute the sum of B and C and store the result in A .

You might also like