SlideShare a Scribd company logo
1 of 29
QBQSIC Programming
Chapter-11
Class-9
Presenter By:Bhuwan Bista
Computer Science Teacher,
Adarash Vidya Niketan Secondary School
Bhuwan Bista
TAXONOMY OF PROGRAMMING
Programming is defined as an art of writing codes.
PROGRAMMER:This is a person that indulges or that is an expert in
writing codes. His major responsible is to write programs that
performs a given or specified function.
PROGRAM: This implies the written instruction which the computer
takes in and act upon.
PROGRAMMING LANGUAGE: This indicates the language of choice for
which the programmer communicates with the computer machine.
Bhuwan Bista
QBasic
QBasic is a high level programming language. It stands for
Quick Bignners All Perpose Symbolic Instruction Code.
It can be used to create small CUI based application. It
is easier to learn program.
QuickBASIC was originally released in1985
Version 2.0 was released in 1986
In 1966 QBasic 4.5, the last version of QBasic,became
available.
Bhuwan Bista
Features of QBasic
It is a user friendly language.
It is widely known and accepted programming language.
It is one of the most flexible language, a modification
can easily be done in already existing program.
Language is easy since the variables can be named
easily and uses simple English phrases with
mathematical expressions.
Bhuwan Bista
Basic Terms Related to Programming
• Bug: Error made in program is known as bug.
• Debug: The process of correcting the bug is known as debug.
• Execution: Process of running the program is known as
execution.
• Termination: Process of stoping program is known
as termination
• GIGO: Wrong output generated due to the wrong input.
Bhuwan Bista
QBASIC Commands
 CLS-Used to clear the screen.
 PRINT- Used to display the output on the screen.
 REM- Stands for REMARK.It gives an explanation of the program there making the
program more understandable.
 LET- Assigns a value to a variable in program.
 END-It is usually given at the end of the program.
 INPUT-Allows users to enter values for a variable while running a program.
 DELETE<LINE NO.>- Delete a line number in a program.
 RUN-Used to execute the program and get the output on the screem.
 NEW-Used to totally write a new program.
 SYSTEM-Used to exit the QBASIC program.
Bhuwan Bista
Some Basic Statements
OUTPUT Statement
•These are statements that are used for fetch/retriv
e/show to screen, inputted or stored data from the
computer system.
•The major/basic output statement used in QBasic is
called PRINT.
Bhuwan Bista
OUTOUT STATEMENT-Usage & Format
PRINT can be used in two ways e.g.
1. For outputting literals e.g.
PRINT "Hellow_Jitu"
2. For outputting variables (values of an identifier) e.g.
PRINT radius
• (where radius is a variable having a particular value that has
• preciously been inputted/capture, /stirred)
Bhuwan Bista
Character Set
•A set of characters that are allowed to use in QBASIC is known
as the QBASIC Character Set.
• The QBASIC Character Set consists of alphabets (both small
and capital), numbers (0 to 9) and special characters.
•QBASIC keywords and variables are formed by using the
characters defined in the QBASIC Character Set.
•These special characters have their own meaning and
function. The table below shows the special characters used
in QBASIC.
Bhuwan Bista
Special Characters
+ “ > $
- ‘ < %
* , ( @
/ ; ) !
 : . #
^ = ? Blank Space
Bhuwan Bista
CONSTANT
Constants are the data or the values in a program that cannot be
changed during the program execution.
The data may be a letter, words, numbers, or special characters.
 A constant can be stored in a variable when it is required to use in
