Class 6 Exam  >  Class 6 Notes  >  Computer Science for Class 6  >  Textbook: Chapter 7 - BASIC Programming

Textbook: Chapter 7 - BASIC Programming | Computer Science for Class 6 PDF Download

Download, print and study this document offline
Please wait while the PDF view is loading
 Page 1


Aim: In this lesson, you will learn:
         Programming using BASIC – 256.
         Input and output statements.
         Variables and operators. 
7. BASIC Programming
Tejas, Jyoti and their classmates are excited as they are to learn a new Programming language called 
BASIC. The application called Basic 256 is opened on a computer by Moz. All of them surround 
the computer and see that the window of this application has some familiar options like “New, 
Open, Save”. They also notice some new options like “Run”.
Tejas: There is a menubar, which looks like any other application menu with File, Edit, View, Tools, 
Help and a toolbar. 
Jyoti: The toolbar has Run. Does this execute the program?
Moz: Yes. Run executes the program. You write the instructions in the program area of the 
application.
Tejas: I am eager to write a program and Run it.
Print  - BASIC-256 program and text output
Moz: Ok. Let us start with the Print statement. This is used to display text and numbers on the 
screen. First start a new program by clicking on ‘New’. Enter the Print statements in the program 
area, and click on ‘Run’. The output will be displayed in the text output area.
Print Statement – To display output
+ - * / + - * /+ - * /
Print Input Rect Circle
+ - * / + - * /+ - * /
Print Input Rect Circle
+ - * / + - * /+ - *
Print Input Rect Circle
+ - * / + - * /+ - 
Print Input Rect Circ
Print Input Rect Ci
/
e
* /
cle
- * /
ircle
+ - * /
Circle
cle
/
Rect Circle
+ -  /
ct Circle
Name$ = “Tejas”
Print “Hello”+Name$
+ - * / + - * /
Print
+ - * / + - * /+
Print Input Rect C
Input Rect
* /
e
*/
cle
*/+
Print 
+
C
t
*
le
l
+
t Input 
*/
rc
Hello Tejas
Computer Lab
}
Page 2


Aim: In this lesson, you will learn:
         Programming using BASIC – 256.
         Input and output statements.
         Variables and operators. 
7. BASIC Programming
Tejas, Jyoti and their classmates are excited as they are to learn a new Programming language called 
BASIC. The application called Basic 256 is opened on a computer by Moz. All of them surround 
the computer and see that the window of this application has some familiar options like “New, 
Open, Save”. They also notice some new options like “Run”.
Tejas: There is a menubar, which looks like any other application menu with File, Edit, View, Tools, 
Help and a toolbar. 
Jyoti: The toolbar has Run. Does this execute the program?
Moz: Yes. Run executes the program. You write the instructions in the program area of the 
application.
Tejas: I am eager to write a program and Run it.
Print  - BASIC-256 program and text output
Moz: Ok. Let us start with the Print statement. This is used to display text and numbers on the 
screen. First start a new program by clicking on ‘New’. Enter the Print statements in the program 
area, and click on ‘Run’. The output will be displayed in the text output area.
Print Statement – To display output
+ - * / + - * /+ - * /
Print Input Rect Circle
+ - * / + - * /+ - * /
Print Input Rect Circle
+ - * / + - * /+ - *
Print Input Rect Circle
+ - * / + - * /+ - 
Print Input Rect Circ
Print Input Rect Ci
/
e
* /
cle
- * /
ircle
+ - * /
Circle
cle
/
Rect Circle
+ -  /
ct Circle
Name$ = “Tejas”
Print “Hello”+Name$
+ - * / + - * /
Print
+ - * / + - * /+
Print Input Rect C
Input Rect
* /
e
*/
cle
*/+
Print 
+
C
t
*
le
l
+
t Input 
*/
rc
Hello Tejas
Computer Lab
}
Jyoti: In the first statement, Print is displaying text which is inside quotes. 
Moz: This is called a String.
Tejas: In the second statement, Print is printing the sum of the two numbers. This means the two 
numbers are added and then the result is printed.
Jyoti: The output of third Print statement and fourth print statement are on the same line. Is it 
because of the ; at the end of the Print statement? 
Moz: You are right. You have explained the syntax of Print statements.
Syntax of a programming language
Concept
• Syntax of a programming language is the set of rules that specifies 
the grammar of the programming language. 
Print statement
Info
 Syntax: Print expression
              Print expression ; 
