SlideShare a Scribd company logo
INTRODUCTION to
Programming and QBasic
By: Nyrhon Von V. Bautista
and Mhon Vincent S. Saldivar
JGMNHS G9-SSC-Lavoisier
Programming???? A brief background
• Programming is a set of step by step instructions
that tells or direct the computer what to do. It
sequences the tasks a user wants to be done and
produces the results or output needed.
• The set of rules or instructions that tells the
computer what to perform is done through a
programming languange. In this tutorial we will
use the QBASIC programming language.
• A programmer is the person who designs a
program.
Planning the
Solution
Coding the
Program
Testing the
Program
-Desk Checking
-Translation
-Debugging
Documentation
Identifying the
Problem
PROGRAM
LIFE
CYCLE
Did you know that the first
programmed word is
“HELLO WORLD”
LEVELS OF PROGRAMMING LANGUAGES
Machine Language or First Generation Programming Language
-this is considered to be the lowest level of programming
language.
Assembly Language or Second Generation of Programming
Language
-instead of using 1s and 0s assembly language uses MNEMONIC
Codes. Mnemonic codes are abbreviations that easy to
remember
High Level Language or Third Generation Programming
Language
-this language transformed programming in the early 1960’s.
Very High Level Languages or Fourth Generation Languages
-Fourth generation languages (4GL) simplifies further the third
level generation languages.
Natural Languages
- These languages are considered to be the fifth
Generation languages. These programming languages are called
Natural Languages because of their resemblance to
English Language.
Procedural Languages
Programming languages which are considered
procedural that uses a series of instructions or statements which
are sequential from the beginning to the end.
Examples of Procedural Languages:
BASIC – Beginner’s All-Purpose Symbolic Instruction Code
COBOL – Common Business Oriented Language
PASCAL
FORTRAN- Formula Translator
C
PL1 – Programming Language One
Non-procedural
Languages
These Programming languages are considered as object-
oriented programming languages. It is different from
procedural language since statements are not executed line
per line instead a series of instructions are executed as a whole
when an event occurs.
Examples of Non-procedural Languages
VISUAL BASIC
C++
JAVA
DELPHI
FLOWCHARTING
Flowcharting is one of the processes used in
designing or planning the solution to a
problem. It is a graphical representation to the
solution of a problem. It uses shapes to show
instructions and arrow lines and heads to
display the flow. It uses the shapes OVAL,
PARALLELOGRAM, RECTANGLE,
DIAMOND,CIRCLE & PENTAGON
Oval Terminal Symbol
Parallelogram Input/Output
Rectangle Process
Diamond Decision
Hexagon Initialization/Preparation
Arrow Lines & Arrow
Heads
Direction
Annotation
Circle On Page Connector
Pentagon Odd-Page connector
Qbasic Tutorial
After launching the QBasic interpreter (see before you start), you might
see a window requesting a list of "parameters." If this window comes up,
press the Enter key to continue.
You should now see the QBasic interpreter, which has a blue
background and displays a dialog box at the center. (If the interpreter
fills the entire screen, then you may want to press "Alt + Enter," to make
it smaller.)
Press the Esc key to hide the dialog box.
QBasic interpreter - main screen
Type the following (including the quotation marks) in the QBasic interpreter:
PRINT "Hello World!" <press Enter>
Now press F5 to run the program. You should now see a black screen,
with Hello World at the top, and Press any key to continue at the bottom.
Press a key on the keyboard to return to the main screen.
(The figure below displays the "output screen.")
Basic interpreter - output screen
If you run the program again, the interpreter adds another Hello World. QBasic
adds Hello World each time the program is run.
Deleting the program
To erase the current program:Go to the "File" menu.
Click "New."
The interpreter asks if you want to save the program.
Select "No" (or if you'd rather keep the program, select "Yes").
Strings
There are certain types of data (or information) called "strings." Strings contain a sequence of
characters (letters, numbers, and symbols) enclosed in quotation marks. For
example, "Hello World!" is a string.
The following are also strings:
"0123456789"
"This is a string"
"abc123"
"1 + 1 = 2"
Commands
There are also special functions called "commands" (also called "instructions").
A "command" tells the QBasic interpreter to do something.
The PRINT command tells the QBasic interpreter to print something to the
screen. In this case, the interpreter printed"Hello World!".
TIP: Instead of typing PRINT, you can enter a question mark. For example:
?"Hello World!"
With the PRINT command, you can also print numbers to the screen. Delete
the current program (unless you already have) and write the
following:PRINT 512 (or ?512)
<press Enter>
Press F5 to run the program. The program outputs:512
More about the PRINT command
You can use multiple print statements in your program.PRINT "Hello"
PRINT "World"
Output:Hello
World
To place World onto the previous line, place a semi-colon
after PRINT "Hello".PRINT "Hello";
PRINT "World"
Output:HelloWorld
Also, if you put a comma instead of a semi-colon on the first line, the program will
insert spaces between the two words.PRINT "Hello",
PRINT "World"
Output:Hello World
Variables
This chapter discusses an important topic in programming, "variables." Please read
this section thoroughly.
A variable is a piece of data kept in the computer's memory (RAM). The location of a
variable in RAM is called the"address."
How a variable is stored in RAM
The following program prints the variable X to the screen:print X
Since the variable hasn't been assigned a number, the value of the variable is 0. So, the
output of the program is:0
This next program sets X to 15, and then prints the variable:
X = 15
print X
This time, the output is:15
In the above example, the number 15 was stored in the computer's RAM at a certain
memory address. Then the PRINTcommand accessed (or looked at) that address when it
printed "15" to the screen.
Expressions
If you pass an expression to a variable, the expression is evaluated and the variable is set to that
value.x = 500 + (10 * 7)
PRINT x
Output:570
You can also use variables as expressions.rate = 50
time = 2
distance = rate * time
PRINT distance
Output:100
Plus, you can have both variables and numbers in an expression.X = 100
Y = X * 7
PRINT Y
Output:700
TIP: The following increases X by 1:
X = X + 1
Strings
If you add a dollar sign ($) to the end of a variable, the variable is a string.X$ = "Hello World!"
PRINT X$
Output:Hello World!
If you try to set a string to a non-string variable, an error occurs.X = "Hello World!"
The QBasic interpreter says "Type mismatch" when you try to run the above program.
A string can be added to the end of an existing variable string.X$ = "Hello"
X$ = X$ + "World"
PRINT X$
Output:HelloWorld
You can also add variable strings together.a$ = "String1"
b$ = "String2"
c$ = "String3"
d$ = a$ + b$ + c$
PRINT d$
Output:String1String2String3
Retrieving keyboard input from the user
One way to receive input from the keyboard is with the INPUT command.
The INPUT command allows the user to enter either a string or a number, which is
then stored in a variable.INPUT data$
PRINT data$
When this program is executed, the INPUT command displays a question mark,
followed by a blinking cursor. And when you enter text, the program stores that text
into the variable data$, which is printed to the screen.
TIP: If you place a string and a semi-colon between INPUT and the variable, the
program will print the string.
INPUT "Enter some text:"; data$
To receive a number, use a non-string variable.INPUT number
PRINT number
If you enter text instead of a number, the QBasic interpreter displays an error
message ("Redo from start").
To receive a number, use a non-string variable.INPUT number
PRINT number
If you enter text instead of a number, the QBasic interpreter displays an error
message ("Redo from start").
Below is another example of the INPUT command:PRINT "Enter some text:"
INPUT text$
PRINT "Now enter a number:"
INPUT num
PRINT text$
PRINT num
TIP: You can have the question mark displayed on the previous line by using a
semi-colon.
PRINT "Enter some text:";
INPUT text$
The IF and THEN commands
The IF and THEN commands are used to compare an expression and then perform some
task based on that expression.
x = 5
IF x = 5 THEN PRINT "x equals 5"
Since X does equal 5 in this case, the program outputs:x equals 5
Expression signs
You can also enter the following statements, instead of the equals
sign:x < 5 (x is less than 5)
x > 5 (x is greater than 5)
Run the following:x = 16
IF (x > 5) THEN PRINT "x is greater than 5"
Output:x is greater than 5
ELSE
Using the ELSE command, you can have the program perform
a different action if the statement is false.x = 3
IF x = 5 THEN PRINT "Yes" ELSE PRINT "No"
Since X doesn't equal 5, the output is:No
END IF
END IF allows you to have multiple commands after the IF...THEN statement,
but they must start on the line after theIF statement. END IF should appear
right after the list of commands.x = 5
IF (x = 5) THEN
INPUT a$
PRINT a$
END IF
The following program uses ELSE with the END IF command:x = 16
IF (x = 5) THEN
INPUT a$
PRINT a$
ELSE
PRINT x * 2
END IF
Output:32
TIP: There is a way to have multiple commands after IF...THENwithout
using END IF. To do so, place a colon between each command.
IF (x = 5) THEN INPUT a$: PRINT a$
THANK
YOU
FOR INQUIRIES Contact us.
https://www.facebook.com/mhonarch
https://www.facebook.com/eirelavlavun?fref=ts
Or Email us at hillcypress89@yahoo.com

More Related Content

What's hot

High level and Low level Language
High level and Low level Language High level and Low level Language
High level and Low level Language
adnan usmani
 
Basics of Microsoft Word
Basics of Microsoft WordBasics of Microsoft Word
Basics of Microsoft Word
Pickerington Public Library
 
Basic programming concepts
Basic programming conceptsBasic programming concepts
Basic programming conceptssalmankhan570
 
DOS commands
DOS commandsDOS commands
DOS commands
preetikapri1
 
Command prompt presentation
Command prompt presentationCommand prompt presentation
Command prompt presentation
Muhammad Taj
 
Introduction to Windows
Introduction to WindowsIntroduction to Windows
Introduction to Windows
Cha Mostierra
 
The Loops
The LoopsThe Loops
The Loops
Krishma Parekh
 
Switch case in C++
Switch case in C++Switch case in C++
Switch case in C++
Barani Govindarajan
 
Programming Fundamentals lecture 1
Programming Fundamentals lecture 1Programming Fundamentals lecture 1
Programming Fundamentals lecture 1
REHAN IJAZ
 
Lecture 1- Introduction to Operating Systems.pdf
Lecture 1- Introduction to Operating Systems.pdfLecture 1- Introduction to Operating Systems.pdf
Lecture 1- Introduction to Operating Systems.pdf
Amanuelmergia
 
MS Dos command
MS Dos commandMS Dos command
MS Dos command
Hardik Patel
 
Presentation on Programming Languages.
Presentation on Programming Languages.Presentation on Programming Languages.
Presentation on Programming Languages.
Mohammad Shakirul islam
 
Introduction to compilers
Introduction to compilersIntroduction to compilers
Introduction to compilers
Bilal Maqbool ツ
 
Command & statement
Command & statementCommand & statement
Command & statement
imrankhn22
 
Programming fundamentals lecture 4
Programming fundamentals lecture 4Programming fundamentals lecture 4
Programming fundamentals lecture 4Raja Hamid
 
Ms word 2007
Ms word 2007Ms word 2007
Shell and its types in LINUX
Shell and its types in LINUXShell and its types in LINUX
Shell and its types in LINUX
SHUBHA CHATURVEDI
 
Language processor
Language processorLanguage processor
Language processor
Muhammad Mudarrak
 

What's hot (20)

High level and Low level Language
High level and Low level Language High level and Low level Language
High level and Low level Language
 
Basics of Microsoft Word
Basics of Microsoft WordBasics of Microsoft Word
Basics of Microsoft Word
 
Basic programming concepts
Basic programming conceptsBasic programming concepts
Basic programming concepts
 
DOS commands
DOS commandsDOS commands
DOS commands
 
Command prompt presentation
Command prompt presentationCommand prompt presentation
Command prompt presentation
 
Introduction to Windows
Introduction to WindowsIntroduction to Windows
Introduction to Windows
 
The Loops
The LoopsThe Loops
The Loops
 
Switch case in C++
Switch case in C++Switch case in C++
Switch case in C++
 
Programming Fundamentals lecture 1
Programming Fundamentals lecture 1Programming Fundamentals lecture 1
Programming Fundamentals lecture 1
 
Computer shortcuts
Computer shortcutsComputer shortcuts
Computer shortcuts
 
Lecture 1- Introduction to Operating Systems.pdf
Lecture 1- Introduction to Operating Systems.pdfLecture 1- Introduction to Operating Systems.pdf
Lecture 1- Introduction to Operating Systems.pdf
 
MS Dos command
MS Dos commandMS Dos command
MS Dos command
 
C language unit-1
C language unit-1C language unit-1
C language unit-1
 
Presentation on Programming Languages.
Presentation on Programming Languages.Presentation on Programming Languages.
Presentation on Programming Languages.
 
Introduction to compilers
Introduction to compilersIntroduction to compilers
Introduction to compilers
 
Command & statement
Command & statementCommand & statement
Command & statement
 
Programming fundamentals lecture 4
Programming fundamentals lecture 4Programming fundamentals lecture 4
Programming fundamentals lecture 4
 
Ms word 2007
Ms word 2007Ms word 2007
Ms word 2007
 
Shell and its types in LINUX
Shell and its types in LINUXShell and its types in LINUX
Shell and its types in LINUX
 
Language processor
Language processorLanguage processor
Language processor
 

Viewers also liked

QBASIC
QBASICQBASIC
QBASICnivi88
 
Qbasic program
Qbasic programQbasic program
Qbasic program
Fercie Caseria
 
The Knowledge of QBasic
The Knowledge of QBasicThe Knowledge of QBasic
The Knowledge of QBasic
Enelrah Vanna Dela Cruz
 
QBASIC: A Tool For Modern Programming
QBASIC: A Tool For Modern ProgrammingQBASIC: A Tool For Modern Programming
QBASIC: A Tool For Modern Programming
Gifty Belle Manaois
 
Ch02 mis-imp-concepts
Ch02 mis-imp-conceptsCh02 mis-imp-concepts
Ch02 mis-imp-conceptsSR NAIDU
 
Lec monitor
Lec monitorLec monitor
Lec monitor
Protik Roy
 
Lect 30 dbms_fundamentals
Lect 30  dbms_fundamentalsLect 30  dbms_fundamentals
Lect 30 dbms_fundamentals
Protik Roy
 
Lecture 11 bmbs management information system qs
Lecture 11 bmbs management information system   qsLecture 11 bmbs management information system   qs
Lecture 11 bmbs management information system qs
Muhammad Ovais
 
Laudon mis12 ppt01
Laudon mis12 ppt01Laudon mis12 ppt01
Laudon mis12 ppt01Norazila Mat
 
MIS Chapter 1
MIS Chapter 1MIS Chapter 1
MIS Chapter 1
Dara Som
 
Management Information System (Full Notes)
Management Information System (Full Notes)Management Information System (Full Notes)
Management Information System (Full Notes)
Harish Chand
 

Viewers also liked (18)

QBASIC
QBASICQBASIC
QBASIC
 
Qbasic
QbasicQbasic
Qbasic
 
Qbasic program
Qbasic programQbasic program
Qbasic program
 
The Knowledge of QBasic
The Knowledge of QBasicThe Knowledge of QBasic
The Knowledge of QBasic
 
QBASIC: A Tool For Modern Programming
QBASIC: A Tool For Modern ProgrammingQBASIC: A Tool For Modern Programming
QBASIC: A Tool For Modern Programming
 
Ch02 mis-imp-concepts
Ch02 mis-imp-conceptsCh02 mis-imp-concepts
Ch02 mis-imp-concepts
 
Lec monitor
Lec monitorLec monitor
Lec monitor
 
Lecture 1 mis
Lecture 1  misLecture 1  mis
Lecture 1 mis
 
Lect 30 dbms_fundamentals
Lect 30  dbms_fundamentalsLect 30  dbms_fundamentals
Lect 30 dbms_fundamentals
 
Management information system Unit 1
Management information system Unit 1Management information system Unit 1
Management information system Unit 1
 
Lecture 11 bmbs management information system qs
Lecture 11 bmbs management information system   qsLecture 11 bmbs management information system   qs
Lecture 11 bmbs management information system qs
 
Mis 001
Mis 001Mis 001
Mis 001
 
Ch01
Ch01Ch01
Ch01
 
Management information system
Management information systemManagement information system
Management information system
 
Laudon mis12 ppt01
Laudon mis12 ppt01Laudon mis12 ppt01
Laudon mis12 ppt01
 
MIS Chapter 1
MIS Chapter 1MIS Chapter 1
MIS Chapter 1
 
Mis lecture ppt
Mis lecture pptMis lecture ppt
Mis lecture ppt
 
Management Information System (Full Notes)
Management Information System (Full Notes)Management Information System (Full Notes)
Management Information System (Full Notes)
 

Similar to Introduction to Programming and QBasic Tutorial

Basic Computer Programming
Basic Computer ProgrammingBasic Computer Programming
Basic Computer Programming
Allen de Castro
 
Learn Programming with Livecoding.tv http://goo.gl/tIgO1I
Learn Programming with Livecoding.tv http://goo.gl/tIgO1ILearn Programming with Livecoding.tv http://goo.gl/tIgO1I
Learn Programming with Livecoding.tv http://goo.gl/tIgO1I
livecoding.tv
 
Basic computer-programming-2
Basic computer-programming-2Basic computer-programming-2
Basic computer-programming-2
lemonmichelangelo
 
Programming
ProgrammingProgramming
Programming
Leo Simon Anfone
 
Assembly Language Programming
Assembly Language ProgrammingAssembly Language Programming
Assembly Language Programming
Niropam Das
 
COMPUTER PROGRAMMING
COMPUTER PROGRAMMINGCOMPUTER PROGRAMMING
COMPUTER PROGRAMMING
arisamae1114
 
The basics of c programming
The basics of c programmingThe basics of c programming
The basics of c programming
Muhammed Thanveer M
 
C language industrial training report
C language industrial training reportC language industrial training report
C language industrial training report
Raushan Pandey
 
Algorithms and flowcharts
Algorithms and flowchartsAlgorithms and flowcharts
Algorithms and flowcharts
Samuel Igbanogu
 
Input-output
Input-outputInput-output
Input-output
neda marie maramo
 
Python Programming - II. The Basics
Python Programming - II. The BasicsPython Programming - II. The Basics
Python Programming - II. The Basics
Ranel Padon
 
QBASIC: A Tool For Modern Programming
QBASIC: A Tool For Modern ProgrammingQBASIC: A Tool For Modern Programming
QBASIC: A Tool For Modern Programming
Gifty Belle Manaois
 
Learning R while exploring statistics
Learning R while exploring statisticsLearning R while exploring statistics
Learning R while exploring statistics
Dorothy Bishop
 
Basic programming
Basic programmingBasic programming
Basic programming
Nicole Danielle Mallari
 
Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)pbarasia
 
