arrow
arrow
arrow
Observe the following flowchart and find the output.
Question

Observe the following flowchart and find the output.

A.

180

B.

120

C.

100

D.

160

Correct option is A

Step-wise Solution (As per flowchart A ≥ 20)
Information Given in Question:

  • Initial values: A = 100, S = 0
  • Condition: Is A ≥ 20?
  • If YES: S = S + A, then A = A − 40, repeat
  • If NO: Output S, Stop

All Concept/Formula Used in Question:

  • Loop executes as long as A ≥ 20
  • Update rules:

SS+A,AA40S \leftarrow S + A,\quad A \leftarrow A - 40​​
Detailed Explanation (Iteration-wise):
Iteration 1:

  • A = 100 (≥ 20)
  • S = 0 + 100 = 100
  • A = 100 − 40 = 60

Iteration 2:

  • A = 60 (≥ 20)
  • S = 100 + 60 = 160
  • A = 60 − 40 = 20

Iteration 3:

  • A = 20 (≥ 20) Condition still true because it is “≥”, not “>”
  • S = 160 + 20 = 180
  • A = 20 − 40 = −20

Iteration 4 (Check):

  • A = −20 (≥ 20) Stop and output S

Final Output: S = 180

Free Tests

Free
Must Attempt

UPTET Paper 1: PYP Held on 23rd Jan 2022 (Shift 1)

languageIcon English
  • pdpQsnIcon150 Questions
  • pdpsheetsIcon150 Marks
  • timerIcon150 Mins
languageIcon English
Free
Must Attempt

UPTET Paper 2 Social Science : PYP Held on 23rd Jan 2022 (Shift 2)

languageIcon English
  • pdpQsnIcon150 Questions
  • pdpsheetsIcon150 Marks
  • timerIcon150 Mins
languageIcon English
Free
Must Attempt

UPTET Paper 2 Maths & Science : PYP Held on 23rd Jan 2022 (Shift 2)

languageIcon English
  • pdpQsnIcon150 Questions
  • pdpsheetsIcon150 Marks
  • timerIcon150 Mins
languageIcon English
test-prime-package

Access ‘EMRS PGT’ Mock Tests with

  • 60000+ Mocks and Previous Year Papers
  • Unlimited Re-Attempts
  • Personalised Report Card
  • 500% Refund on Final Selection
  • Largest Community
students-icon
354k+ students have already unlocked exclusive benefits with Test Prime!
Our Plans
Monthsup-arrow