more than one statement or expression.
In QBASIC, these data/constants are grouped into two main
categories. They are:
a. String Constant
b. Numeric Constant
Bhuwan Bista
STRING CONSTANT
String Constant is a letter, words, numbers, combination
of letters with numbers or special characters enclosed in
double quotes.
Mathematical operations cannot be performed on
String Constants.
“D”, “BINOD”, “Roll NO. 23”, “!!! Welcome to QBASIC
World !!!”, etc. are some examples of Sting Constants.
Bhuwan Bista
Numeric Constant
• Numeric Constant refers to a number.
•A number with or without decimal point is a numeric
constant.
• Thousand separators are not allowed to use in numeric
constant.
• Numeric data should not be enclosed in double quotes.
• Mathematical operations and logical operations can be
performed on the numeric constants.
• 212, 103.03, 540, 31414, etc. are some examples of numeric
constants.
Bhuwan Bista
VARIABLES
Variables are the names of memory locations where we store
data.
A value of a variable can be change during the execution of
the program.
There are mainly two types of variables. They are:
1) Numeric Variable
2) String Variable
Bhuwan Bista
Numeric Variables
A numeric variable stores numeric data. A numeric variable can be
Integer, Long Integer, Single Precision or Double Precision variables.
• An Integer variable can store only an integer number. Its type
declaration sign is percentage (%).
• A Long integer variable can store a large range of whole number. Its
type declaration sign is ampersand (&0).
• A Single Precision variable can store a whole number as well as
number with decimal. Its type declaration sign is exclamation sign (!).
You can also use it without declaration sign. It is the default numeric
variable.
• A Double Precision variable also stores a whole number as well as
number with decimal point. Its type declaration sign is hash (#). Bhuwan Bista
String Variables
• A variable which can store string variable is called String variable. Its
types declaration sign is dollar ($).
• String is a array of character enclosed within the double inverted
comma.
e.g.
N$="ram"
Place$=“Saphal Awasthl“
String Variables are of two types:
1. Variable-Length string
2. Fixed-length string
Bhuwan Bista
Rules for naming a variable
1. Variable names can have maximum of 40 characters.
2. Variable names can have alphabets, numbers and decimal point.
3. A Variable name must begin with a letter.
4. A Variable name cannot begin with fn or FN alphabets. For example, fnames$,
fnumetc.
5. Variable names cannot be reserved words.
6. Variable names may be ended with type declaration characters like $, %, &, !,
and #.
Naam$, Address$, Bookname$, GameName$, etc., are examples of Sting Varibales.
Salary!, Age%, Mark, Number1, Number2, FirstNum, RollNumber, etc., are
examples of Numeric Variables.
Bhuwan Bista
OPERATOR
•Operators are symbols that indicate the type of operation
QBASIC has to perform on the data or on the values of
variables.
•There are four types of operators in QBASIC. They are:
1. Arithmetic Operators
2. Relational Operators
3. Logical Operators
4. Sting Operator
Bhuwan Bista
Arithmetic Operators
• Arithmetic Operators are used to perform mathematical calculations
like addition, subtraction, division, multiplication and exponential.
• The following table shows arithmetic operators used in QBASIC.
Operation Operator Example Result
Addition + 8+7 15
Subtraction - 5-2 3
Multiplication * 6*2 12
Division / 21/7 3
Integer Division  72 3
Exponential ^ 8^2 64
Modular Division Mod 5Mod2 1
Bhuwan Bista
Relational Operators
• Relational Operators are use to perform comparisons on two values of same
type.
• A comparison of sting data with numeric data cannot be done. The comparison of
sting data is done on the basis of ASCII value.
• The result of comparison is either True (non zero) or False (zero).
Operators Name Example
= Equal to A=B
< Less than A<B
> Greater than A>B
<= Less than or Equal to A<=B
>= Greater than or Equal to A>=B
<> Not Equal to A<>B
Bhuwan Bista
Logical Operators
Logical Operators combine two or more relational expressions
to evaluate a single value as True (Non Zero) or False (Zero).
The result of evaluation is used to make decisions about the
program flow.
The commonly used logical operators in QBASIC are:
1. AND
2. OR
3. NOT.
Bhuwan Bista
AND Operator
• AND operator returns ‘True’ when all the results returned from individual
relational expressions are ‘True’ otherwise it returns ‘False’.
• The AND Truth Table is given shown below.
Condition1(P) Condition2(Q) Result(P and Q)
T--------1 F-------0 F------0
T--------1 T-------1 T------1
F--------0 F------0 F------0
F--------1 T-------1 F------0
Bhuwan Bista
OR Operator
• OR Operator return ‘True’ if any one of the relational expressions returns ‘True’.
• If all the relational expressions returns ‘False’ then only the combined result
returned by OR operator will be ‘False’.
Condition1(P) Condition2(Q) Result(P or Q)
T 1 F 0 T 1
T 1 T 1 T 1
F 0 T 1 T 1
F 0 F 0 F 0
Bhuwan Bista
NOT Operator
• NOT Operator operates on one operand and returns ‘True’ if the logical operation
returns ‘False’.
• The NOT truth table is as given below.
Condition1(A) Result(Not A)
1 0
0 1
Bhuwan Bista
String Operator
•String Operator joins two or more than two sting data.
•The plus sign (+) is used as the String operator.
•The act of combining two stings is called concatenation.
•The following table shows the use of Sting Operator.
String Data1(A$) String Data2(B$) Result(A$+B$)
“Abhay” “Pant” Abhay Pant
“17” “46” 1746
Bhuwan Bista
EXPRESSIONS
• An expression is the combination of operators, constants and variables that is
evaluated to get a result.
• The result of the expression is either string data, numeric data or logical value
(true or false) and can be stored in a variable.
• For example, the following are expressions in QBASIC.
a) (A + B) > C
b) A > = B + C
c) u* t + ½*a*t^2
Algebraic Expressions BASIC Expressions
A = L × B A = L * B
P = 2(L + B) P = 2*(L + B)
I = (P × T × R)/100 I = (P * T * R)/100
V = 4/3PiR2 V = 4/3 * PI * R^3
Bhuwan Bista
KEYWORD
• Keywords are those words which have special meanings in QBASIC.
• Keywords are formed by using characters of QBASIC Characters Set. Keywords are
statements, commands, functions (built in functions) and names of operators.
• The keywords are also called Reserved Words.
• Some reserved words are:
CLS REM INPUT PRINT FOR
DO SELECT MID$ ASC SQR
LEN LEFT$ TIME$ INT LET…
Bhuwan Bista
Syntax
Syntax refers to the set of rules that defines the
combinations of symbols that are considered to be
correctly structured statements or expressions in that
language.
If a user tries to execute a command without proper
syntax, it generates syntax error, usually causing the
program to fail.
Bhuwan Bista
Thank You
Bhuwan Bista

