Given the following segment of code,

// postcondition:returns x + y public int add(int x, int y) {}

// postcondition:return x y public int multiply(int x, int y) {}

which of the following corresponds to this expression?

multiply(add(multiply(a, b), add(multiply(a, c), multiply(b, c))), 2)

1.a
b + a c + b c 2

2.a
b + a c + b c + 2

3.a b + (a c + b c)

4.(a
b + a c + b c) 2

5.2
a b + (a c + b * c)

Verified Answer :

Hagrid

The whole line of code that performs an operation is this one:
multiply(add(multiply(a, b), add(multiply(a, c), multiply(b, c))), 2) 

Let's do it step by step:
Step 1: Perform the inner group of parenthesis. Then expand going out, until you reach the bigger parenthesis.

Just bear in mind that multiply() = x y
and add() = x + y


Last step: Get the final expression
( (a b) + (ac + bc) )* 2