Starting,Structure, Constants and Variables of QBASIC

Subject: Computer

Find Your Query
Kaspersky total security

Overview

QBASIC is the most popular high level programming language. A quantity in a computer program which does not change its value during the execution of the program is called a constant. This note elaborates on structures, constants and variables of Qbasic.
Starting,Structure, Constants and Variables of QBASIC

QBASIC Programming

QBASIC is the most popular high level programming language. Various versions of BASIC have been developed by Microsoft Company. This language is quite simple to understand and has been adopted by most of the microcomputers. It is suitable for both mathematical and business problems. It is compatible with MSDOS environment and it has two basic files QBASIC.EXE and QBASIC.HLP. We can edit, debug and execute the program using these two files.

The advantages of QBASIC

  1. QBASIC is easy to learn and fun to practice. It may be called a "People's language".
  2. It is available almost in every computer from micro to mainframe. Therefore, a program developed in a micro can run on bigger system with minor modifications.
  3. It is suitable for mathematical and business application.
  4. Program development cycle is quick, debugging is simple, and
  5. Modification of program is quite easy.

Starting QBASIC

It occupies very low memory so it may be possible to run the system using floppy disk also. It is compatible with MS-DOS and have only two files QBASIC.EXE and QBASIC.HLP.

Scholarships after +2 Abroad Studies Opportunities

Steps

  1. Get MS-DOS System and MS-DOS Prompt
    C:\>
  2. Change the Directory
    C:\>CD QBASIC
    C:\QBASIC>
  3. Type QBASIC and press Enter
    C:\QBASIC>QBASIC enter

When you are working with Windows system. Open QBASIC Folder on Windows.

Double click over the QBASIC.EXE icon. We will get the QBASIC System as below. Press ESC key and get the programming window of the QBASIC and type the program on the working of QBASIC.

Structure of Basic

To construct the QBASIC program we have to arrange some standard elements.

The elements are:

  1. Character set
  2. Variables and constant
  3. Arithmetic expressions
  4. Relational or Logical expressions
  5. Keywords
  6. Syntax
  7. Library functions

The Character Set

QBASIC has the character set consisting of the following elements:

  1. Alphabets: A, B, C,....Z
  2. Digits: 0, 1, 2........,9 and
  3. Special characters: + - * / ( ) . , $ ; ,: ,= ,> ,< , ^

The symbol ^ (caret) is used to denote exponentiation operator, the symbol * (asterisk) is used to denote multiplication and other symbols; have their usual meanings.

Constants and Variables

A quantity in a computer program which does not change its value during the execution of the program is called a constant and the quantity which may change its values during the execution of the program is called variable. QBASIC allows the following constants:

  • Numeric constant

    Numeric constant is one that is formed by a sequence of digits 0, 1, 2,.....9 and may include a decimal point. A numeric constant known as number may be integer or a real number. 383, +57, 0, -6.2 and 6.15E4 are valid numeric constants. The number 6.15E4, in fact represent 6.15 * 104. The notation E is used to represent exponential form. The number after E is the exponent which can be positive or negative. However, its length cannot exceed two digits.

    It is also important to keep in mind that

    • QBASIC does not distinguish between an integer and fraction.
    • Commands are not allowed in a numeric constant.
    • The limit on the number of digits that can be used varies from computer to computer. Normally, a numeric constant can have up to a maximum of eight digits.
  • String constant

    A string constantconsists of a sequence of characters which must be enclosed by a quotation mark.

    In QBASIC, variables are also of two types:

    1. Numeric variable :Numeric variable can assume numeric value and is represented by an alphabet or an alphabet followed by another alphabet or digit. For example A, C, A2, ABC, A6etc, represent numeric variables.
    2. String variable : A string variable is represented by an alphabet followed by dollar ($) sign. It should be kept in mind that while constructing the string variable, dollar ($) should be the last character. For example B1$, NAME$, BOOK1$, etc are valid string variables.
Things to remember
  • QBASIC is the most popular high level programming language.
  • A quantity in a computer program which does not change its value during the execution of the program is called a constant. There are numeric and string constant.
  • The quantity which may change its values during the execution of the program is called variable. There are string and numeric variable.
  • It includes every relationship which established among the people.
  • There can be more than one community in a society. Community smaller than society.
  • It is a network of social relationships which cannot see or touched.
  • common interests and common objectives are not necessary for society.
Videos for Starting,Structure, Constants and Variables of QBASIC
ASCII Program -QB64
Basic Programming - QBasic
IF Statements - QB64
Introduction to QBasic
Learning QBASIC: And Its Programing Concept
Machine Code Instructions
Variables And Data Types in Qbasic
Questions and Answers

The advantages of QBASIC are:

  1. QBASIC is easy to learn and fun to practice. It may be called a "People's language".
  2. It is available almost in every computer from micro to mainframe. Therefore, a program developed in a micro can run on bigger system with minor modifications.
  3. It is suitable for mathematical and business application.
  4. Program development cycle is quick, debugging is simple, and
  5. Modification of program is quite easy.

A quantity in a computer program which does not change its value during the execution of the program is called a constant and the quantity which may change its values during the execution of the program is called variable. QBASIC allows the following constants:

  • Numeric constant
  • String constant

Numeric constant is one that is formed by a sequence of digits 0, 1, 2,.....9 and may include a decimal point. A numeric constant known as number may be integer or a real number. 383, +57, 0, -6.2 and 6.15E4 are valid numeric constants. The number 6.15E4, in fact represent 6.15 * 104. The notation E is used to represent exponential form. The number after E is the exponent which can be positive or negative. However, its length cannot exceed two digits.

In QBASIC, variables are also of two types:

  • Numeric variable
  • String variable

Numeric variable can assume numeric value and is represented by an alphabet or an alphabet followed by another alphabet or digit. For example A, C, A2, ABC, A6 etc. represent numeric variables. A string variable is represented by an alphabet followed by dollar ($) sign. It should be kept in mind that while constructing the string variable, dollar ($) should be the last character. For example B1$, NAME$, BOOK1$, etc are valid string variables.

Quiz

© 2019-20 Kullabs. All Rights Reserved.