BASIC-256 Example and Text output
• The print statement is used to display 
text and numbers on the text output 
area.
• Print followed by Text, numbers and 
other symbols (ex: *, &, ^, % etc.) 
enclosed “ ” (in quotes) are displayed as 
they are entered. 
• Print followed by arithmetic expressions 
(ex: addition, multiplication, division 
etc.) are evaluated and the result is 
displayed. 
• For getting output of several print 
statements on the same line, use a ‘;’ 
(semicolon) at the end of each Print 
statement. 
125
PROGRAM
OUTPUT
Print “My name is Jyoti. I am 
12 years old. ”
My name is Jyoti. I am 12 
years old.
125
PROGRAM
OUTPUT
Print “Sum of 100 + 75=” Sum of 100 + 75=
125
PROGRAM
OUTPUT
Print 100 + 75 175
125
PROGRAM
OUTPUT
Print “Sum of 100 + 75=”;
Print 100 + 75
Sum of 100 + 75=175
Moz: Now that you have understood the Print statement, go ahead and try out some more Print 
statements. 
Tejas: Should we start a new program?
Moz: You can add more statements and run the same program or you can start a new program. 
You can also save programs (using Save) and load a saved program later (using Open).
To execute a program 
or an instruction
To stop the execution 
of a program
To locate and 
remove errors
To execute 
instructions 
one by one
Page 3


Aim: In this lesson, you will learn:
         Programming using BASIC – 256.
         Input and output statements.
         Variables and operators. 
7. BASIC Programming
Tejas, Jyoti and their classmates are excited as they are to learn a new Programming language called 
BASIC. The application called Basic 256 is opened on a computer by Moz. All of them surround 
the computer and see that the window of this application has some familiar options like “New, 
Open, Save”. They also notice some new options like “Run”.
Tejas: There is a menubar, which looks like any other application menu with File, Edit, View, Tools, 
Help and a toolbar. 
Jyoti: The toolbar has Run. Does this execute the program?
Moz: Yes. Run executes the program. You write the instructions in the program area of the 
application.
Tejas: I am eager to write a program and Run it.
Print  - BASIC-256 program and text output
Moz: Ok. Let us start with the Print statement. This is used to display text and numbers on the 
screen. First start a new program by clicking on ‘New’. Enter the Print statements in the program 
area, and click on ‘Run’. The output will be displayed in the text output area.
Print Statement – To display output
+ - * / + - * /+ - * /
Print Input Rect Circle
+ - * / + - * /+ - * /
Print Input Rect Circle
+ - * / + - * /+ - *
Print Input Rect Circle
+ - * / + - * /+ - 
Print Input Rect Circ
Print Input Rect Ci
/
e
* /
cle
- * /
ircle
+ - * /
Circle
cle
/
Rect Circle
+ -  /
ct Circle
Name$ = “Tejas”
Print “Hello”+Name$
+ - * / + - * /
Print
+ - * / + - * /+
Print Input Rect C
Input Rect
* /
e
*/
cle
*/+
Print 
+
C
t
*
le
l
+
t Input 
*/
rc
Hello Tejas
Computer Lab
}
Jyoti: In the first statement, Print is displaying text which is inside quotes. 
Moz: This is called a String.
Tejas: In the second statement, Print is printing the sum of the two numbers. This means the two 
numbers are added and then the result is printed.
Jyoti: The output of third Print statement and fourth print statement are on the same line. Is it 
because of the ; at the end of the Print statement? 
Moz: You are right. You have explained the syntax of Print statements.
Syntax of a programming language
Concept
• Syntax of a programming language is the set of rules that specifies 
the grammar of the programming language. 
Print statement
Info
 Syntax: Print expression
              Print expression ; 