More Related Content

What's hot (20)

Modular Programming in C
Modular Programming in CModular Programming in C
Modular Programming in C
 
10. sub program
10. sub program10. sub program
10. sub program
 
Basics of cpp
Basics of cppBasics of cpp
Basics of cpp
 
Procedure oriented programming
Procedure oriented programmingProcedure oriented programming
Procedure oriented programming
 
structured programming
structured programmingstructured programming
structured programming
 
Programing techniques
Programing techniquesPrograming techniques
Programing techniques
 
User defined functions in C
User defined functions in CUser defined functions in C
User defined functions in C
 
C programming language working with functions 1
C programming language working with functions 1C programming language working with functions 1
C programming language working with functions 1
 
Modular programming
Modular programmingModular programming
Modular programming
 
User defined functions
User defined functionsUser defined functions
User defined functions
 
user defined function
user defined functionuser defined function
user defined function
 
Ppl
PplPpl
Ppl
 
Functions in c
Functions in cFunctions in c
Functions in c
 
Algorithm and c language
Algorithm and c languageAlgorithm and c language
Algorithm and c language
 
Function
FunctionFunction
Function
 
User defined functions in C programmig
User defined functions in C programmigUser defined functions in C programmig
User defined functions in C programmig
 
Functions in C
Functions in CFunctions in C
Functions in C
 
Functions
Functions Functions
Functions
 
Functions in C
Functions in CFunctions in C
Functions in C
 
Functions in C - Programming
Functions in C - Programming Functions in C - Programming
Functions in C - Programming
 

Similar to Qbesic programming class 9

C programming language
C programming languageC programming language
C programming languageAbin Rimal
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAAiman Hud
 
INTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptxINTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptxMamataAnilgod
 
CSE 1201: Structured Programming Language
CSE 1201: Structured Programming LanguageCSE 1201: Structured Programming Language
CSE 1201: Structured Programming LanguageZubayer Farazi
 
Lecture 2 variables
Lecture 2 variablesLecture 2 variables
Lecture 2 variablesTony Apreku
 
M.Florence Dayana / Basics of C Language
M.Florence Dayana / Basics of C LanguageM.Florence Dayana / Basics of C Language
M.Florence Dayana / Basics of C LanguageDr.Florence Dayana
 
