Warning: count(): Parameter must be an array or an object that implements Countable in /home/customer/www/thegatebook.in/public_html/qa/qa-include/qa-theme-base.php on line 177

# CO-Grand Test -Q2

Warning: count(): Parameter must be an array or an object that implements Countable in /home/customer/www/thegatebook.in/public_html/qa/qa-include/qa-theme-base.php on line 177
+1 vote

if A > B then

V[i] := F(i)

else

if B > C then

V[i] := G(i)

Assume that the values of the Boolean expressions "A > B " and "B > C " are independent and that, on the average, A > B , 75 percent of the time and B > C , 25 percent of the time. If the program segment above is executed 10,000 times, how many times would one expect the functions F and G to be executed?

(A) F : 2,500, G : 18,750

(B) F : 7,500, G : 625

(C) F : 7,500, G : 1,875

(D) F : 7,500, G : 2,500

reshown Jun 18, 2020

The values of the Boolean expressions "A > B " and "B > C " are independent.

On the average, A > B , 75 percent of the time and B > C , 25 percent of the time.

If the program segment above is executed 10,000 times, how many times would one expect the functions F and G to be executed?

If the program segment above is executed 10,000 times then as we are given that A > B , 75 percent of the time. F will execute when A>B.

So, F will execute (0.75)*(10,000) = 7500.

But G will execute when two things happen simultaneously : (A>B) fails AND (B>C) becomes true.

So, G will execute (0.25)*(0.25)*(10,000) = 625.

If you have answered option D then mistake is that you only considered B>C But Not considered A>B.

answered Jun 18, 2020 by (226,240 points)