BASIC-256 Example and Text output
• The print statement is used to display 
text and numbers on the text output 
area.
• Print followed by Text, numbers and 
other symbols (ex: *, &, ^, % etc.) 
enclosed “ ” (in quotes) are displayed as 
they are entered. 
• Print followed by arithmetic expressions 
(ex: addition, multiplication, division 
etc.) are evaluated and the result is 
displayed. 
• For getting output of several print 
statements on the same line, use a ‘;’ 
(semicolon) at the end of each Print 
statement. 
125
PROGRAM
OUTPUT
Print “My name is Jyoti. I am 
12 years old. ”
My name is Jyoti. I am 12 
years old.
125
PROGRAM
OUTPUT
Print “Sum of 100 + 75=” Sum of 100 + 75=
125
PROGRAM
OUTPUT
Print 100 + 75 175
125
PROGRAM
OUTPUT
Print “Sum of 100 + 75=”;
Print 100 + 75
Sum of 100 + 75=175
Moz: Now that you have understood the Print statement, go ahead and try out some more Print 
statements. 
Tejas: Should we start a new program?
Moz: You can add more statements and run the same program or you can start a new program. 
You can also save programs (using Save) and load a saved program later (using Open).
To execute a program 
or an instruction
To stop the execution 
of a program
To locate and 
remove errors
To execute 
instructions 
one by one
Arithmetic operators 
Info
Tejas: I want to include division and multiplication in my statements. Which is the division symbol 
on keyboard?
Moz: Use / for division and use * for multiplication. These are the symbols used for division and 
multiplication in many programming languages.
Tejas: Can we also use brackets like we do in Maths. 
Moz: Yes. You can. The order of operations is also exactly the way you do in Maths, i.e., 
BODMAS. 
B        Brackets first
O       Orders (Powers and Square Roots)
DM    Division and Multiplication (left-to-right)
AS      Addition and Subtraction (left-to-right)
Moz: Now try out these statements.
Jyoti: In the statement Print (50+68+35)/3, BODMAS rule is used to evaluate the arithmetic 
expression and then the result is displayed.
Arithmetic operation Operator BASIC-256 Example and Text output
Addition  +
Subtraction  -
Multiplication  *
Division  /
Multiple operators
Arithmetic expressions 
PROGRAM
OUTPUT
Print “Jyoti and T ejas”+ “ are 
learning BASIC”
Jyoti and T ejas are learning 
BASIC
PROGRAM
OUTPUT
Print 256 + 567 + 678 1501
PROGRAM
OUTPUT
Print 1000 - 750 250
PROGRAM
OUTPUT
Print 250 * 20 5000
PROGRAM
OUTPUT
Print 135 / 915
PROGRAM
OUTPUT
Print 250 + (250 - 100) * 
20 / 5
850
Print “ Average of 50, 68, 35 = ”;
Print (50+68+35) / 3
Print “The cost of an apple = ` 13”
Print “The cost of 12 apples = `  “;
Print 13*12
Average of 50, 68, 35 = 51
The cost of an apple = ` 13
The cost of 12 apples = ` 156
PROGRAM
OUTPUT
PROGRAM
OUTPUT
Print “Today the price of 
12 apples is = ` ” + (5 * 12)
Today the price of 12 apples 
is = ` 60
PROGRAM
OUTPUT
Print “The area of a rectangle of 
length 12 units and breadth 8 
units = “+ (12 * 8) + “ square units” 
The area of a rectangle of length
12 units and breadth 8 units = 
96 square units
Page 4


