Join Telegram Channel for DXC exam Discussion & help!

Two programmers asked to write the code to evaluate the following expression:

Two programmers asked to write the code to evaluate the following expression:

a - b + c/(a-b) + (a-b)2

Pankaj writes the following code statements (Code A):

print (a-b) + c/(a-b) + (a-b)*(a-b)

Mythili writes the following code statements (Code B):

d = (a-b)

print d + c/d + d*d

If the time taken to load a value in a variable, for addition, multiplication or division

between two operands is same, which of the following is true?

Option 1 : Code A uses lesser memory and is slower than Code B

Option 2 : Code A uses lesser memory and is faster than Code B

Option 3 : Code An uses more memory and is faster than Code B

Option 4 : Code A uses more memory and is slower than Code B

Answer: Option 1

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.