Tuesday, February 25, 2020

SET 10 - Modular Programming----SEE Computer Science 2076 --- Practice Day 10 --- 20 Questions




Modular Programming

Questions and Answers

1.      Modular programming [SEE 2075 U] [SLC 2066] [SEE 2065 S] [MM 2076] [PMT 2075K]
Modular programming is a technique used to divide program into many small, manageable, logical and functional modules or blocks.

2.      Qbasic is called Modular Programming [MFT 2075] [SQE 2074K]
QBasic is called modular programming because it divides program into many small, manageable, logical and functional modules or blocks.
3.      Advantages of modular programming [SEE 2073 U] [MFT 2075] [SQE 2074K]
i) Different programmers can design different program modules independently, which is required in a large and complex program.
ii) It is easy to design code and test the program modules independently.
iii) It is possible to use a single module in different places which reduces program codes.
4.      Procedure [SLC 2072] [SLC 2071] [SLC 2064] [SLC 2067] [SLC 2068 S] [SQE 2075K] [PMT 2075K]
Procedure is a block of statements that solves a particular program.
Procedure is a section of code which performs one or more specific tasks and can be accessed from remote location. 
There are two types of procedure – SUB Procedure and FUNCTION procedure

5.      SUB procedure [SLC 2064] [SLC 2065] [SLC 2069 S] [MM 2076]
A SUB procedure is a small, logical and manageable functional part of program which prefers specific task and does not return any value. SUB-procedure is called by CALL statement. SUB-procedure’s name does not accept data type symbol because it does not need to return a value.

6.      FUNCTION procedure [SLC 2064] [SLC 2065] [SLC 2069 S] [MM 2076]
A FUNCTION procedure is a small, logical and manageable functional part of a program which performs specific task and returns single value to the main program or calling module. FUNCTION-procedure is called by statement and expression method. FUNCTION-procedure’s name accepts data type symbols such as $, %, !, #, &, etc. and it depends on the type of value to be returned. E.g.: FUNCTION REV$ returns string.

7.      String function [SEE 2074 U]
String function is used with string it returns string value.

8.      Numeric function [SEE 2074 U]
Numeric function is used with number it returns numeric value.

9.      Library functions [SQE 2074K]
Library functions are built-in or readymade functions provided by QBASIC. E.g. MID$( ), LEN( ), SQR( ) etc.

10.   User defined function [SLC 2066 S] [SQE 2074K]
Function which is defined by the user according to the need is called user defined function.
11.   Parameters [SEE 2074]
Parameters are variables that will receive data (arguments value) sent to the procedures (SUB program and FUNCTION). Formal parameters are called parameter.
12.   Arguments
Arguments are the values that are sent to the procedures (SUB program and FUNCTION). Actual or real parameters are called arguments.
13.   CALL statement [SLC 2071] [PMT 2075K]
The function of CALL statement is to transfer the control to another procedure.
14.   DECLARE statement
The function of DECLARE statement is to declare procedure such as FUNCTION or SUB in modular programming.
15.   DIM SHARED statement
i) It makes variable accessible to all modules.
ii) It appears in main module/ program.
16.   SHARED [SLC 2071]
It is used in the sub program to share the values of certain variables between main module and sub program
17.   COMMON SHARED [SEE 2074 U]
It is used in the main program to share variable list between main module and all sub programs. This statement is used to declared variable global.
18.   Local Variable [SEE 2075 S2]
Variables which are declared inside the procedure are called local variables. Local variables are not visible to other modules or functions. Its value is protected from outside interference and has no effect on the variables outside the procedures. Local variable can access only in its own module.
19.   Global Variable [SEE 2075 S2]
Variables which are declared outside the procedure are called global variables.  Global variables are visible to other modules or functions. Its values can be accessed from any procedure or module. Global variable can be access throughout the program
20.   Qbasic Operators [MFT 2075] [SQE 2074K]
Operators are special symbols that are meant for specific tasks or operators.
i) Arithmetic operators
ii) Relational operators
iii) Logical Operators
iv) String operator


No comments:

Post a Comment