Aim: In this lesson, you will learn:
         Programming using BASIC – 256.
         Input and output statements.
         Variables and operators. 
7. BASIC Programming
Tejas, Jyoti and their classmates are excited as they are to learn a new Programming language called 
BASIC. The application called Basic 256 is opened on a computer by Moz. All of them surround 
the computer and see that the window of this application has some familiar options like “New, 
Open, Save”. They also notice some new options like “Run”.
Tejas: There is a menubar, which looks like any other application menu with File, Edit, View, Tools, 
Help and a toolbar. 
Jyoti: The toolbar has Run. Does this execute the program?
Moz: Yes. Run executes the program. You write the instructions in the program area of the 
application.
Tejas: I am eager to write a program and Run it.
Print  - BASIC-256 program and text output
Moz: Ok. Let us start with the Print statement. This is used to display text and numbers on the 
screen. First start a new program by clicking on ‘New’. Enter the Print statements in the program 
area, and click on ‘Run’. The output will be displayed in the text output area.
Print Statement – To display output
+ - * / + - * /+ - * /
Print Input Rect Circle
+ - * / + - * /+ - * /
Print Input Rect Circle
+ - * / + - * /+ - *
Print Input Rect Circle
+ - * / + - * /+ - 
Print Input Rect Circ
Print Input Rect Ci
/
e
* /
cle
- * /
ircle
+ - * /
Circle
cle
/
Rect Circle
+ -  /
ct Circle
Name$ = “Tejas”
Print “Hello”+Name$
+ - * / + - * /
Print
+ - * / + - * /+
Print Input Rect C
Input Rect
* /
e
*/
cle
*/+
Print 
+
C
t
*
le
l
+
t Input 
*/
rc
Hello Tejas
Computer Lab
}
Jyoti: In the first statement, Print is displaying text which is inside quotes. 
Moz: This is called a String.
Tejas: In the second statement, Print is printing the sum of the two numbers. This means the two 
numbers are added and then the result is printed.
Jyoti: The output of third Print statement and fourth print statement are on the same line. Is it 
because of the ; at the end of the Print statement? 
Moz: You are right. You have explained the syntax of Print statements.
Syntax of a programming language
Concept
• Syntax of a programming language is the set of rules that specifies 
the grammar of the programming language. 
Print statement
Info
 Syntax: Print expression
              Print expression ; 
