## Question 1 Given the following list of dependencies, what is the order of compilation of classes? Select all that apply. dependencies = [A, B], [B, C], [A, D] ### Options 1. [A, B, C, D] Incorrect ---------------------------- 2. [C, A, B, D] Incorrect ---------------------------- 3. [C, B, D, A] Correct According to the dependency pairs, A is dependent on B, and B is dependent on C. Hence, A should come after B, and B should come after C. A is also dependent on D, which means it should also come after D. This order of compilation satisfies all these conditions. ---------------------------- 4. [D, C, B, A] Correct According to the dependency pairs, A is dependent on B, and B is dependent on C. Hence, A should come after B, and B should come after C. A is also dependent on D, which means it should also come after D. However, since D shares no relationship with C and B, it can execute in any order with respect to classes C and B as long as the given dependencies are satisfied. Hence, this order of compilation is also correct. ---------------------------- --------------------------------------------- ## Question 2 Given the following list of dependencies, what is the order of compilation of classes? Select all that apply. dependencies = [A, B], [B, C], [C, D] ### Options 1. [D, C, B, A] Correct According to the dependency pairs, A is dependent on B, B is dependent on C, and C is dependent on D. Hence, A should come after B, B should come after C, and C should come after D. This order of compilation satisfies all these conditions. ---------------------------- 2. [A, B, C, D] Incorrect ---------------------------- 3. [A, C, D, B] Incorrect ---------------------------- 4. [A, D, B, C] Incorrect ---------------------------- --------------------------------------------- ## Question 3 Given the following list of dependencies, what is the order of compilation of classes? Select all that apply. dependencies = [W, X], [X, Z], [Z, Y], [Y, X] ### Options 1. [Y, X, W, Z] Incorrect ---------------------------- 2. [W, X, Y, Z] Incorrect ---------------------------- 3. [X, Y, Z, W] Incorrect ---------------------------- 4. None of the above Correct There's a cycle in the graph; hence, no topological order exists. ---------------------------- ---------------------------------------------