FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
Tutorial PM.pptx
1. • 1. What are the general subprogram characteristics?
Each subprogram has a single entry point
The calling program unit is suspended during the execution of the
called subprogram,which implies that there is only one subprogram in
execution at any given time
Contol always return to the caller when the subprogram execution
terminates.
2. • 2. Explain Pass by Reference
• Pass by reference is a second implementation model for inout –mode
parameters.
• Pass by reference method transmits an access path ,usually just an
address to the subprogram.
• This provides the access path to the cell storing the actual parameter .
• Thus the called subprogram is allowed to access the actual parameter
in the calling program unit
3. • The advantage of Pass by reference is that the passing process itself is
efficient in terms of both time and space
• One of the serious problem of pass by reference is that aliases can be
created .This problem should be expected because pass by reference
make access paths available to the called subprograms
4. • 3. Define Selection statements ? Which are the different types of
selection statements?
• A selection statement provides the means of choosing between two
or more execution paths in a program.
• Two types of selection statements are:
Two way selection statements
Multiple –Selection Constructs
5. • Two –way selection statements
• The general form of two way selector is as follows:
• If control_expression
• Then clause
• Else clause
• The control expressions are specified in parenthesis if the then
reserved word is not used to introduce the then clause
6. • Clause form: the then and else clauses appears either single
statements or compound statements.
• If (sum==0){
• If(count==0)
• result =0;
• }
• Else
• Result=1;
7. multiple –selection constructs
• The multiple –selection construct allows the selection of one of any
number of statements or statement groups.
• Examples of Multiple Selectors
switch (expression){
Case construct_expression_1:statement_1;
…….
Case constant_expression _n:statement_n;
}
8. • Multiple selection using If
• Consider the following Python selector construct
• If count<10:
Bag1 = True
Elif count<100:
Bag2 = True
Elif count <1000:
Bag 3 =True
9. • 4 .Define Guarded Commands?
• Guarded commands was suggested by Dijkstra. His primary
motivation was to provide control statements that would support a
program design methodology that ensured correctness during the
development rather than relying on verification or testing of
completed programs to ensure their correctness.
Dijkstra’s has two methods
10. Dijkstra’s has two methods
Dijkstra’s selection construct and loop structure
Dijkstra’s selection construct has the form
if <Boolean expression > -> <statement>
[] <Boolean expression > -> <statement>
[] ……
[] <Boolean expression > -> <statement>
fi
11. • The closing reserved word ‘fi’ is the opening reserved word spelled
backward.This form of closing reserved word is taken from ALGOL 68.
• This small blocks called fatbars are used to separate the guarded
clauses and allow clauses to be statement.
• Each line in the selection construct consisting of a Boolean expression
and a statement or statement sequence is called a Guarded command
12. • The loop structure proposed by Dijkstra has the form
do < Boolean expression > -> <statement>
[] <Boolean expression > -> <statement>
[] ….
[] <Boolean expression > -> <statement>
od
• The semantics of this construct is that all Boolean expressions are
evaluated on each iteration.