BASIC-256 Example and Text output
• The print statement is used to display 
text and numbers on the text output 
area.
• Print followed by Text, numbers and 
other symbols (ex: *, &, ^, % etc.) 
enclosed “ ” (in quotes) are displayed as 
they are entered. 
• Print followed by arithmetic expressions 
(ex: addition, multiplication, division 
etc.) are evaluated and the result is 
displayed. 
• For getting output of several print 
statements on the same line, use a ‘;’ 
(semicolon) at the end of each Print 
statement. 
125
PROGRAM
OUTPUT
Print “My name is Jyoti. I am 
12 years old. ”
My name is Jyoti. I am 12 
years old.
125
PROGRAM
OUTPUT
Print “Sum of 100 + 75=” Sum of 100 + 75=
125
PROGRAM
OUTPUT
Print 100 + 75 175
125
PROGRAM
OUTPUT
Print “Sum of 100 + 75=”;
Print 100 + 75
Sum of 100 + 75=175
Moz: Now that you have understood the Print statement, go ahead and try out some more Print 
statements. 
Tejas: Should we start a new program?
Moz: You can add more statements and run the same program or you can start a new program. 
You can also save programs (using Save) and load a saved program later (using Open).
To execute a program 
or an instruction
To stop the execution 
of a program
To locate and 
remove errors
To execute 
instructions 
one by one
Arithmetic operators 
Info
Tejas: I want to include division and multiplication in my statements. Which is the division symbol 
on keyboard?
Moz: Use / for division and use * for multiplication. These are the symbols used for division and 
multiplication in many programming languages.
Tejas: Can we also use brackets like we do in Maths. 
Moz: Yes. You can. The order of operations is also exactly the way you do in Maths, i.e., 
BODMAS. 
B        Brackets first
O       Orders (Powers and Square Roots)
DM    Division and Multiplication (left-to-right)
AS      Addition and Subtraction (left-to-right)
Moz: Now try out these statements.
Jyoti: In the statement Print (50+68+35)/3, BODMAS rule is used to evaluate the arithmetic 
expression and then the result is displayed.
Arithmetic operation Operator BASIC-256 Example and Text output
Addition  +
Subtraction  -
Multiplication  *
Division  /
Multiple operators
Arithmetic expressions 
PROGRAM
OUTPUT
Print “Jyoti and T ejas”+ “ are 
learning BASIC”
Jyoti and T ejas are learning 
BASIC
PROGRAM
OUTPUT
Print 256 + 567 + 678 1501
PROGRAM
OUTPUT
Print 1000 - 750 250
PROGRAM
OUTPUT
Print 250 * 20 5000
PROGRAM
OUTPUT
Print 135 / 915
PROGRAM
OUTPUT
Print 250 + (250 - 100) * 
20 / 5
850
Print “ Average of 50, 68, 35 = ”;
Print (50+68+35) / 3
Print “The cost of an apple = ` 13”
Print “The cost of 12 apples = `  “;
Print 13*12
Average of 50, 68, 35 = 51
The cost of an apple = ` 13
The cost of 12 apples = ` 156
PROGRAM
OUTPUT
PROGRAM
OUTPUT
Print “Today the price of 
12 apples is = ` ” + (5 * 12)
Today the price of 12 apples 
is = ` 60
PROGRAM
OUTPUT
Print “The area of a rectangle of 
length 12 units and breadth 8 
units = “+ (12 * 8) + “ square units” 
The area of a rectangle of length
12 units and breadth 8 units = 
96 square units
String operation
Info
Tejas: In these statements, phrases (strings) are combined to get a full sentence. 
Jyoti: In the second statement, the price of 12 apples is calculated and then printed. 
Moz: The ‘+’ operator also adds strings together. This operation is called concatenation. In 
concatenation, two or more strings are joined together, to make a longer string.
Jyoti: Let us convert the addition flowchart into a program. 
String operation Operator BASIC-256 Example and Text output
Concatenation   + 
Variables - Numeric Variables – To store numeric values 
Moz: Use the example values where A = 346 and B = 478
125
PROGRAM
OUTPUT
A = 346
B = 478
Sum = A + B
Print “ Sum of A + B = ”;
Print Sum
Sum of A + B = 824
Start
End
Read A
Read B
Print Sum
Sum = A + B
Jyoti: The first statement is instructing the computer to store 346 in a variable named A. The 
second instruction similarly instructs the computer to store 478 in a variable named B. 
Tejas: Next we are instructing the computer to add the two numbers A and B and store the result 
of the addition in the variable named Sum. 
Moz: What are you instructing the computer in the first and second statements.
Sum = A + B
PROGRAM
OUTPUT
A = 346
B = 478
PROGRAM
OUTPUT
Memory
346
478
A
B
824
(346+478)
Sum
Memory
PROGRAM
OUTPUT
Print “I have apples ” + “and oranges. ” 
Print “Price of 20 books = `” + (25*20)
I have apples and oranges.
Price of 20 books = `500
Page 5


Aim: In this lesson, you will learn:
         Programming using BASIC – 256.
         Input and output statements.
         Variables and operators. 
