1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
skad [1K]
2 years ago
14

Examine the following declarations and definitions for the array-based implementations for the Stack and Queue ADTs. Assume that

exception class PushOnFullStack and class PopOnEmptyStack have been defined and are available. Read the following code segment and fill in blank #6.
class StackType
{

public:

StackType();

void Push(StackItemType item);

void Pop();

private:

int top;

ItemType items[MAX_STACK];

};

void StackType::StackType()

{

top = -1;

}

void StackType::Push(ItemType item)

{

__________________ // 1

___________________; // 2

__________________; // 3

___________________; // 4

}

class QueType

{

public:

// prototypes of QueType operations

// go here

private:

int front;

int rear;

ItemType items[MAX_QUEUE];

}

void QueType::QueType()

{

front = MAX_QUEUE - 1;

rear = MAX_QUEUE - 1;

}

Boolean QueType::IsEmpty()

{

return (rear == front);

}

void QueType::Enqueue(ItemType item)

{

____________________; // 5

____________________; // 6

}

[1] rear = (rear +1) % MAX_QUEUE
[2] items[rear] = item
[3] rear = (rear % MAX_QUEUE) + 1
[4] items[front] = item
Computers and Technology
1 answer:
otez555 [7]2 years ago
8 0

Answer:

The codes for the respective blanks are given below with appropriate comments for better understanding

Explanation:

<u>FOR 1 TO 4</u>

Void StackType::Push(ItemType item)

{

if(top == MAX_STACK - 1) // means stack is full so we need to throw the PushOnFullStack exception

throw PushOnFullStack ; // You can use this class and appropriate method to deal with exception like printing that stack is full so can not push the current item

top ++ ;// increment the top to accumulate the next item

items[top] = item; // put the item into the place identified

}

<u>FOR 5 AND 6</u>

Void Quetype::enqueue(itemType item)

{

if (rear==MAX_QUEUE && front==0) // queue is full so can not enqueue

//Handle the queue full exception here, may be print this

}else

{

items[rear] = item;

rear ++;

}

You might be interested in
The Security Development Life Cycle (SDLC) is a general methodology for the design and implementation of an information system.
navik [9.2K]

Answer:

False

Explanation:

The Security Development Life Cycle (SDLC), is a software development which involves traditional approach towards its design such as, waterfall model, Agile, etc.

It can either be referred to as a generic secure development life cycle or a specific one, such as the Microsoft SDL or the Cisco SDL.

Its phases includes,

A1 - Security Assessment

A2 - Architecture

A3 - Design and Development 1

A4 - Design and Development 2

A5 - Ship

PRSA - Post Release

Each phase talks about how a secured software is developed.

The Security Development Life Cycle (SDLC) is a general methodology for the design and implementation of an information system. This statement is false because by definition and attributes Security Development Life Cycle is a traditional approach towards software development and not a general method.

6 0
2 years ago
which two statements about incoming and outgoing interfaces in firewall policies are true? (choose two.)
Ratling [72]

The statements that are true regarding incoming and outgoing interfaces in firewall policies are:

  • A zone can be chosen as the outgoing interface.
  • -Multiple interfaces can be selected as incoming and outgoing interfaces.

<h3>What is a firewall?</h3>

A firewall is a network security device used in computing that monitors and regulates incoming and outgoing network traffic in accordance with pre-established security rules. Typically, a firewall creates a wall between a trustworthy network and an unreliable network, like the Internet.

A firewall aids in defending your network from intruders. A firewall protects your network by operating as a continuous filter that constantly scans incoming data and blocks anything that appears to be suspicious.

Therefore, the statements that are true regarding incoming and outgoing interfaces in firewall policies are:

A zone can be chosen as the outgoing interface.

-Multiple interfaces can be selected as incoming and outgoing interfaces.

Learn more about firewall on:

brainly.com/question/13693641

#SPJ1

Which statements are true regarding incoming and outgoing interfaces in firewall policies? (Choose two.)

Select one or more:

-An incoming interface is mandatory in a firewall policy, but an outgoing interface is optional.

-A zone can be chosen as the outgoing interface.

-Only the any interface can be chosen as an incoming interface.

-Multiple interfaces can be selected as incoming and outgoing interfaces.

4 0
1 year ago
Why does everyone refer to dogs as being loyal
LenKa [72]

Explanation:

Because they're like another member of the pack.

7 0
2 years ago
Read 2 more answers
Without a well-designed, accurate database, executives, managers, and others do not have access to the ____________________ they
ohaa [14]

Answer:

Information

Explanation:

Good decisions are normally based on facts which are tangible information that can be analysed to show trends of key figures such as sales, income, production that are so critical in business. A well-designed and accurate database captures and stores these figures in an organised way which will enable the information or data to be analysed to make informed decisions.

6 0
2 years ago
How to convert a .enw file into a .pdf without downloading any applications? (If I have to, then I will. Just please tell me.)
kolezko [41]

Answer: use this link :- https://www.file-extension.info/conversion/enw-to-pdf

Explanation:

7 0
2 years ago
Read 2 more answers
Other questions:
  • A/An ___ is a series of instructions or commands that computer follows used to create software
    10·2 answers
  • With which type of media are you interacting when you read an online shopping website?
    7·1 answer
  • Write a program with a loop that lets the user enter a series of positive integers. The user should enter −1 to signal the end o
    7·1 answer
  • Is 5g harmful to the body ?
    9·2 answers
  • Retraining is required at intervals of ___ or less.
    10·1 answer
  • Mac and PC .Which one is better for professional users, and why
    6·1 answer
  • (TCO C) When a remote user attempts to dial in to the network, the network access server (NAS) queries the TACACS+ server. If th
    14·1 answer
  • Name two materials that we can burn in order to get energy from biomass
    9·1 answer
  • Here is something cool
    5·2 answers
  • 3. Which part of the computer is used<br> for typing?<br> a. Mouse<br> b. Keyboard
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!