Full width home advertisement

Grade 10 Revision

Post Page Advertisement [Top]

MODULAR PROGRAMMING CONCEPTUAL QUESTIONS

                THEORY QUESTIONS OF MODULAR PROGRAMMING

1)  What is a modular programming?
Ans: Modular programming is a technique used to divide program into many small, manageable, logical and functional modules or blocks.

2)  What is module?
Ans: Module is a block of statement that solves a particular problem.

3)  What are the advantages of modular programming?
Ans: The advantages of modular programming are:
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)  What are two procedures QBASIC support to divide programs?
Ans: The two procedures used to divide programs in QBASIC are SUB-procedure and FUNCTION-procedure.

5) What is SUB-procedure?
Ans: A SUB-procedure is a small, logical and manageable functional part of program which prefers specific task and does not return any value.

6)  What is a FUNCTION-procedure?
Ans: 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.

7)  Write down the function of CALL statement.
Ans: The function of CALL statement is to transfer the control to another procedure.

8) Write down the function of DECLARE statement.
Ans: The function of DECLARE statement is to declare procedure such as FUNCTION or SUB in modular programming.

9) What is main module?
Ans: The top level controlling section or the entry point in modular programming is called main module.

10) What is sub module?
Ans: Sub module is a program which is written under the main module. A program may have one or more sub modules under main module.

11) Define parameters and arguments.
Ans: Parameters are variables that will receive data (arguments value) sent to the procedures (SUB program and FUNCTION).

Arguments are the values that are sent to the procedures (SUB program and FUNCTION)
* Actual or real parameters are called arguments.
* Formal parameters are called parameter.
12) Write down the functions of DIM SHARED statement.
Ans: The functions of DIM SHARED statement are:
i) It makes variable accessible to all modules.
ii) It appears in main module/ program.

13) What are library functions?
Ans: Library functions are built-in or readymade functions provided by QBASIC.

14)  What is user defined function?
Ans: Function which is defined by the user according to the need is called user defined function.

15)  Write down the differences between SUB and FUNCTION procedure.
Ans:
SUB-procedure
FUNCTION-procedure
i) SUB-procedure does not return value.
i) FUNCTION-procedure must return a value.
ii) SUB-procedure is called by CALL statement.
ii) FUNCTION-procedure is called by statement and expression method.
iii) SUB-procedure’s name does not accept data type symbol because it does not need to return a value.
iii) 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.

16)  Differentiate between SHARED and COMMON SHARED.
Ans:
SHARED
COMMON SHARED
It is used in the sub program to share the values of certain variables between main module and sub program
It is used in the main program to share variable list between main module and all sub programs.

17)  Differentiate between local variable and global variable.
Ans: 
Local Variable
Global Variable
i) Variables which are declared inside the procedure are called local variables.
i) Variables which are declared outside the procedure are called global variables.
ii) Local variables are not visible to other modules or functions.
ii) Global variables are visible to other modules or functions.
iii) Its value is protected from outside interference and has no effect on the variables outside the procedures.
iii) Its values can be accessed from any procedure or module.

18) List the modes of operations for opening a sequential file.
Ans: The modes of operation for opening a sequential file are:
i) Output Mode
ii) Input Mode
iii) Append Mode

19)  Differentiate between output mode and append mode.
Ans:
OUTPUT mode
APPEND mode
i)  It creates a new file and prepares to write data to the file.
i) It opens an existing file and prepares to add data to the file.
ii) If the file already exists its current contents will be destroyed.
ii) If the specified file does not exist APPEND mode creates it.

20)  Write down the functions of:
a) OPEN statement:
It opens a sequential file for one of the three possible operations (reading, writing, appending).
b) WRITE statement:
It sends one or more data items to the specified file.
c) CLOSE statement:
It closes one or all open files.
d) INPUT# statement:
It reads data from the sequential data file.
e) EOF() function:
It detects the end of the file marker reading the data from an open sequential file.
f) LINE INPUT statement:
It reads the entire line or maximum 255 characters form the keyboard or the sequential file.
g) INPUT$ function:
It reads the specified number of characters form the data file.
h) NAME statement:
The NAME statement renames a file on a diskette. Only file name changes, data and program line remains intact.
i) KILL statement:
The KILL statement deletes the file or files from the specified drive and directory.
j) MKDIR statement:
It creates a subdirectory which is used to manage files.
k) CHDIR statement:
It allows QBASIC to change from one directory to another.
l) RMDIR statement:
It is used to remove or delete only the subdirectories from a disk. It can remove only empty subdirectories.
m) FILES statement: The FILES statement displays the files of the current sub directory or specified sub directory.
21)  Differentiate between passing argument by value and passing argument by reference
Ans:
Passing arguments by value
Passing arguments by reference
i) When arguments are passed by value it makes a duplicate copy of arguments and their values (constants) are used directly in parameter.
i) When arguments are passed by reference the address of the variables are passed to the procedure.
ii) It doesn’t make any effect on values of variable which are passed to a procedure even they are changed in the procedure.
ii) The changes made in the procedure’s variable will affect the variables used at calling module.
iii) To pass the argument by value, variable is enclosed in parenthesis.
iii) By default the value is passed by reference.


1 comment:

  1. I found Hubwit as a transparent s ite, a social hub which is a conglomerate of Buyers and Sellers who are ready to offer online digital consultancy at decent cost. Bauen mit Modulen

    ReplyDelete

Bottom Ad [Post Page]