What would be the outcome if all the parentheses are removed from the above statement?

View the Exhibit and examine the structure of the PRODUCTS table.
All products have a list price.
You issue the following command to display the total price of each product after a discount of 25%
and a tax of 15% are applied on it. Freight charges of S100 have to be applied to all the products.

What would be the outcome if all the parentheses are removed from the above statement?

View the Exhibit and examine the structure of the PRODUCTS table.
All products have a list price.
You issue the following command to display the total price of each product after a discount of 25%
and a tax of 15% are applied on it. Freight charges of S100 have to be applied to all the products.

What would be the outcome if all the parentheses are removed from the above statement?

A.
It produces a syntax error.

B.
The result remains unchanged.

C.
The total price value would be lower than the correct value.

D.
The total price value would be higher than the correct value.



Leave a Reply 7

Your email address will not be published. Required fields are marked *


Jason

Jason

why the result unchange ?though the parentheses has been move .but the 25/100*15/100 still here .I think D is correct.

trungquan710

trungquan710

Yes I think so. D must be correct

Justyna

Justyna

According to mathematics rules:
1. Calculations must be done from left to right.
2. Calculations in brackets (parenthesis) are done first. When you have more than one set of brackets, do the inner brackets first.
3. Exponents (or radicals) must be done next.
4. Multiply and divide in the order the operations occur.
5. Add and subtract in the order the operations occur.

so the result remains unchanged.

Justyna

Justyna

If we remove brackets then the expresion looks like this:

SELECT prod_name, prod_list_price – prod_list_price * 25 / 100 + prod_list_price -prod_list_price * 25 / 100 *15 / 100+100

so first is done multiplying and dividing and then adding and substracting.

Argha

Argha

Select 5000-(5000*(25/100))+(5000-(5000*(25/100))*(15/100)) +100 from dual; => 8662.5
Select 5000- 5000* 25/100 + 5000- 5000* 25/100 * 15/100 +100 from dual; => 8662.5

Argha

Argha

Answer B is correct

Daniel

Daniel

Hi,

Although I agree with all the comments above and in this case presented both calculations works same with, and without parenthesis, I think that the problem is an error with the exam statement. in case you need to calculate the total_price, query should be as follows:

product_list_price – ( product_list_price*(25/100)) + (product_list_price-(product_list_price*(25/100)))*(15/100) + 100

instead of

product_list_price – ( product_list_price*(25/100)) + (product_list_price-(product_list_price*(25/100))*(15/100)) + 100
(note the change on parenthesis )

Due to this, the result will indeed change from having parenthesis to not having parenthesis
Select 5000-(5000*(25/100))+ (5000-(5000*(25/100)))*(15/100) + 100 from dual; => 4412,5
Select 5000-5000*25/100+5000-5000*25/100*15/100 + 100 from dual; => 8662,5

product_list_price x 0.75 x1.15 +100 seems more like it for solving this total _price calculation, which would not match with the results from exam sentence

Hope it helps