GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Placement Papers  >  TCS  >  COBOL

 Print  |  
Question:  COMPUTE X = A * B - C * D and
COMPUTE X = (A * B) - (C * D)
(a) Are not the same
(b) Are same
(c) Syntactically wrong
(d) Will yield a run time error




August 08, 2006 05:51:43 #1
 Mayuresh   Member Since: Visitor    Total Comments: N/A 

RE: COMPUTE X = A * B - C * D and COMPUTE X = (A ...
 
Both are same here.Since the computation takes place based on precedence,here ' * ' has higher precedence over ' - 'therefore first A * B will be calculated and then C * D and finally second quantity will be subtracted from first . In second case exactly the same things are happening as ( ) has higher precedence over any of the operators.
     

 

Back To Question