ENOTES

SEE Class 10 modular programming important theory questions

access_time Aug 28, 2020 remove_red_eye 8977

SEE Class 10 Modular programming

Q) QBASIC: Quick Beginner All Purpose Symbolic Instruction Code. It is High Level Language Developed Thomas Kurtz and John Kemeny.

Q) What is modular programming?

The process of breaking a large program into small logical and manageable part is called modular programming.

Q) Advantage of modular programming.

·   Different programmers can write the different program modules independently.

·   It is easy to design and debug codes of modules independently.

·   Faster program development.

·   Same modules can be used again, which reduce the program code.

Q) What is Module?

A small, logical and manageable part of the program is called module. There are two types of module:

Main Module: The controlling section of modular program which is in the top of one or more sub module.

Sub Module: The module written under the main module are sub modules. Program may have any number of sub modules.

Q) What is procedure?

A small, logical and manageable functional part of the program is called procedure. There are two types of procedure:

1.        Sub .. Procedure

A small, logical and manageable functional part of the program which performs some specific task and doesn’t return any value.

CALL statement is used to call sub module.

2.        Function .. Procedure

A small, logical and manageable functional part of the program which performs some specific task and it returns a single value to the main. CALL statement is not used to call sub module.

Q) Types of Functions:

A) Library Function: Those types of function which are given by QBASIC library itself are known as library function.

There are two types of library function:

Numeric Library Function:

SQR, INT, ABS, SGN, MOD,

String Library Function

LEN, left$, Right$, Mid$, Ucase$, lcase$, Str$, VAL

B) User defined function: Those types of function which are created by the user according to the requirement are known as user defined function.

Q) Parameters

They are the variables that will send and receive values from main module to sub-module. There are 2 types of parameters.

Formal Parameters:

These parameters are used to specify or declare types of data to be passed to the procedure.

Real/Actual Parameters:

These parameters are used to pass real value of data to the procedure.

Q) Differentiate local and global variables.

Local Variable: Which is defined inside a procedure is known as local variable.

Global Variable: Which is defined in the main module of a program is known as global variable.

Note: Global variable are initiated by using Keyword such as

DIM SHARED, COMMON SHARED, SHARED

Q) File Handling:

File handling is a process of creating, retrieving (Access) and adding data to the data file.

Define file. [data file]

File is the collection of data or information stored in secondary storage with a unique name called file name.

Q) Types of data file:

Sequential Data file: Data are stored and retrieved in sequential order.

Random Data file: Data are stored and retrieved randomly from any storage location.

Q) Advantages:

1.        The data stored in data file can be reused.

2.        Data can be stored, retrieved or even added in data file.

3.        Output can be stored for future use.

4.        Data in a data file can be manipulated and interpreted.

5.        Same data file can be used by multiple programs.

Q) Modes of opening data file:

Output: Store/Write

Input: Retrieve/Access/Read/Display

Append: Add

 

Write data on a data file: Output Mode
         Write #filenumber,v1,v2…..
Eg,   write #1,N$,A$,Age
Read data from a data file: Input Mode
         Input #filenumber,v1,v2…….
Eg,   input #1,N$,A$,Age
Add data to an existing datafile: Append Mode
   Write #filenumber,v1,v2…..
Eg,   write #1,N$,A$,Age

Q) Write the functions:

  1. Kill: It deletes the data file. Eg, Kill “exam.txt”
  2. Name AS: it renames the given file name with new name. Eg, Name “exam.txt” As “info.txt”
  3. Shell: It will open MS-Dos on Qbasic
  4. Files: It will list all the files and directory.
  5. CHDIR: Change directory.
  6. MKDIR: Make directory.
  7. RMDIR: Remove directory

Click here to practice more QBASIC question