Question 1 |

The goal of structured programming is to

have well indented programs | |

be able to infer the flow of control from the compiled code | |

be able to infer the flow of control form the program text | |

avoid the use of GOTO statements |

Question 1 Explanation:

Question 2 |

Consider the following C function

```
void swap (int a, int b)
{
int temp;
temp = a;
a = b;
b = temp;
}
```

In order to exchange the values of two variables x and y.call swap (x, y) | |

call swap (&x, &y) | |

swap (x,y) cannot be used as it does not return any value | |

swap (x,y) cannot be used as the parameters are passed by value |

Question 2 Explanation:

Question 3 |

A single array A[1...MAXSIZE] is used to implement two stacks. The two stacks grow from opposite
ends of the array. Variables top1 and top 2 (top1 \lt top 2) point to the location of the topmost
element in each of the stacks. If the space is to be used efficiently, the condition for "stack full" is

(top1 = MAXSIZE/2) and (top2 = MAXSIZE/2+1) | |

(top1 + top2 = MAXSIZE | |

(top1 = MAXSIZE/2) or (top2 = MAXSIZE) | |

top1 = top2 -1 |

Question 3 Explanation:

Question 4 |

The following numbers are inserted into an empty binary search tree in the given order: 10, 1, 3, 5,
15, 12, 16. What is the height of the binary search tree (the height is the maximum distance of a leaf
node from the root)?

2 | |

3 | |

4 | |

6 |

Question 4 Explanation:

Question 5 |

The best data structure to check whether an arithmetic expression has balanced parentheses is a

queue | |

stack | |

tree | |

list |

Question 5 Explanation:

There are 5 questions to complete.