learn computer science.ppt
learn computer science.pptlearn computer science.ppt
learn computer science.ppt
faithola1
 

Similar to Introduction to Programming and QBasic Tutorial (20)

Computer programming k 12
Computer programming k 12Computer programming k 12
Computer programming k 12
 
Basic Computer Programming
Basic Computer ProgrammingBasic Computer Programming
Basic Computer Programming
 
programming.ppt
programming.pptprogramming.ppt
programming.ppt
 
Learn Programming with Livecoding.tv http://goo.gl/tIgO1I
Learn Programming with Livecoding.tv http://goo.gl/tIgO1ILearn Programming with Livecoding.tv http://goo.gl/tIgO1I
Learn Programming with Livecoding.tv http://goo.gl/tIgO1I
 
Basic computer-programming-2
Basic computer-programming-2Basic computer-programming-2
Basic computer-programming-2
 
Programming
ProgrammingProgramming
Programming
 
Assembly Language Programming
Assembly Language ProgrammingAssembly Language Programming
Assembly Language Programming
 
COMPUTER PROGRAMMING
COMPUTER PROGRAMMINGCOMPUTER PROGRAMMING
COMPUTER PROGRAMMING
 
The basics of c programming
The basics of c programmingThe basics of c programming
The basics of c programming
 