C sharp part 001
C sharp part 001C sharp part 001
C sharp part 001Ralph Weber
 
Computer programming - variables constants operators expressions and statements
Computer programming - variables constants operators expressions and statementsComputer programming - variables constants operators expressions and statements
Computer programming - variables constants operators expressions and statementsJohn Paul Espino
 
5 conceptos progamacion2-tema4
5 conceptos progamacion2-tema45 conceptos progamacion2-tema4
5 conceptos progamacion2-tema4Elba Sepúlveda
 

Similar to Qbesic programming class 9 (20)

C programming language
C programming languageC programming language
C programming language
 
Programming
ProgrammingProgramming
Programming
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
INTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptxINTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptx
 
CSE 1201: Structured Programming Language
CSE 1201: Structured Programming LanguageCSE 1201: Structured Programming Language
CSE 1201: Structured Programming Language
 
Lecture 2 variables
Lecture 2 variablesLecture 2 variables
Lecture 2 variables
 
C programming
C programming C programming
C programming
 
C-PPT.pdf
C-PPT.pdfC-PPT.pdf
C-PPT.pdf
 
M.Florence Dayana / Basics of C Language
M.Florence Dayana / Basics of C LanguageM.Florence Dayana / Basics of C Language
M.Florence Dayana / Basics of C Language
 
C Language Part 1
C Language Part 1C Language Part 1
C Language Part 1
 
C sharp part 001
C sharp part 001C sharp part 001
C sharp part 001
 
Computer programming - variables constants operators expressions and statements
Computer programming - variables constants operators expressions and statementsComputer programming - variables constants operators expressions and statements
Computer programming - variables constants operators expressions and statements
 
C program
C programC program
C program
 
1 Revision Tour
1 Revision Tour1 Revision Tour
1 Revision Tour
 
5 conceptos progamacion2-tema4
5 conceptos progamacion2-tema45 conceptos progamacion2-tema4
5 conceptos progamacion2-tema4
 
#Code2 create c++ for beginners
#Code2 create  c++ for beginners #Code2 create  c++ for beginners
#Code2 create c++ for beginners
 
c-programming
c-programmingc-programming
c-programming
 
Getting Started with C++
Getting Started with C++Getting Started with C++
Getting Started with C++
 
Introduction%20C.pptx
Introduction%20C.pptxIntroduction%20C.pptx
Introduction%20C.pptx
 
C programming
C programmingC programming
C programming
 

Recently uploaded

Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 

Recently uploaded (20)

Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 

