GATE 2006
191 questions
MCQ 1911-mark 191
Questions 186–190 of 191
A software project has four phases P1, P2, P3 and P4. Of these phases, P1 Is the first one and needs to be completed before any other phase can commence. Phases P2 and P3 can be executed in parallel. Phase P4 cannot commence until both P2 and P3 are completed. The optimistic, most likely, and pessimistic estimates of the phase completion times in days, for Pl, P2, P3 and P4 are, respectively, (11, 15, 25), (7, 8, 15), (8, 9, 22), and (3, 8, 19). The critical path for the above project and the slack of P2 are, respectively,
Answer: (C)
Expected time of each phase: , with optimistic, most likely and pessimistic.
P1:
P2:
P3:
P4:
P1 comes first, P4 comes last, and P2 and P3 run in parallel.
Path P1-P2-P4: days.
Path P1-P3-P4: days.
The longest path is the critical path: P1-P3-P4 (36 days).
Slack of P2 = critical path length minus the length of the path through P2 = days.
Answer: (C)
P1:
P2:
P3:
P4:
P1 comes first, P4 comes last, and P2 and P3 run in parallel.
Path P1-P2-P4: days.
Path P1-P3-P4: days.
The longest path is the critical path: P1-P3-P4 (36 days).
Slack of P2 = critical path length minus the length of the path through P2 = days.
Answer: (C)
void swap(float* A1, float* A2)
{
float temp;
if (*A1 = = *A2) return;
temp = *A1;
*A1 = *A2;
*A2 = temp;
return;
}The program volume for the above module using Halstead's method is
Answer: (B)
Count only the statements in the body. The declaration
,
,
Length:
Vocabulary:
Volume:
Answer: (B)
float temp, the parameter list, ;, braces and () are not counted.| Operator | Frequency |
|---|---|
| if | 1 |
| * | 6 |
| == | 1 |
| return | 2 |
| = | 3 |
| Operand | Frequency |
|---|---|
| temp | 2 |
| A1 | 3 |
| A2 | 3 |
Length:
Vocabulary:
Volume:
Answer: (B)
Consider the following structure chart diagram. The boxes have function names embedded in them, while the variables are indicated along the arcs.
Given below are a set of statements relevant to the above diagram.
I. F3 and F6 can be in the same module.
II. F4 and F6 can be in the same module.
III. A4 is both an output and a control variable.
IV. It is incorrect to pass A1 as data and use it as a control variable.
Which combination of these statements is TRUE?
Given below are a set of statements relevant to the above diagram.
I. F3 and F6 can be in the same module.
II. F4 and F6 can be in the same module.
III. A4 is both an output and a control variable.
IV. It is incorrect to pass A1 as data and use it as a control variable.
Which combination of these statements is TRUE?
Answer: (B)
In the structure chart an open circle on an arrow marks a data item and a filled circle marks a control item (flag).
III is false. A4 has an open circle, so it is data going from F3 up to F1. It is an output but not a control variable.
I is true. F6 is called only by F3, so it is a private helper of F3 and the two can be placed in one module.
II is false. F4 is called from both F2 and F3, so it is a shared module; F6 belongs only to F3, so they do not belong together.
IV is true. A1 is passed as data (open circle) and is also used on the loop at F2. A variable should be either data or control, not both, so using A1 in both ways is incorrect.
So I and IV are true.
Answer: (B)
III is false. A4 has an open circle, so it is data going from F3 up to F1. It is an output but not a control variable.
I is true. F6 is called only by F3, so it is a private helper of F3 and the two can be placed in one module.
II is false. F4 is called from both F2 and F3, so it is a shared module; F6 belongs only to F3, so they do not belong together.
IV is true. A1 is passed as data (open circle) and is also used on the loop at F2. A variable should be either data or control, not both, so using A1 in both ways is incorrect.
So I and IV are true.
Answer: (B)
A software program consists of two modules and that can fail independently, but never simultaneously. The program is considered to have failed if any of these modules fails. Both the modules are 'repairable' and so the program starts working again as soon as the repair is done. Assume that the mean time to failure (MTTF) of is with a mean time to repair (MTTR) of . The MTTF of is with an MTTR of . What is the availability of the overall program given that the failure and repair times are all exponentially distributed random variables?
Answer: (D)
M1 and M2 never fail together, so the program is in one of three states: working, M1 under repair, or M2 under repair.
M1 fails at rate and is repaired at rate . M2 fails at rate and is repaired at rate .
In steady state, flow into and out of each repair state balances. Let be the probability of the working state. Then
, and similarly .
The probabilities add to 1: .
Availability .
(A) can exceed 1 and (B) goes to 0 when repairs are instant, so neither is an availability. (C) has and where the balance equations give and .
Answer: (D)
M1 fails at rate and is repaired at rate . M2 fails at rate and is repaired at rate .
In steady state, flow into and out of each repair state balances. Let be the probability of the working state. Then
, and similarly .
The probabilities add to 1: .
Availability .
(A) can exceed 1 and (B) goes to 0 when repairs are instant, so neither is an availability. (C) has and where the balance equations give and .
Answer: (D)
With respect to software testing, consider a flow graph G with one connected component. Let E be the number of edges, N be the number of nodes, and P be the number of predicate nodes of G. Consider the following four expressions:
I. E - N + P
II. E - N + 2
III. P + 2
IV. P + 1
The cyclomatic complexity of G is given by
I. E - N + P
II. E - N + 2
III. P + 2
IV. P + 1
The cyclomatic complexity of G is given by
Answer: (C)
Cyclomatic complexity of a flow graph with one connected component:
(this is II), where E is the number of edges and N the number of nodes.
Each predicate node (a decision with two outgoing edges) adds one more independent path to the single path through the program. So (this is IV), where P is the number of predicate nodes.
I, , is wrong. It matches only when . III, , is one more than the correct value.
So V(G) is given by II or IV.
Answer: (C)
(this is II), where E is the number of edges and N the number of nodes.
Each predicate node (a decision with two outgoing edges) adds one more independent path to the single path through the program. So (this is IV), where P is the number of predicate nodes.
I, , is wrong. It matches only when . III, , is one more than the correct value.
So V(G) is given by II or IV.
Answer: (C)