C language industrial training report
C language industrial training reportC language industrial training report
C language industrial training report
 
Algorithms and flowcharts
Algorithms and flowchartsAlgorithms and flowcharts
Algorithms and flowcharts
 
Input-output
Input-outputInput-output
Input-output
 
Python Programming - II. The Basics
Python Programming - II. The BasicsPython Programming - II. The Basics
Python Programming - II. The Basics
 
A tutorial on C++ Programming
A tutorial on C++ ProgrammingA tutorial on C++ Programming
A tutorial on C++ Programming
 
QBASIC: A Tool For Modern Programming
QBASIC: A Tool For Modern ProgrammingQBASIC: A Tool For Modern Programming
QBASIC: A Tool For Modern Programming
 
Learning R while exploring statistics
Learning R while exploring statisticsLearning R while exploring statistics
Learning R while exploring statistics
 
Basic programming
Basic programmingBasic programming
Basic programming
 
Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)
 
learn computer science.ppt
learn computer science.pptlearn computer science.ppt
learn computer science.ppt
 
C programming
C programmingC programming
C programming
 

Recently uploaded

The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
Wasim Ak
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
Mohammed Sikander
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 

Recently uploaded (20)

The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 

Introduction to Programming and QBasic Tutorial

  • 1. INTRODUCTION to Programming and QBasic By: Nyrhon Von V. Bautista and Mhon Vincent S. Saldivar JGMNHS G9-SSC-Lavoisier
  • 2. Programming???? A brief background • Programming is a set of step by step instructions that tells or direct the computer what to do. It sequences the tasks a user wants to be done and produces the results or output needed. • The set of rules or instructions that tells the computer what to perform is done through a programming languange. In this tutorial we will use the QBASIC programming language. • A programmer is the person who designs a program.
  • 3. Planning the Solution Coding the Program Testing the Program -Desk Checking -Translation -Debugging Documentation Identifying the Problem PROGRAM LIFE CYCLE
  • 4. Did you know that the first programmed word is “HELLO WORLD” LEVELS OF PROGRAMMING LANGUAGES Machine Language or First Generation Programming Language -this is considered to be the lowest level of programming language. Assembly Language or Second Generation of Programming Language -instead of using 1s and 0s assembly language uses MNEMONIC Codes. Mnemonic codes are abbreviations that easy to remember High Level Language or Third Generation Programming Language -this language transformed programming in the early 1960’s. Very High Level Languages or Fourth Generation Languages -Fourth generation languages (4GL) simplifies further the third level generation languages. Natural Languages - These languages are considered to be the fifth Generation languages. These programming languages are called Natural Languages because of their resemblance to English Language.
  • 5. Procedural Languages Programming languages which are considered procedural that uses a series of instructions or statements which are sequential from the beginning to the end. Examples of Procedural Languages: BASIC – Beginner’s All-Purpose Symbolic Instruction Code COBOL – Common Business Oriented Language PASCAL FORTRAN- Formula Translator C PL1 – Programming Language One
  • 6. Non-procedural Languages These Programming languages are considered as object- oriented programming languages. It is different from procedural language since statements are not executed line per line instead a series of instructions are executed as a whole when an event occurs. Examples of Non-procedural Languages VISUAL BASIC C++ JAVA DELPHI
  • 7. FLOWCHARTING Flowcharting is one of the processes used in designing or planning the solution to a problem. It is a graphical representation to the solution of a problem. It uses shapes to show instructions and arrow lines and heads to display the flow. It uses the shapes OVAL, PARALLELOGRAM, RECTANGLE, DIAMOND,CIRCLE & PENTAGON
  • 8. Oval Terminal Symbol Parallelogram Input/Output Rectangle Process Diamond Decision Hexagon Initialization/Preparation Arrow Lines & Arrow Heads Direction Annotation Circle On Page Connector Pentagon Odd-Page connector
  • 9. Qbasic Tutorial After launching the QBasic interpreter (see before you start), you might see a window requesting a list of "parameters." If this window comes up, press the Enter key to continue. You should now see the QBasic interpreter, which has a blue background and displays a dialog box at the center. (If the interpreter fills the entire screen, then you may want to press "Alt + Enter," to make it smaller.) Press the Esc key to hide the dialog box. QBasic interpreter - main screen
  • 10. Type the following (including the quotation marks) in the QBasic interpreter: PRINT "Hello World!" <press Enter> Now press F5 to run the program. You should now see a black screen, with Hello World at the top, and Press any key to continue at the bottom. Press a key on the keyboard to return to the main screen. (The figure below displays the "output screen.") Basic interpreter - output screen If you run the program again, the interpreter adds another Hello World. QBasic adds Hello World each time the program is run.
  • 11. Deleting the program To erase the current program:Go to the "File" menu. Click "New." The interpreter asks if you want to save the program. Select "No" (or if you'd rather keep the program, select "Yes"). Strings There are certain types of data (or information) called "strings." Strings contain a sequence of characters (letters, numbers, and symbols) enclosed in quotation marks. For example, "Hello World!" is a string. The following are also strings: "0123456789" "This is a string" "abc123" "1 + 1 = 2"
  • 12. Commands There are also special functions called "commands" (also called "instructions"). A "command" tells the QBasic interpreter to do something. The PRINT command tells the QBasic interpreter to print something to the screen. In this case, the interpreter printed"Hello World!". TIP: Instead of typing PRINT, you can enter a question mark. For example: ?"Hello World!" With the PRINT command, you can also print numbers to the screen. Delete the current program (unless you already have) and write the following:PRINT 512 (or ?512) <press Enter> Press F5 to run the program. The program outputs:512
  • 13. More about the PRINT command You can use multiple print statements in your program.PRINT "Hello" PRINT "World" Output:Hello World To place World onto the previous line, place a semi-colon after PRINT "Hello".PRINT "Hello"; PRINT "World" Output:HelloWorld Also, if you put a comma instead of a semi-colon on the first line, the program will insert spaces between the two words.PRINT "Hello", PRINT "World" Output:Hello World
  • 14. Variables This chapter discusses an important topic in programming, "variables." Please read this section thoroughly. A variable is a piece of data kept in the computer's memory (RAM). The location of a variable in RAM is called the"address." How a variable is stored in RAM The following program prints the variable X to the screen:print X Since the variable hasn't been assigned a number, the value of the variable is 0. So, the output of the program is:0 This next program sets X to 15, and then prints the variable: X = 15 print X This time, the output is:15 In the above example, the number 15 was stored in the computer's RAM at a certain memory address. Then the PRINTcommand accessed (or looked at) that address when it printed "15" to the screen.
  • 15. Expressions If you pass an expression to a variable, the expression is evaluated and the variable is set to that value.x = 500 + (10 * 7) PRINT x Output:570 You can also use variables as expressions.rate = 50 time = 2 distance = rate * time PRINT distance Output:100 Plus, you can have both variables and numbers in an expression.X = 100 Y = X * 7 PRINT Y Output:700 TIP: The following increases X by 1: X = X + 1
  • 16. Strings If you add a dollar sign ($) to the end of a variable, the variable is a string.X$ = "Hello World!" PRINT X$ Output:Hello World! If you try to set a string to a non-string variable, an error occurs.X = "Hello World!" The QBasic interpreter says "Type mismatch" when you try to run the above program. A string can be added to the end of an existing variable string.X$ = "Hello" X$ = X$ + "World" PRINT X$ Output:HelloWorld You can also add variable strings together.a$ = "String1" b$ = "String2" c$ = "String3" d$ = a$ + b$ + c$ PRINT d$ Output:String1String2String3
  • 17. Retrieving keyboard input from the user One way to receive input from the keyboard is with the INPUT command. The INPUT command allows the user to enter either a string or a number, which is then stored in a variable.INPUT data$ PRINT data$ When this program is executed, the INPUT command displays a question mark, followed by a blinking cursor. And when you enter text, the program stores that text into the variable data$, which is printed to the screen. TIP: If you place a string and a semi-colon between INPUT and the variable, the program will print the string. INPUT "Enter some text:"; data$ To receive a number, use a non-string variable.INPUT number PRINT number If you enter text instead of a number, the QBasic interpreter displays an error message ("Redo from start").
  • 18. To receive a number, use a non-string variable.INPUT number PRINT number If you enter text instead of a number, the QBasic interpreter displays an error message ("Redo from start"). Below is another example of the INPUT command:PRINT "Enter some text:" INPUT text$ PRINT "Now enter a number:" INPUT num PRINT text$ PRINT num TIP: You can have the question mark displayed on the previous line by using a semi-colon. PRINT "Enter some text:"; INPUT text$
  • 19. The IF and THEN commands The IF and THEN commands are used to compare an expression and then perform some task based on that expression. x = 5 IF x = 5 THEN PRINT "x equals 5" Since X does equal 5 in this case, the program outputs:x equals 5 Expression signs You can also enter the following statements, instead of the equals sign:x < 5 (x is less than 5) x > 5 (x is greater than 5) Run the following:x = 16 IF (x > 5) THEN PRINT "x is greater than 5" Output:x is greater than 5
  • 20. ELSE Using the ELSE command, you can have the program perform a different action if the statement is false.x = 3 IF x = 5 THEN PRINT "Yes" ELSE PRINT "No" Since X doesn't equal 5, the output is:No END IF END IF allows you to have multiple commands after the IF...THEN statement, but they must start on the line after theIF statement. END IF should appear right after the list of commands.x = 5 IF (x = 5) THEN INPUT a$ PRINT a$
  • 21. END IF The following program uses ELSE with the END IF command:x = 16 IF (x = 5) THEN INPUT a$ PRINT a$ ELSE PRINT x * 2 END IF Output:32 TIP: There is a way to have multiple commands after IF...THENwithout using END IF. To do so, place a colon between each command. IF (x = 5) THEN INPUT a$: PRINT a$
  • 22. THANK YOU FOR INQUIRIES Contact us. https://www.facebook.com/mhonarch https://www.facebook.com/eirelavlavun?fref=ts Or Email us at hillcypress89@yahoo.com