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
galben [10]
2 years ago
14

Consider the following code which deletes all the nodes in a linked list. void doublyLinkedList::destroy() { nodeType *temp; //p

ointer to delete the node while (first != nullptr) { temp = first; first = first->next; ____ } last = nullptr; count = 0; } Which of the following is the missing statement?
Computers and Technology
1 answer:
Lera25 [3.4K]2 years ago
5 0

Answer:

The answer is "delete temp;".

Explanation:

  • In the given code a class "doublyLinkedList" is defined that contains a method that is destroy(). This code uses a scope resolution operator to define the method outside the class.
  • To access this method write return type of function then class name:: (use scope resolution operator) and function name.
  • In this function, nodeType temp is a pointer variable that is used to delete the node.
  • In method definition, a loop is declared that check value that is first not equal to nullptr. which means the first node is not equal to null. In this loop, a temp variable holds the first variable value and the first variable value is holding another variable value and then use the "delete temp" statement to delete a node in the list.
  • Outside a loop, the last variable holds nullptr variable value and the count variable assigns a value that is 0.
You might be interested in
Write a loop that reads positive integers from standard input and that terminates when it reads an integer that is not positive.
Paraphin [41]

Answer:

The program to this question as follows:

Program:

#defining variable and assign value

odd=0  

even=0  

i=1  

print('Input 0 after inserting all number: ') #print message

while i>0: #define loop for check inserting and add all number

   i=int(input()) #input value by user end

   if (i< 0): #check value is not positive

       break

   if ((i % 2)==0and(i>0)): #check even number condition

       even=even+i #add even numbers

   if ((i % 2)!=0and(i>0)): #check odd number condition

       odd=odd+i #add odd numbers

print ('Sum of Even number:',even,'and','Sum of Odd number:',odd) #print value

Output:

Input 0 after inserting all number:  

1

2

3

5

7

0

Sum of Even number: 2 and Sum of Odd number: 16

 Explanation:

In the above python program, three variable is defined, that is "even, odd and i", in which "even and odd" variable assign value that is "0", and the variable i is used for inserting elements from user. In the next line a while loop is defined that inserts numbers in variable "i", in this loop, 3 if block is used that can be defined as follows:

  • In first if block variable "i", checks that value is non-positive number if this condition is true, it will break the loop.
  • In second if block this block check even number condition and add in even variable.
  • In third, if block this block check odd number condition and add in odd variable.  

End of the loop we use print function that prints the sum of even numbers and odd numbers.

3 0
2 years ago
________ is used for supervisory messages at the internet protocol layer.
Natalija [7]
"ICMP" <span>is used for supervisory messages at the internet protocol layer.
ICMP stands for </span>Internet Control Message Protocol and it refers to a supporting protocol in the Internet protocol suite. It is utilized by network devices which includes routers and these are used to send error messages and operational data showing, for instance, that asked for service which isn't accessible or that a host or switch couldn't be come to.
4 0
3 years ago
Customer A with a Bronze service level package calls in a Critical System Failure at 9:00 AM. Customer B with a Silver service l
inysia [295]
This question depends on what the service level packages have to offer as an agreement. Does this question come with a list of what the service levels have to offer?
4 0
3 years ago
Components that enhance the computing experience, such as computer keyboards, speakers, and webcams, are known as
never [62]

Answer:

- Peripheral devices

Explanation:

Peripheral devices are defined as computer devices which are not the element of the essential/basic computer function. These devices can be internal as well as external and are primarily connected to the computer for entering or getting information from the computer. For example, the keyboards or mouse functions to enter data into the computer for processing and receiving information while the output devices like speakers, projectors, printers, etc. are used to get the information out of the computer.

3 0
3 years ago
Which of te following ranges of cells is correctly named
Natasha_Volkova [10]
D it is because its .a5.g1
3 0
3 years ago
Other questions:
  • ‘The increased availability of mobile digital devices has had a positive impact on how young people use their free time’. Make a
    14·2 answers
  • Write a function named delete Letter that has 2 parameters. The first parameter is a string, the second parameter is an integer.
    11·1 answer
  • Shortcuts can help you complete spreadsheet tasks more efficiently. True False?
    7·2 answers
  • Chdtp aoxophg gr72 ae9&gt;3 zqqz
    12·1 answer
  • The _____ toolbar can be customized to the preferences of the user.
    7·1 answer
  • Managing your calendar and emails can be easily accomplished through ___ software
    8·1 answer
  • , 13 dB correspond to a power ratio of ....?
    14·1 answer
  • What is the HCF of smallest prime number and the smallest composite number?​
    12·1 answer
  • Alvin has created a non-extensive site map of all the commonly visited pages of his website. What is such a site map called?
    13·1 answer
  • This seems like a good time to ask the basic question, “How’s it going in class?” Feel free to offer constructive feedback about
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!