Quiz #3 in CS2143-2144 Data Structures Spring 2012, Exercises of Data Structures and Algorithms

The instructions and conditions for quiz #3 in the cs2143-2144 data structures spring 2012 course. Students are required to identify the status of a queue based on given conditions involving the queue's flags in and out, and the flag of. The document also includes the queue class definition.

Typology: Exercises

2011/2012

Uploaded on 07/11/2012

dharanidhar
dharanidhar 🇮🇳

4.2

(6)

58 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS2143-2144 Data Structures Spring 2012
Quiz # 3(1 March 2012)
Time 10 Minutes
Max. Marks 10
Name: Reg. No: ___
For the following queue class, identify the status of queue, i.e., Empty, Full, OF will be
set to 1 and OF will be set to 0, under the following conditions: the flag OF will behave
as discussed in the last class, i.e., in the start it will be 0, when in passes the size and out
is not at first location, it will be 1. When in and out comes to same location it will again
become 0. Is there some condition missing as per your implementation in the assignment
7? Point it out.
1. if(out==0 && in==size)
2. if(in==out && OF ==1)
3. if(in==size && out!=0)
4. if(in==size && out==size)
5. if(out==in && OF ==0)
6. if(out==size && OF ==1)
class queue
{
protected:
char *p;
int size;
int in;
int out;
int OF;
public:
queue(int s);
void input(char x);
char output();
};
Docsity.com

Partial preview of the text

Download Quiz #3 in CS2143-2144 Data Structures Spring 2012 and more Exercises Data Structures and Algorithms in PDF only on Docsity!

CS2143-2144 Data Structures Spring 2012 Quiz # 3(1 March 2012) Time 10 Minutes Max. Marks 10

Name: Reg. No: ___

For the following queue class, identify the status of queue, i.e., Empty, Full, OF will be set to 1 and OF will be set to 0 , under the following conditions: the flag OF will behave as discussed in the last class, i.e., in the start it will be 0, when in passes the size and out is not at first location, it will be 1. When in and out comes to same location it will again become 0. Is there some condition missing as per your implementation in the assignment 7? Point it out.

  1. if(out==0 && in==size)
  2. if(in==out && OF ==1)
  3. if(in==size && out!=0)
  4. if(in==size && out==size)
  5. if(out==in && OF ==0)
  6. if(out==size && OF ==1)

class queue { protected: char *p; int size; int in; int out; int OF; public: queue(int s); void input(char x); char output(); };

Docsity.com