ISRO Computer Science (CSE) 2023 - Question 23

All ISRO Computer Science (CSE) papers | ISRO Computer Science (CSE) 2023

Topic: Data Structures

The prefix expression is -+abc+d*ef. Evaluate the expression for a=10, b=2, c=5, d=3, e=4, f=1

  • A. 3
  • B. 4
  • C. 10
  • D. 6

Answer: C. 10

Explanation: This prefix evaluation contains a slight typo typical in ISRO papers where `+abc` represents the sum of three operands: `+ a b c`. The expression is evaluated as: `- (+ a b c) (+ d (* e f))`.
Substituting the values: `+ 10 2 5` = 17.
For the second part: `* 4 1` = 4, `+ 3 4` = 7.
Finally, `- 17 7` = 10.

| | All questions of ISRO Computer Science (CSE) 2023