7. BASIC Programming
Tejas, Jyoti and their classmates are excited as they are to learn a new Programming language called 
BASIC. The application called Basic 256 is opened on a computer by Moz. All of them surround 
the computer and see that the window of this application has some familiar options like “New, 
Open, Save”. They also notice some new options like “Run”.
Tejas: There is a menubar, which looks like any other application menu with File, Edit, View, Tools, 
Help and a toolbar. 
Jyoti: The toolbar has Run. Does this execute the program?
Moz: Yes. Run executes the program. You write the instructions in the program area of the 
application.
Tejas: I am eager to write a program and Run it.
Print  - BASIC-256 program and text output
Moz: Ok. Let us start with the Print statement. This is used to display text and numbers on the 
screen. First start a new program by clicking on ‘New’. Enter the Print statements in the program 
area, and click on ‘Run’. The output will be displayed in the text output area.
Print Statement – To display output
+ - * / + - * /+ - * /
Print Input Rect Circle
+ - * / + - * /+ - * /
Print Input Rect Circle
+ - * / + - * /+ - *
Print Input Rect Circle
+ - * / + - * /+ - 
Print Input Rect Circ
Print Input Rect Ci
/
e
* /
cle
- * /
ircle
+ - * /
Circle
cle
/
Rect Circle
+ -  /
ct Circle
Name$ = “Tejas”
Print “Hello”+Name$
+ - * / + - * /
Print
+ - * / + - * /+
Print Input Rect C
Input Rect
* /
e
*/
cle
*/+
Print 
+
C
t
*
le
l
+
t Input 
*/
rc
Hello Tejas
Computer Lab
}
Jyoti: In the first statement, Print is displaying text which is inside quotes. 
Moz: This is called a String.
Tejas: In the second statement, Print is printing the sum of the two numbers. This means the two 
numbers are added and then the result is printed.
Jyoti: The output of third Print statement and fourth print statement are on the same line. Is it 
because of the ; at the end of the Print statement? 
Moz: You are right. You have explained the syntax of Print statements.
Syntax of a programming language
Concept
• Syntax of a programming language is the set of rules that specifies 
the grammar of the programming language. 
Print statement
Info
 Syntax: Print expression
              Print expression ; 
