Find the output :

Function modify (a , b) 
{
      Integer c , d = 2 
      c= a * d + b 
      return c 
}

Function calculate () 
{
     Integer a = 5, b = 20, c 
     Integer d = 10 
     c = modify (a, b); 
     c = c + d 
     Print c
 }
A . 80

B . 40

C . 32

D . 72

Answer : B . 40

Explanation :

    • c = ?
    • d = 2
    • c = a * d + b
    • c = a * 2 + b then a = 5 b = 20
    • c = ?
    • c = c + d
    • c = a * 2 + b + d
    c = 5 * 2 + 20 + 10 = 40

Categorized in: