SlideShare a Scribd company logo
MODULAR PROGRAMMING IN QBASIC

  1.    What are modules?
                When program becomes lengthy, its code becomes more and more complicated and difficult
        to understand and manage. To remedy this, program is divided into smaller manageable program
        blocks, which are called modules. When these modules combined, they form a complete solution to
        the problem.
  2.    What are the two procedures that QBASIC support to divide program?
                  Two procedure used to divide program in QBASIC are Subprogram and Function.
  3.    What is modular programming (structured programming)?
                Modular programming is a method of writing computer program that divides main program
        into modules.
  4.    What is module?
              A module is a block of statement that solves particular problem. A module may contain SUB
        and FUNCTION procedure, as well as code not part of SUB or FUNCTION.
                  In modular programming, program contains main module and sub-modules under main
        module.
                  To create a SUB (or subroutine):
                      a. Select the "Edit" menu.
                      b. Choose "New Sub".
                      c. Enter a name for the subroutine.
                      d. Type a list of commands between SUB and END SUB
                     Sample subroutine:
                     SUB GuessNum
                        favenum = 7
                        PRINT "What is my favorite number";
                        INPUT guess
                        IF guess = favenum THEN
                               PRINT "Congratulations, you are correct!”
                            ELSE
                               PRINT “Sorry, you’re wrong!”
                        END IF
                     END SUB
                  To use the subroutine:
                      a. Press F2.
                      b. Select "Untitled".
                      c. Press Enter to return to the "main module".
                      d. Use CALL to execute the subroutine.

                A function is the same as a subroutine, except it returns a value. To return a value, set a
        variable with the same name as the function.
                Sample FUNCTION:
                         PRINT Add(10, 7)
                         FUNCTION Add (num1, num2)
                            Add = num1 + num2
                         END FUNCTION




ebces08092012                               QBASIC Programming                                       Page 1
MODULAR PROGRAMMING IN QBASIC

  5.    What are the advantages of Modular programming?
                a. Single modules can be used in different places.
                b. Different programmers can develop different program modules independently.
  6.    QBASIC is known as modular programming. Why?
              QBASIC is known as modular programming because it uses the technique of “Divide and
        Conquer” to solve a problem.
  7.    Differentiate between library function and user defined function
                Library functions are functions provided by QBASIC. They are also termed as built-in
        functions or standard functions. Two types of library functions are
                    a. string function
                    b. numeric function
                User – defined functions are functions created by users.
  8.    Differentiate between Local variable and Global variable.
                Local variables are declared inside the procedure are local by default. Their values are
        protected from outside interference and have no effect on the variables outside the procedures.
                Global variables are variables which can be accessed from any procedures or module.
  9.    What are parameters and arguments?
                Parameters are variables that receive data (argument values) sent to the procedures
        (subroutines and functions).
10.     Differentiate between SHARED and COMMON SHARED.
               SHARED statement is used in the subprogram to share the values of certain variable
        between main module and subprogram.
               A COMMON SHARED statement is used in main program to share variable list between main
        program and all sub programs.
                DECLARE - a non-executable statement that declares references to BASIC procedures and
        invokes argument type checking
                Syntax:
                DECLARE {FUNCTION | SUB} name [([parameterlist])]
                    name is the name that will be used to call the procedure
                    parameterlist indicates the number and type of arguments that will be used to call the
                        procedure




ebces08092012                               QBASIC Programming                                        Page 2

More Related Content

What's hot

Digital Audio
Digital AudioDigital Audio
Digital Audio
kavitha muneeshwaran
 
Inheritance in OOPS
Inheritance in OOPSInheritance in OOPS
Inheritance in OOPS
Ronak Chhajed
 
Visual Basic Controls ppt
Visual Basic Controls pptVisual Basic Controls ppt
Visual Basic Controls ppt
Ranjuma Shubhangi
 
Visual Basic 6.0
Visual Basic 6.0Visual Basic 6.0
Visual Basic 6.0
Anjan Mahanta
 
History of C Programming Language
History of C Programming LanguageHistory of C Programming Language
History of C Programming Language
Niloy Biswas
 
Need of object oriented programming
Need of object oriented programmingNeed of object oriented programming
Need of object oriented programming
Amar Jukuntla
 
simple exercises in Macromedia flash 8
simple exercises in Macromedia flash 8simple exercises in Macromedia flash 8
simple exercises in Macromedia flash 8
srividhyasowrirajan
 
2CPP11 - Method Overloading
2CPP11 - Method Overloading2CPP11 - Method Overloading
2CPP11 - Method Overloading
Michael Heron
 
Chapter 1 introduction to multimedia
Chapter 1 introduction to multimediaChapter 1 introduction to multimedia
Chapter 1 introduction to multimedia
ABDUmomo
 