Qbesic programming class 9

  • 1. QBQSIC Programming Chapter-11 Class-9 Presenter By:Bhuwan Bista Computer Science Teacher, Adarash Vidya Niketan Secondary School Bhuwan Bista
  • 2. TAXONOMY OF PROGRAMMING Programming is defined as an art of writing codes. PROGRAMMER:This is a person that indulges or that is an expert in writing codes. His major responsible is to write programs that performs a given or specified function. PROGRAM: This implies the written instruction which the computer takes in and act upon. PROGRAMMING LANGUAGE: This indicates the language of choice for which the programmer communicates with the computer machine. Bhuwan Bista
  • 3. QBasic QBasic is a high level programming language. It stands for Quick Bignners All Perpose Symbolic Instruction Code. It can be used to create small CUI based application. It is easier to learn program. QuickBASIC was originally released in1985 Version 2.0 was released in 1986 In 1966 QBasic 4.5, the last version of QBasic,became available. Bhuwan Bista
  • 4. Features of QBasic It is a user friendly language. It is widely known and accepted programming language. It is one of the most flexible language, a modification can easily be done in already existing program. Language is easy since the variables can be named easily and uses simple English phrases with mathematical expressions. Bhuwan Bista
  • 5. Basic Terms Related to Programming • Bug: Error made in program is known as bug. • Debug: The process of correcting the bug is known as debug. • Execution: Process of running the program is known as execution. • Termination: Process of stoping program is known as termination • GIGO: Wrong output generated due to the wrong input. Bhuwan Bista
  • 6. QBASIC Commands  CLS-Used to clear the screen.  PRINT- Used to display the output on the screen.  REM- Stands for REMARK.It gives an explanation of the program there making the program more understandable.  LET- Assigns a value to a variable in program.  END-It is usually given at the end of the program.  INPUT-Allows users to enter values for a variable while running a program.  DELETE<LINE NO.>- Delete a line number in a program.  RUN-Used to execute the program and get the output on the screem.  NEW-Used to totally write a new program.  SYSTEM-Used to exit the QBASIC program. Bhuwan Bista
  • 7. Some Basic Statements OUTPUT Statement •These are statements that are used for fetch/retriv e/show to screen, inputted or stored data from the computer system. •The major/basic output statement used in QBasic is called PRINT. Bhuwan Bista
  • 8. OUTOUT STATEMENT-Usage & Format PRINT can be used in two ways e.g. 1. For outputting literals e.g. PRINT "Hellow_Jitu" 2. For outputting variables (values of an identifier) e.g. PRINT radius • (where radius is a variable having a particular value that has • preciously been inputted/capture, /stirred) Bhuwan Bista
  • 9. Character Set •A set of characters that are allowed to use in QBASIC is known as the QBASIC Character Set. • The QBASIC Character Set consists of alphabets (both small and capital), numbers (0 to 9) and special characters. •QBASIC keywords and variables are formed by using the characters defined in the QBASIC Character Set. •These special characters have their own meaning and function. The table below shows the special characters used in QBASIC. Bhuwan Bista
  • 10. Special Characters + “ > $ - ‘ < % * , ( @ / ; ) ! : . # ^ = ? Blank Space Bhuwan Bista
  • 11. CONSTANT Constants are the data or the values in a program that cannot be changed during the program execution. The data may be a letter, words, numbers, or special characters.  A constant can be stored in a variable when it is required to use in more than one statement or expression. In QBASIC, these data/constants are grouped into two main categories. They are: a. String Constant b. Numeric Constant Bhuwan Bista
  • 12. STRING CONSTANT String Constant is a letter, words, numbers, combination of letters with numbers or special characters enclosed in double quotes. Mathematical operations cannot be performed on String Constants. “D”, “BINOD”, “Roll NO. 23”, “!!! Welcome to QBASIC World !!!”, etc. are some examples of Sting Constants. Bhuwan Bista
  • 13. Numeric Constant • Numeric Constant refers to a number. •A number with or without decimal point is a numeric constant. • Thousand separators are not allowed to use in numeric constant. • Numeric data should not be enclosed in double quotes. • Mathematical operations and logical operations can be performed on the numeric constants. • 212, 103.03, 540, 31414, etc. are some examples of numeric constants. Bhuwan Bista
  • 14. VARIABLES Variables are the names of memory locations where we store data. A value of a variable can be change during the execution of the program. There are mainly two types of variables. They are: 1) Numeric Variable 2) String Variable Bhuwan Bista
  • 15. Numeric Variables A numeric variable stores numeric data. A numeric variable can be Integer, Long Integer, Single Precision or Double Precision variables. • An Integer variable can store only an integer number. Its type declaration sign is percentage (%). • A Long integer variable can store a large range of whole number. Its type declaration sign is ampersand (&0). • A Single Precision variable can store a whole number as well as number with decimal. Its type declaration sign is exclamation sign (!). You can also use it without declaration sign. It is the default numeric variable. • A Double Precision variable also stores a whole number as well as number with decimal point. Its type declaration sign is hash (#). Bhuwan Bista
  • 16. String Variables • A variable which can store string variable is called String variable. Its types declaration sign is dollar ($). • String is a array of character enclosed within the double inverted comma. e.g. N$="ram" Place$=“Saphal Awasthl“ String Variables are of two types: 1. Variable-Length string 2. Fixed-length string Bhuwan Bista
  • 17. Rules for naming a variable 1. Variable names can have maximum of 40 characters. 2. Variable names can have alphabets, numbers and decimal point. 3. A Variable name must begin with a letter. 4. A Variable name cannot begin with fn or FN alphabets. For example, fnames$, fnumetc. 5. Variable names cannot be reserved words. 6. Variable names may be ended with type declaration characters like $, %, &, !, and #. Naam$, Address$, Bookname$, GameName$, etc., are examples of Sting Varibales. Salary!, Age%, Mark, Number1, Number2, FirstNum, RollNumber, etc., are examples of Numeric Variables. Bhuwan Bista
  • 18. OPERATOR •Operators are symbols that indicate the type of operation QBASIC has to perform on the data or on the values of variables. •There are four types of operators in QBASIC. They are: 1. Arithmetic Operators 2. Relational Operators 3. Logical Operators 4. Sting Operator Bhuwan Bista
  • 19. Arithmetic Operators • Arithmetic Operators are used to perform mathematical calculations like addition, subtraction, division, multiplication and exponential. • The following table shows arithmetic operators used in QBASIC. Operation Operator Example Result Addition + 8+7 15 Subtraction - 5-2 3 Multiplication * 6*2 12 Division / 21/7 3 Integer Division 72 3 Exponential ^ 8^2 64 Modular Division Mod 5Mod2 1 Bhuwan Bista
  • 20. Relational Operators • Relational Operators are use to perform comparisons on two values of same type. • A comparison of sting data with numeric data cannot be done. The comparison of sting data is done on the basis of ASCII value. • The result of comparison is either True (non zero) or False (zero). Operators Name Example = Equal to A=B < Less than A<B > Greater than A>B <= Less than or Equal to A<=B >= Greater than or Equal to A>=B <> Not Equal to A<>B Bhuwan Bista
  • 21. Logical Operators Logical Operators combine two or more relational expressions to evaluate a single value as True (Non Zero) or False (Zero). The result of evaluation is used to make decisions about the program flow. The commonly used logical operators in QBASIC are: 1. AND 2. OR 3. NOT. Bhuwan Bista
  • 22. AND Operator • AND operator returns ‘True’ when all the results returned from individual relational expressions are ‘True’ otherwise it returns ‘False’. • The AND Truth Table is given shown below. Condition1(P) Condition2(Q) Result(P and Q) T--------1 F-------0 F------0 T--------1 T-------1 T------1 F--------0 F------0 F------0 F--------1 T-------1 F------0 Bhuwan Bista
  • 23. OR Operator • OR Operator return ‘True’ if any one of the relational expressions returns ‘True’. • If all the relational expressions returns ‘False’ then only the combined result returned by OR operator will be ‘False’. Condition1(P) Condition2(Q) Result(P or Q) T 1 F 0 T 1 T 1 T 1 T 1 F 0 T 1 T 1 F 0 F 0 F 0 Bhuwan Bista
  • 24. NOT Operator • NOT Operator operates on one operand and returns ‘True’ if the logical operation returns ‘False’. • The NOT truth table is as given below. Condition1(A) Result(Not A) 1 0 0 1 Bhuwan Bista
  • 25. String Operator •String Operator joins two or more than two sting data. •The plus sign (+) is used as the String operator. •The act of combining two stings is called concatenation. •The following table shows the use of Sting Operator. String Data1(A$) String Data2(B$) Result(A$+B$) “Abhay” “Pant” Abhay Pant “17” “46” 1746 Bhuwan Bista
  • 26. EXPRESSIONS • An expression is the combination of operators, constants and variables that is evaluated to get a result. • The result of the expression is either string data, numeric data or logical value (true or false) and can be stored in a variable. • For example, the following are expressions in QBASIC. a) (A + B) > C b) A > = B + C c) u* t + ½*a*t^2 Algebraic Expressions BASIC Expressions A = L × B A = L * B P = 2(L + B) P = 2*(L + B) I = (P × T × R)/100 I = (P * T * R)/100 V = 4/3PiR2 V = 4/3 * PI * R^3 Bhuwan Bista
  • 27. KEYWORD • Keywords are those words which have special meanings in QBASIC. • Keywords are formed by using characters of QBASIC Characters Set. Keywords are statements, commands, functions (built in functions) and names of operators. • The keywords are also called Reserved Words. • Some reserved words are: CLS REM INPUT PRINT FOR DO SELECT MID$ ASC SQR LEN LEFT$ TIME$ INT LET… Bhuwan Bista
  • 28. Syntax Syntax refers to the set of rules that defines the combinations of symbols that are considered to be correctly structured statements or expressions in that language. If a user tries to execute a command without proper syntax, it generates syntax error, usually causing the program to fail. Bhuwan Bista