week2 aq 2.1 q4

55 views
Skip to first unread message

Priyanshu Singh

unread,
Nov 17, 2020, 4:51:45 AM11/17/20
to Discussion forum for Computational Thinking
please expalin how is ans 1

Priyanshu Singh

unread,
Nov 17, 2020, 1:35:37 PM11/17/20
to Discussion forum for Computational Thinking, Priyanshu Singh
plese can anyone repyl asap

Aniruddan Iyengar

unread,
Nov 17, 2020, 1:47:38 PM11/17/20
to Discussion forum for Computational Thinking, priyanshu...@gmail.com
the flowchart takes only the first true value then it leaves the iteration .

Computational Thinking Support 2

unread,
Nov 18, 2020, 1:56:09 AM11/18/20
to Discussion forum for Computational Thinking, aniru...@gmail.com, priyanshu...@gmail.com
Hi,
Whatever Aniruddan has explained is correct. I want to add something in that.
In flowchart, Found and Count are initialized with False and 0 respectively. When we check in first decision box for the first card it becomes true both cases (Another card and not(Found) >> first card and not(False) >> first card and True >> True).
So it will go to next decision box of the Correct card? and this will be also true because in the question it is mentioned that all 10 cards satisfy the condition for the "Correct card". Then after it will go to the activity box where Found will be changed to True and Count will be incremented by 1.
Now it will return back to first decision box where it will check for second card and not(Found). Since we have now 9 cards so the first part in decision box is true. Now for second part which is not(Found) >> not(True) >> False. So first part is true but second part is false. Therefore overall it will be false and will terminate/stop the program.
Hence Count will be 1 only since it was incremented once by one. So answer will 1.

Hope your doubt is cleared if not write us again.

Regards,
Deepak
IITM Online Degree Team
Reply all
Reply to author
Forward
0 new messages