Sunday 22 April 2018

isro cs question paper solution 2018 Q6 Set-A

A data driven machine is one that executes an instruction if the needed data is available. The physical ordering of the code listing does not dictate the course of execution. Consider the following pseudo-code

(A) Multiply E by 0.5  to get F
(B) Add A and B to get E
(C) Add B with 0.5 to get D
(D) Add E and F to get G
(E) Add A with 10.5 to get C

Assume A,B,C are assigned values and the desired output is G. Which of the following sequence of execution is valid?

(a) B, C, D, A, E
(b) C, B, E, D, A
(c) A, B, C, D, E
(d) E, D, C, B, A

Correct Answer is:

E*0.5 = F
A+B=E
B+0.5==D
E+F=G
A+10.5=C

As execution is based on availability values for variables (A,B,C,D,E):

G is the output
So,
E+F=G (requires the E and F computed before this operation)

E and F computed in step (B) and (A) of the execution list (E and F are not assigned any values at start of the execution).

So, Step (B) and step (A) should be completed before step (D).

As the option (c) is satisfying the order. 

No comments:

Post a Comment

UGC NET Computer Science December 2019 | Question 16

Question 16 In a certain coding language. 'AEIOU' is written as 'TNHDZ'. Using the same coding language. 'BFJPV' wil...

Popular Posts