Application software
Application softwareApplication software
Application software
Rana Usman Sattar
 
Application Software
Application SoftwareApplication Software
Application Software
Dasun Hegoda
 
Multimedia Products
Multimedia ProductsMultimedia Products
Multimedia Products
Tamanna Sehgal
 
1. over view and history of c
1. over view and history of c1. over view and history of c
1. over view and history of c
Harish Kumawat
 
Von Neumann Architecture
Von Neumann ArchitectureVon Neumann Architecture
Von Neumann Architecture
Jawad Farooqi
 
Application Software
Application SoftwareApplication Software
Application Software
Christian Gabriel
 
Introduction To Flash
Introduction To FlashIntroduction To Flash
Introduction To Flash
Nisarg Raval
 
Multimedia
MultimediaMultimedia
Multimedia
Shivam Tuteja
 
Qbasic
QbasicQbasic
multimedia element
multimedia elementmultimedia element
multimedia element
AZMAN KADIR
 
History of multimedia
History of multimediaHistory of multimedia
History of multimedia
Phenix Prabhakaran
 

What's hot (20)

Digital Audio
Digital AudioDigital Audio
Digital Audio
 
Inheritance in OOPS
Inheritance in OOPSInheritance in OOPS
Inheritance in OOPS
 
Visual Basic Controls ppt
Visual Basic Controls pptVisual Basic Controls ppt
Visual Basic Controls ppt
 
Visual Basic 6.0
Visual Basic 6.0Visual Basic 6.0
Visual Basic 6.0
 
History of C Programming Language
History of C Programming LanguageHistory of C Programming Language
History of C Programming Language
 
Need of object oriented programming
Need of object oriented programmingNeed of object oriented programming
Need of object oriented programming
 
simple exercises in Macromedia flash 8
simple exercises in Macromedia flash 8simple exercises in Macromedia flash 8
simple exercises in Macromedia flash 8
 
2CPP11 - Method Overloading
2CPP11 - Method Overloading2CPP11 - Method Overloading
2CPP11 - Method Overloading
 
Chapter 1 introduction to multimedia
Chapter 1 introduction to multimediaChapter 1 introduction to multimedia
Chapter 1 introduction to multimedia
 
Application software
Application softwareApplication software
Application software
 
Application Software
Application SoftwareApplication Software
Application Software
 
Multimedia Products
Multimedia ProductsMultimedia Products
Multimedia Products
 
1. over view and history of c
1. over view and history of c1. over view and history of c
1. over view and history of c
 
Von Neumann Architecture
Von Neumann ArchitectureVon Neumann Architecture
Von Neumann Architecture
 
Application Software
Application SoftwareApplication Software
Application Software
 
Introduction To Flash
Introduction To FlashIntroduction To Flash
Introduction To Flash
 
Multimedia
MultimediaMultimedia
Multimedia
 
Qbasic
QbasicQbasic
Qbasic
 
multimedia element
multimedia elementmultimedia element
multimedia element
 
History of multimedia
History of multimediaHistory of multimedia
History of multimedia
 

Viewers also liked

Modular programming
Modular programmingModular programming
structured programming
structured programmingstructured programming
structured programming
Ahmad54321
 
5 structured programming
5 structured programming 5 structured programming
5 structured programming
hccit
 
Qbasic tutorial
Qbasic tutorialQbasic tutorial
Qbasic tutorial
jovelleluzon
 
Software Engineering - 1
Software Engineering - 1Software Engineering - 1
Software Engineering - 1
Malsha Ranawaka
 
Qbasic program
Qbasic programQbasic program
Qbasic program
Fercie Caseria
 
Good Programming Practice
Good Programming PracticeGood Programming Practice
Good Programming Practice
Bikalpa Gyawali
 
Why C is Called Structured Programming Language
Why C is Called Structured Programming LanguageWhy C is Called Structured Programming Language
Why C is Called Structured Programming Language
Sinbad Konick
 
The Knowledge of QBasic
The Knowledge of QBasicThe Knowledge of QBasic
The Knowledge of QBasic
Enelrah Vanna Dela Cruz
 
Introduction to Programming and QBasic Tutorial
Introduction to Programming and QBasic TutorialIntroduction to Programming and QBasic Tutorial
Introduction to Programming and QBasic Tutorial
nhomz
 
Values education
Values educationValues education
structured programming Introduction to c fundamentals
structured programming Introduction to c fundamentalsstructured programming Introduction to c fundamentals
structured programming Introduction to c fundamentals
OMWOMA JACKSON
 

Viewers also liked (12)

Modular programming
Modular programmingModular programming
Modular programming
 
structured programming
structured programmingstructured programming
structured programming
 
5 structured programming
5 structured programming 5 structured programming
5 structured programming
 