BASIC-256 Example and Text output
• The print statement is used to display 
text and numbers on the text output 
area.
• Print followed by Text, numbers and 
other symbols (ex: *, &, ^, % etc.) 
enclosed “ ” (in quotes) are displayed as 
they are entered. 
• Print followed by arithmetic expressions 
(ex: addition, multiplication, division 
etc.) are evaluated and the result is 
displayed. 
• For getting output of several print 
statements on the same line, use a ‘;’ 
(semicolon) at the end of each Print 
statement. 
125
PROGRAM
OUTPUT
Print “My name is Jyoti. I am 
12 years old. ”
My name is Jyoti. I am 12 
years old.
125
PROGRAM
OUTPUT
Print “Sum of 100 + 75=” Sum of 100 + 75=
125
PROGRAM
OUTPUT
Print 100 + 75 175
125
PROGRAM
OUTPUT
Print “Sum of 100 + 75=”;
Print 100 + 75
Sum of 100 + 75=175
Moz: Now that you have understood the Print statement, go ahead and try out some more Print 
statements. 
Tejas: Should we start a new program?
Moz: You can add more statements and run the same program or you can start a new program. 
You can also save programs (using Save) and load a saved program later (using Open).
To execute a program 
or an instruction
To stop the execution 
of a program
To locate and 
remove errors
To execute 
instructions 
one by one
Arithmetic operators 
Info
Tejas: I want to include division and multiplication in my statements. Which is the division symbol 
on keyboard?
Moz: Use / for division and use * for multiplication. These are the symbols used for division and 
multiplication in many programming languages.
Tejas: Can we also use brackets like we do in Maths. 
Moz: Yes. You can. The order of operations is also exactly the way you do in Maths, i.e., 
BODMAS. 
B        Brackets first
O       Orders (Powers and Square Roots)
DM    Division and Multiplication (left-to-right)
AS      Addition and Subtraction (left-to-right)
Moz: Now try out these statements.
Jyoti: In the statement Print (50+68+35)/3, BODMAS rule is used to evaluate the arithmetic 
expression and then the result is displayed.
Arithmetic operation Operator BASIC-256 Example and Text output
Addition  +
Subtraction  -
Multiplication  *
Division  /
Multiple operators
Arithmetic expressions 
PROGRAM
OUTPUT
Print “Jyoti and T ejas”+ “ are 
learning BASIC”
Jyoti and T ejas are learning 
BASIC
PROGRAM
OUTPUT
Print 256 + 567 + 678 1501
PROGRAM
OUTPUT
Print 1000 - 750 250
PROGRAM
OUTPUT
Print 250 * 20 5000
PROGRAM
OUTPUT
Print 135 / 915
PROGRAM
OUTPUT
Print 250 + (250 - 100) * 
20 / 5
850
Print “ Average of 50, 68, 35 = ”;
Print (50+68+35) / 3
Print “The cost of an apple = ` 13”
Print “The cost of 12 apples = `  “;
Print 13*12
Average of 50, 68, 35 = 51
The cost of an apple = ` 13
The cost of 12 apples = ` 156
PROGRAM
OUTPUT
PROGRAM
OUTPUT
Print “Today the price of 
12 apples is = ` ” + (5 * 12)
Today the price of 12 apples 
is = ` 60
PROGRAM
OUTPUT
Print “The area of a rectangle of 
length 12 units and breadth 8 
units = “+ (12 * 8) + “ square units” 
The area of a rectangle of length
12 units and breadth 8 units = 
96 square units
String operation
Info
Tejas: In these statements, phrases (strings) are combined to get a full sentence. 
Jyoti: In the second statement, the price of 12 apples is calculated and then printed. 
Moz: The ‘+’ operator also adds strings together. This operation is called concatenation. In 
concatenation, two or more strings are joined together, to make a longer string.
Jyoti: Let us convert the addition flowchart into a program. 
String operation Operator BASIC-256 Example and Text output
Concatenation   + 
Variables - Numeric Variables – To store numeric values 
Moz: Use the example values where A = 346 and B = 478
125
PROGRAM
OUTPUT
A = 346
B = 478
Sum = A + B
Print “ Sum of A + B = ”;
Print Sum
Sum of A + B = 824
Start
End
Read A
Read B
Print Sum
Sum = A + B
Jyoti: The first statement is instructing the computer to store 346 in a variable named A. The 
second instruction similarly instructs the computer to store 478 in a variable named B. 
Tejas: Next we are instructing the computer to add the two numbers A and B and store the result 
of the addition in the variable named Sum. 
Moz: What are you instructing the computer in the first and second statements.
Sum = A + B
PROGRAM
OUTPUT
A = 346
B = 478
PROGRAM
OUTPUT
Memory
346
478
A
B
824
(346+478)
Sum
Memory
PROGRAM
OUTPUT
Print “I have apples ” + “and oranges. ” 
Print “Price of 20 books = `” + (25*20)
I have apples and oranges.
Price of 20 books = `500
Moz:  Note that there will not be any display for these statements. The purpose of these statements 
is to store the values. Do you know where these values are stored?
Tejas: In the memory.
Moz: Right. In your program, numeric values are stored in variables A, B and Sum. In a numeric 
variable you can store only numbers (integers and decimals). A, B and Sum are examples of 
numeric variables.
Jyoti: We can also use the numeric variables in Print. 
Moz: This is called retrieving the value stored. The values that are stored in memory can be 
retrieved using the respective variable names and used in the program.  
Jyoti: Where do we store text? Is there a text variable?
Moz: The variable in which you store text is called string variable. You have to put a $ at the end 
of the name of a variable (Ex: A$) to instruct that the value that will be stored is a string. In a 
string variable, alphabets, numbers, words, sentences, and any special symbols can be stored.  Enter 
the following statements and see what happens.
Variables
Concept
BASIC allows you to name the spaces in computer’s memory and 
store information in them. This is called a variable. Once you name 
a variable you can store information in it. You can also retrieve and 
use it in your program, using its name.  
Numeric variables
Info
Numeric variables BASIC-256 Example and Text output
Syntax 
• A numeric variable name 
begins with a letter and can 
contain letters and numbers. 
Example: A, sum, value1.
• Numeric values (integers 
and decimals) are stored 
and retrieved using numeric 
variables.
• The variable name is case 
sensitive which means that if 
you use ‘A’ as a variable name 
while storing, you must use 
‘A’ to retrieve the value and 
not ‘a’. 
Variables – String Variables – To store strings and retrieve later in the program.
PROGRAM
OUTPUT
priceitem1 = 56
priceitem2 = 75
sum = priceitem1+ priceitem2
Print “Total price of items =” + sum 
Total price of items = 131
PROGRAM
OUTPUT
priceitem1 = 56
priceitem2 = 75
sum = priceitem1+ priceitem2
Print “Total price of items =” + Sum 
ERROR on line 4: Unknown 
variable
PROGRAM
OUTPUT
68
56
sum = 23 + 45
Item5 = 56
Print sum
Print Item5
112
Read More
49 videos|20 docs|6 tests

