Académique Documents
Professionnel Documents
Culture Documents
1
Course: DIT/ DCS
Group Work: Each Two Members
Deadline: 17th /06/2017 Before 1:00pm
Marks: 40%
Mode: Handwritten (Good Handwriting)
3
int x, y;
Show what is output by the following segment of code:
x = 4;
y = 0;
stack.push(7);
stack.push(x);
stack.push(x + 5);
y = stack.top();
stack.pop();
stack.push(x + y);
stack.push(y - 2);
stack.push(3);
x = stack.top();
stack.pop();
printf("x = %d\n", x);
printf("y = %d\n", y);
while (!stack.isEmptyStack())
{
printf("%d\n", stack.top());
stack.pop();
}
6. Evaluate the following postfix expressions:
4
x = queue.front();
queue.deleteQueue();
queue.addQueue(x + 5);
queue.addQueue(16);
queue.addQueue(x);
queue.addQueue(y - 3);
printf("Queue Elements: ");
while (!queue.isEmptyQueue())
{
printf("%d ", queue.front());
queue.deleteQueue();
}
printf("\n");