Qbasic tutorial
Qbasic tutorialQbasic tutorial
Qbasic tutorial
 
Software Engineering - 1
Software Engineering - 1Software Engineering - 1
Software Engineering - 1
 
Qbasic program
Qbasic programQbasic program
Qbasic program
 
Good Programming Practice
Good Programming PracticeGood Programming Practice
Good Programming Practice
 
Why C is Called Structured Programming Language
Why C is Called Structured Programming LanguageWhy C is Called Structured Programming Language
Why C is Called Structured Programming Language
 
The Knowledge of QBasic
The Knowledge of QBasicThe Knowledge of QBasic
The Knowledge of QBasic
 
Introduction to Programming and QBasic Tutorial
Introduction to Programming and QBasic TutorialIntroduction to Programming and QBasic Tutorial
Introduction to Programming and QBasic Tutorial
 
Values education
Values educationValues education
Values education
 
structured programming Introduction to c fundamentals
structured programming Introduction to c fundamentalsstructured programming Introduction to c fundamentals
structured programming Introduction to c fundamentals
 

Similar to Modular programming in qbasic

10.-Modular-Programming-with function and Sub Procedure.pptx
10.-Modular-Programming-with function and Sub Procedure.pptx10.-Modular-Programming-with function and Sub Procedure.pptx
10.-Modular-Programming-with function and Sub Procedure.pptx
PurnaBahadurRana1
 
Presentation of computer
Presentation of computerPresentation of computer
Presentation of computer
SabinDhakal13
 
C++ 2
C++ 2C++ 2
C++ 2
jani
 
Chapter One Function.pptx
Chapter One Function.pptxChapter One Function.pptx
Chapter One Function.pptx
miki304759
 
Mastering Python lesson 4_functions_parameters_arguments
Mastering Python lesson 4_functions_parameters_argumentsMastering Python lesson 4_functions_parameters_arguments
Mastering Python lesson 4_functions_parameters_arguments
Ruth Marvin
 
Modular programming
Modular programmingModular programming
Modular programming
RoshanMaharjan13
 
Inheritance
InheritanceInheritance
Inheritance
Jaya Kumari
 
Modular programming
Modular programmingModular programming
Modular programming
BeebashPokhrel
 
FUNCTIONS.pptx
FUNCTIONS.pptxFUNCTIONS.pptx
FUNCTIONS.pptx
KalashJain27
 
Python Programming - Functions and Modules
Python Programming - Functions and ModulesPython Programming - Functions and Modules
Python Programming - Functions and Modules
Omid AmirGhiasvand
 
functions in C++.pdf
functions in C++.pdffunctions in C++.pdf
functions in C++.pdf
madihamaqbool6
 
Programming in Java: Getting Started
Programming in Java: Getting StartedProgramming in Java: Getting Started
Programming in Java: Getting Started
Martin Chapman
 
Lecture11 abap on line
Lecture11 abap on lineLecture11 abap on line
Lecture11 abap on line
Milind Patil
 
C tutorials
C tutorialsC tutorials
C tutorials
sujit11feb
 
Using general sub procedures
Using general sub proceduresUsing general sub procedures
Using general sub procedures
Danica Denice Epino
 
Oosd lecture unit 4 ppt introduction part
Oosd lecture unit 4 ppt introduction partOosd lecture unit 4 ppt introduction part
Oosd lecture unit 4 ppt introduction part
ManuSingh669370
 
Ch07.pdf
Ch07.pdfCh07.pdf
Ch07.pdf
slayerffGamers
 
Modular Programming in C
Modular Programming in CModular Programming in C
Modular Programming in C
bhawna kol
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
Aiman Hud
 
cbybalaguruswami-e-180803051831.pptx
cbybalaguruswami-e-180803051831.pptxcbybalaguruswami-e-180803051831.pptx
cbybalaguruswami-e-180803051831.pptx
SRamadossbiher
 

Similar to Modular programming in qbasic (20)

10.-Modular-Programming-with function and Sub Procedure.pptx
10.-Modular-Programming-with function and Sub Procedure.pptx10.-Modular-Programming-with function and Sub Procedure.pptx
10.-Modular-Programming-with function and Sub Procedure.pptx
 
Presentation of computer
Presentation of computerPresentation of computer
Presentation of computer
 
C++ 2
C++ 2C++ 2
C++ 2
 
Chapter One Function.pptx
Chapter One Function.pptxChapter One Function.pptx
Chapter One Function.pptx
 
Mastering Python lesson 4_functions_parameters_arguments
Mastering Python lesson 4_functions_parameters_argumentsMastering Python lesson 4_functions_parameters_arguments
Mastering Python lesson 4_functions_parameters_arguments
 
Modular programming
Modular programmingModular programming
Modular programming
 
Inheritance
InheritanceInheritance
Inheritance
 
