0% found this document useful (0 votes)
118 views2 pages

Quiz 1 DS

This document contains a 5 question quiz on data structures and algorithms. Question 1 has 3 parts that involve queue operations with different front and rear values. Question 2 involves stack operations with push and pop. Question 3 has 4 parts involving converting infix, prefix, and postfix notations. Question 4 involves choosing the most suitable data structure for 4 applications. Question 5 has 2 true/false questions about stack terminology.

Uploaded by

Hassaan Jamali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
118 views2 pages

Quiz 1 DS

This document contains a 5 question quiz on data structures and algorithms. Question 1 has 3 parts that involve queue operations with different front and rear values. Question 2 involves stack operations with push and pop. Question 3 has 4 parts involving converting infix, prefix, and postfix notations. Question 4 involves choosing the most suitable data structure for 4 applications. Question 5 has 2 true/false questions about stack terminology.

Uploaded by

Hassaan Jamali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

DATA STRUCTURE AND ALGORITHM

Quiz # 1

Course: Data Structures and Algorithm: Marks:10


Semester: SPRING 2021
Course Instructor: Miss Hira Farman
Student Name & ID: __________________________________________

Question 1:[3]
A. Suppose a queue is maintained with N=12 memory cells. Find the number of elements in queue if
a. FRONT = 3, REAR = 9
b. FRONT = 9, REAR = 4
c. FRONT = 4, REAR = 4

Question 2: [2]
Suppose STACK is allocated N=6 memory cell and initially STACK is empty ,or in other words, TOP=0.Find the output of the
following module.

1. Set AAA:=2 and BBB:=5.

2. Call PUSH(STACK, AAA).


Call PUSH(STACK, 4).
Call PUSH(STACK, BBB. +2).
Call PUSH(STACK,9).
Call PUSH(STACK, AAA + BBB).

3. Repeat while TOP ≠0;


Call POP(STACK,ITEM).
Write: ITEM.
[End of loop.]

4.Return.
Question 3: [0.5+0.5+0.5+0.5=2]

INFIX PREFIX POSTFIX

1. (A + B) * (C + D)

2. ((A/B-C+D)*(E-A))/C

3. ((A/(B-C+D)*(E-A)*C-D

4. (A + B) * C - (D - E) * (F + G)

Question 4:[0.5+0.5+0.5+0.5=2]

For given 1-5, indicate which structure would be a more suitable choice for each of the following applications by marking
them as follows:
A. Stack B. Queue C. Tree D. Binary search tree E. Graph

1. A bank simulation of its teller operation to see how waiting times would be affected by adding another teller. ( )
2. A program to receive data that is to be saved and processed in the reverse order. ( )
3. An electronic address book ordered by name. ( )
4. A word processor to have a PF key that causes the preceding command to be redisplayed. Every time the PF key is pressed,
the program is to show the command that preceded the one currently displayed. ( )

Question 5:[1]
Would it makes a sense to call a stack:
1. A LILO structure?
2. A FILO Structure?

You might also like