Docsity

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

Toggle sidebar
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