Modular programming
Modular programmingModular programming
Modular programming
 
FUNCTIONS.pptx
FUNCTIONS.pptxFUNCTIONS.pptx
FUNCTIONS.pptx
 
Python Programming - Functions and Modules
Python Programming - Functions and ModulesPython Programming - Functions and Modules
Python Programming - Functions and Modules
 
functions in C++.pdf
functions in C++.pdffunctions in C++.pdf
functions in C++.pdf
 
Programming in Java: Getting Started
Programming in Java: Getting StartedProgramming in Java: Getting Started
Programming in Java: Getting Started
 
Lecture11 abap on line
Lecture11 abap on lineLecture11 abap on line
Lecture11 abap on line
 
C tutorials
C tutorialsC tutorials
C tutorials
 
Using general sub procedures
Using general sub proceduresUsing general sub procedures
Using general sub procedures
 
Oosd lecture unit 4 ppt introduction part
Oosd lecture unit 4 ppt introduction partOosd lecture unit 4 ppt introduction part
Oosd lecture unit 4 ppt introduction part
 
Ch07.pdf
Ch07.pdfCh07.pdf
Ch07.pdf
 
Modular Programming in C
Modular Programming in CModular Programming in C
Modular Programming in C
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
cbybalaguruswami-e-180803051831.pptx
cbybalaguruswami-e-180803051831.pptxcbybalaguruswami-e-180803051831.pptx
cbybalaguruswami-e-180803051831.pptx
 

Recently uploaded

C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
S. Raj Kumar
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdfIGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
Amin Marwan
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
สมใจ จันสุกสี
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
PsychoTech Services
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
BoudhayanBhattachari
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
Krassimira Luka
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
dot55audits
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
ssuser13ffe4
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 

Recently uploaded (20)

C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdfIGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 

Modular programming in qbasic

  • 1. MODULAR PROGRAMMING IN QBASIC 1. What are modules? When program becomes lengthy, its code becomes more and more complicated and difficult to understand and manage. To remedy this, program is divided into smaller manageable program blocks, which are called modules. When these modules combined, they form a complete solution to the problem. 2. What are the two procedures that QBASIC support to divide program? Two procedure used to divide program in QBASIC are Subprogram and Function. 3. What is modular programming (structured programming)? Modular programming is a method of writing computer program that divides main program into modules. 4. What is module? A module is a block of statement that solves particular problem. A module may contain SUB and FUNCTION procedure, as well as code not part of SUB or FUNCTION. In modular programming, program contains main module and sub-modules under main module. To create a SUB (or subroutine): a. Select the "Edit" menu. b. Choose "New Sub". c. Enter a name for the subroutine. d. Type a list of commands between SUB and END SUB Sample subroutine: SUB GuessNum favenum = 7 PRINT "What is my favorite number"; INPUT guess IF guess = favenum THEN PRINT "Congratulations, you are correct!” ELSE PRINT “Sorry, you’re wrong!” END IF END SUB To use the subroutine: a. Press F2. b. Select "Untitled". c. Press Enter to return to the "main module". d. Use CALL to execute the subroutine. A function is the same as a subroutine, except it returns a value. To return a value, set a variable with the same name as the function. Sample FUNCTION: PRINT Add(10, 7) FUNCTION Add (num1, num2) Add = num1 + num2 END FUNCTION ebces08092012 QBASIC Programming Page 1
  • 2. MODULAR PROGRAMMING IN QBASIC 5. What are the advantages of Modular programming? a. Single modules can be used in different places. b. Different programmers can develop different program modules independently. 6. QBASIC is known as modular programming. Why? QBASIC is known as modular programming because it uses the technique of “Divide and Conquer” to solve a problem. 7. Differentiate between library function and user defined function Library functions are functions provided by QBASIC. They are also termed as built-in functions or standard functions. Two types of library functions are a. string function b. numeric function User – defined functions are functions created by users. 8. Differentiate between Local variable and Global variable. Local variables are declared inside the procedure are local by default. Their values are protected from outside interference and have no effect on the variables outside the procedures. Global variables are variables which can be accessed from any procedures or module. 9. What are parameters and arguments? Parameters are variables that receive data (argument values) sent to the procedures (subroutines and functions). 10. Differentiate between SHARED and COMMON SHARED. SHARED statement is used in the subprogram to share the values of certain variable between main module and subprogram. A COMMON SHARED statement is used in main program to share variable list between main program and all sub programs. DECLARE - a non-executable statement that declares references to BASIC procedures and invokes argument type checking Syntax: DECLARE {FUNCTION | SUB} name [([parameterlist])] name is the name that will be used to call the procedure parameterlist indicates the number and type of arguments that will be used to call the procedure ebces08092012 QBASIC Programming Page 2