NCERT Solutions for Class 6 Computer Science Chapter 7 Introduction to qBASIC prepared for new academic session 2024-25. Grade 6 computer book is useful not only for CBSE but the state board student also. Here you will learn about the programming language BASIC.

QBasic – A Programming Language

Computer is a manmade electronic device which works on instructions. It is necessary that these instructions are written in a language that the computer can understand. The only language that a computer understands is the machine language made up of 0’s and 1’s. But writing instructions in terms of 0’s and 1’s is a very tough task. Therefore to simplify the process of generating instructions for a computer, English like languages were developed. One such language is BASIC.

WHAT IS BASIC?
BASIC stands for Beginners All Purpose Symbolic Instruction Code. It is a programming language of computer which was developed by John Kemeny and Thomas Kurtz of USA in the year 1964. The instructions written in BASIC language are not machine language instructions, therefore, these cannot be used by the computer. To do this, these instructions are translated into machine language using special software called compilers and interpreters. Two popular BASIC interpreters are QBasic and GWBasic.

Let’s learn about QBasic.
How to work on QBasic
To use BASIC the BASIC interpreter QBasic must first be carried from the hard disk to the primary memory (RAM) of a computer.
Steps to read QBasic
• First of all click on Start to display a menu.
• Now select Programs option from Start menu to display a sub menu.
• Then select QBasic from the submenu.

Program
A program is a set of instructions given to a computer in specific programming language. Examples are BASIC, C, C++, Fortran, COBOL, etc. While writing a program in any programming language we must take care that the rules of that particular language are properly followed.

COMMONLY USED TERMS IN QBASIC

Reserve Words
There are words that have special meaning with reference to QBasic and are used to perform certain specific tasks.
As these words perform certain specific tasks therefore they cannot be used for any purpose other than the one specified in QBasic. For example, LET, INPUT, PRINT etc. are reserve words.
Statements
A combination of a reserve word and an expression in QBasic is called statement. A QBasic program constitutes of a collection of QBasic statements. Examples of QBasic statements are LET C=A+B, INPUT A, B etc.
Constants
Constants are values/data that never change during the execution of a program. Constants are of two types—numeric and alphanumeric.

Numeric Constants
Numeric constants refer to numbers generated by a combination of digits from 0 to 9. Examples of numeric constants are: 661–8124 etc.
They are specified without quotes.
All arithmetic operations i.e addition, subtraction, division, multiplication and exponentiation can be performed on these constants.
Any number in the range –32768 to +32767 is a valid numeric constant.
Alphanumeric Constants
These are also known as string constants. They are a collection of letters of the English alphabet, digits from 0 to 9, and / or special characters like #, :,?
Examples of alphanumeric constants are : “Rahul”, “G85, Uttam Nagar” etc.

Variables in QBasic

A variable is a name given to memory location that has a value. This value is not fixed.
Variables are of two kinds
Numeric Variables and Alphanumeric Variables.
Numeric Variables
Numeric variables store numeric constants or numeric expressions that return numeric values.
Rules for naming numeric variables
• The name of a numeric variable must begin with a letter of the English alphabet, followed by more letters and / or digits from 0-9.
• No special characters except underscore ( _ ) are allowed in the name of a numeric variable.
Examples of numeric variables are : sale_price, cost_price, salary, expenses, etc.

Alphanumeric Variables
A. Numeric variables: These store numeric data. They can be formed by letters as well as digits also. They have to begin with alphabets. They should not contain any special character or space.
B. Alphanumeric/ String Variables: These are used to store a string of characters.
They should always end with a $ sign. For example, name $, Deepak $ etc.
Operators in QBasic
Operators are used to perform various operations on constants or variables. For example, 2 and 6.
Here, 2 and 6 are constants known as operands while ‘+’ is the operator which causes 2 and 6 to add.

Operators in QBasic

There are three types of operators in QBasic:

    • A. Arithmetic Operators
    • B. Logical Operators
    • C. Relational Operators

Arithmetic Operators
Arithmetic Operators are used with numeric constants and variables. These are: + Add, – Subtract, × multiply, / divide, ^ exponential.
Logical Operators
Logical Operators are used to combine two or more relational expressions. There can be calculation to return a single value. It can be true or false. The logical operators are : and, or, not.

Relational Operators
Relational Operators are used to compare two values. These are:
> greater than > = greater than or equal to
< less than < = less than or equal to
= equal to < > not equal to.

NCERT Solutions for Class 6 Computer Science Chapter 7
Introduction to BASIC
Class 6 Computer Science Chapter 7 Introduction to BASIC
Class 6 Computer Science Chapter 7
Class 6 Computer Science Chapter 7 Question Answers
Class 6 Computer Science Chapter 7 Assignments