Top Courses for Class 6

FAQs on Textbook: Chapter 7 - BASIC Programming - Computer Science for Class 6

1. What is BASIC programming?
Ans. BASIC programming, which stands for Beginner's All-purpose Symbolic Instruction Code, is a high-level programming language that was developed in the mid-1960s. It was designed to be simple and easy to learn, making it a popular choice for beginners. BASIC allows users to write programs that can perform various tasks and calculations.
2. How can I start learning BASIC programming?
Ans. To start learning BASIC programming, you can begin by installing a BASIC compiler or interpreter on your computer. There are several free options available online. Once you have a programming environment set up, you can start by learning the basic syntax and structure of the language. There are many online tutorials, books, and resources available that can help you get started with learning BASIC programming.
3. What are the common applications of BASIC programming?
Ans. BASIC programming has been used in a wide range of applications. Some common applications include creating simple games, writing utilities and tools, developing educational software, and automating repetitive tasks. BASIC is also used in some embedded systems and microcontrollers. It provides a good foundation for learning other programming languages as well.
4. Are there any limitations to BASIC programming?
Ans. While BASIC programming is easy to learn and use, it does have some limitations. It may not be suitable for complex or large-scale projects due to its simplicity. BASIC also lacks some advanced features and libraries that are available in other programming languages. However, for beginners or for small-scale projects, BASIC can be a great choice.
5. Is BASIC programming still relevant today?
Ans. Although BASIC programming may not be as widely used as it once was, it still has its relevance today. Many educational institutions and beginners still use BASIC as an introductory language. Additionally, some legacy systems and applications still rely on BASIC code, requiring programmers with knowledge of the language. Learning BASIC can also provide a solid foundation for understanding programming concepts that can be applied to other languages.
49 videos|20 docs|6 tests
Download as PDF
Explore Courses for Class 6 exam

Top Courses for Class 6

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

Semester Notes

,

video lectures

,

Textbook: Chapter 7 - BASIC Programming | Computer Science for Class 6

,

Free

,

past year papers

,

MCQs

,

pdf

,

Exam

,

Textbook: Chapter 7 - BASIC Programming | Computer Science for Class 6

,

shortcuts and tricks

,

ppt

,

practice quizzes

,

Objective type Questions

,

Sample Paper

,

Summary

,

Textbook: Chapter 7 - BASIC Programming | Computer Science for Class 6

,

Previous Year Questions with Solutions

,

Important questions

,

Extra Questions

,

Viva Questions

,

study material

,

mock tests for examination

;