Saturday, December 16, 2006

Question & Answer

a) What does modular programming mean?
Ans: Modular programming means the breaking down the big program into small programs or modules.
b) Give the difference between local and global variables.
Ans: Local Variable: Local variable is a variable which is defined within function block or area i.e. no other function can use that variable.
Global Variable: A variable declared outside a function is called global variable and is accessible to all the functions that are called after its declaration.
c) Give the function of CLOSE and KILL statements.
Ans: Functions of CLOSE and KILL statements:
CLOSE: This statement is used to close after writing, reading or appending. This statement is written before ending the program.
KILL: This statement is used to erase the innocent file of innocent disk.

Read the following program and answer the following questions.
DECLARE SUB String(X$)
X$ = "COMPUTER"
END
SUB String(X$)
L = LEN(X$)
FOR i = L to 1 STEP - 2
PRINT MID$(X$, i, 1);
NEXT i
END SUB
END

a) What statement should be added in main module to execute the program?
Ans: CALL String(X$)
b) What will be the output of the program?
Ans: R T P O
c) What will the value of L if X$ = "NEPAL"
Ans: 5
d) List out numeric and string variables used in the program.
Ans: Numeric Variable: L, i
String Variable: X$

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home