Which statement must be included in a program in order touse a deque container?a. #include vector

b. #include

c. #include container

d. #include deque

Answers

Answer 1
Answer:

Answer:

d.#include deque

Explanation:

We have to include deque library in order to use a deque container and the syntax to include is #include<deque>.Deque is a double ended queue which is a sequence container and allows operations of contraction and expansion on both ends of the queue.Double ended queues are a special case of simple queue since in simple queue the insertion is from rear end and deletion is from front end but in deque insertion and deletion is possible at both ends rear and front.


Related Questions

g Write a line of code to invoke a function named RandNum, which accepts no parameters, and storing the return value in a variable called num (which has already been defined). Separate each item with 1 space (except around the parentheses), and end the line with a semi-colon.
What is copyright and what are your thoughts on it?
viewRatings(string, int) Takes a username and a minimum rating value. It prints all the books that the user has rated with a value greater than or equal to the minimum rating value. The function does not return anything.
Write a function in Matlab which takes as input an integer x and as output returns the biggest prime number that is less than or equal to x. For example, if the input is 7, the output would be 7. If the input is 40, the output would be 37. (Reminder: isprime.)
How can we make our programs behave differently each time they are run?

The function changeLocation is also called a _____.class bike:
def __init__(self,size,idNum,color ):
self.size = size
self.location = 10
self.color = color
self.idNum = idNum

def changeLocation(self,newLocation):
self.location = newLocation


manipulator

initiator

method

constructor

Answers

Answer:

The answer is a method

Explanation:

Answer:

class and self

Explanation:

class Bike:

def __init__(self, str, float):

self.color = str

self.price = float

"Packet switches have multiple links attached to them. For each attached link the packet switch has a/an ____________, which stores packets that the router is about to send into that link."link buffer

access buffer

output buffer

transmission buffer

none of the above

Answers

Answer: Output buffer

Explanation:

Each packet switches contain multiple links which are attached to it and for individually attached link the output buffer basically store packets. Then, the router send these packets into multiple links.

In output buffer, if the packets are transmitted into the links but it finds that the link is busy with the another packet for transmission. Then, that particular packet needs to be wait in output buffer.

Therefore, the output buffer is the correct option.

If you have a list consisting of just numbers, then you can add all of the values in the list using the sum() function. If your list consists of some numbers and some values of other types (e.g., lists, strings, sets), the sum() function will fail. In this question, we're asking you to write a function that will sum all of the numbers in a list, ignoring the non-numbers. The function below takes one parameter: a list of values (value_list) of various types.


The recommended approach for this:

(1) create a variable to hold the current sum and initialize it to zero,

(2) use a for loop to process each element of the list,

(3) test each element to see if it is an integer or a float, and, if so, add its value to the current sum,

(4) return the sum at the end.


student.py 1


Hef sum_lengths(value_list):

# Implement your function here. Be sure to indent your code block! Restore original file

Answers

Answer:

See explaination

Explanation:

def sum_lengths(value_list):

total = 0

for x in value_list:

if (type(x)==int) or (type(x)==float):

total += x

return total

Seasons Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month and an int to represent the day. Ex: If the input is April 11, the output is: spring In addition, check if the string and int are valid (an actual month and day). Ex: If the input is invalid, the output is: invalid The dates for each season are: spring: March 20 - June 20 summer: June 21 - September 21 autumn: September 22 - December 20 winter: December 21 - March 19

Answers

Answer:

#include <iostream>

#include <string>

using namespace std;

int main() {

   string inputMonth;

   int inputDay;

   cin >> inputMonth >> inputDay;

   if (inputMonth == "January" && inputDay >= 1 && inputDay <= 31)

       cout << "Winter" << endl;

   else if (inputMonth == "February" && inputDay >= 1 && inputDay <= 29)

       cout << "Winter" << endl;

   else if (inputMonth == "April" && inputDay >= 1 && inputDay <= 30)

       cout << "Spring" << endl;

   else if (inputMonth == "May" && inputDay >= 1 && inputDay <= 30)

       cout << "Spring" << endl;

   else if (inputMonth == "July" && inputDay >= 1 && inputDay <= 31)

       cout << "Summer" << endl;

   else if (inputMonth == "August" && inputDay >= 1 && inputDay <= 31)

       cout << "Summer" << endl;

   else if (inputMonth == "October" && inputDay >= 1 && inputDay <= 31)

       cout << "Autumn" << endl;

   else if (inputMonth == "November" && inputDay >= 1 && inputDay <= 30)

       cout << "Autumn" << endl;

   else if (inputMonth == "March" && inputDay >= 20 && inputDay <= 31)

       cout << "Spring" << endl;

   else if (inputMonth == "June" && inputDay >= 1 && inputDay <= 20)

       cout << "Spring" << endl;

   else if (inputMonth == "June" && inputDay >= 21 && inputDay <= 30)

       cout << "Summer" << endl;

   else if (inputMonth == "September" && inputDay >= 1 && inputDay <= 21)

       cout << "Summer" << endl;

   else if (inputMonth == "September" && inputDay >= 22 && inputDay <= 30)

       cout << "Autumn" << endl;

   else if (inputMonth == "December" && inputDay >= 0 && inputDay <= 20)

       cout << "Autumn" << endl;

   else if (inputMonth == "December" && inputDay >= 21 && inputDay <= 30)

       cout << "Winter" << endl;

   else if (inputMonth == "March" && inputDay >= 1 && inputDay <= 19)

       cout << "Winter" << endl;

   else

       cout << "Invalid" << endl;

   return 0;

}

Answer:

FOR PYTHON!!

input_month = input()

input_day = int(input())

months= ('January', 'February','March', 'April' , 'May' , 'June' , 'July' , 'August' , 'September' , "October" , "November" , "December")

if not(input_month in months):

   print("Invalid")

elif input_month == 'March':

   if not(1<=input_day<=31):

       print ("Invalid")

   elif input_day<=19:

       print("Winter")

   else:

       print ("Spring")

elif input_month == 'April' :

   if not(1<=input_day<=30):

       print("Invalid")

   else:

       print("Spring")

elif input_month == 'May':

   if not(1<=input_day<=31):

       print("Invalid")

   else:

       print("Spring")

elif input_month == 'June':

   if not(1<=input_day<=30):

       print("Invalid")

   elif input_day<=20:

       print ("Spring")

   else:

       print("Summer")

elif input_month == 'July':

   if not(1<=input_day<=31):

       print("Invalid")

   else:  

       print("Summer")

       

elif input_month == 'August':

   if not(1<=input_day<=31):

       print("Invalid")

   else:  

       print("Summer")

elif input_month == 'September':

   if not(1<=input_day<31):

       print("Invalid")

   elif input_day<=21:

       print ("Summer")

   else:

       print ("Autumn")

elif input_month == "October":

   if not(1<=input_day<=31):

       print("Invalid")

   else:

       print("Autumn")

elif input_month == "November":

   if not(1<=input_day<=30):

       print("Invalid")

   else:

       print ("Autumn")

elif input_month == "December":

   if not(1<=input_day<=31):

       print("Invalid")

   elif input_day <=20:

       print ("Autumn")

   else:

       print ("Winter")

elif input_month == 'January':

   if not(1<=input_day<=31):

       print("Invalid")

   else:

       print("Winter")

elif input_month == "February":

   if not(1<=input_day<=29):

       print("Invalid")

   else:

       print ("Winter")

Explanation:

Good luck in the rest of your class!

Arrange the following units of storage in descending
order. B, TB,KB, GB,MB

Answers

Answer:

TB,GB,MB,KB,B

Explanation:

Write a program to provide information on the height of a ball thrown straight up into the air. The program should request as input the initial height, h feet, and the initial velocity, v feet per second. The height of the ball after t seconds is

Answers

Answer:

The height of the ball after t seconds is h + vt - 16t 2 feet:

def main():

getInput()

def getInput():

h = int(input("Enter the initial height of the ball: ")) # Adding the int keyword before input() function

v = int(input("Enter the initial velocity of the ball: ")) # Same as above

isValid(h,v)

def isValid(h,v):

if ((h <= 0) or (v <= 0)):

print("Please enter positive values")

getInput()

else:

maxHeight(h,v)

def maxHeight(h,v):

t = (v/32)

maxH = (h + (v*h) - (16*t*t))

print ("\nMax Height of the Ball is: " + str(maxH) + " feet")

ballTime(h, v)

def ballTime(h,v):

t = 0

ballHeight = (h + (v*t) - (16*t*t))

while (ballHeight >= 0):

t += 0.1

ballHeight = (h + (v*t) - (16*t*t))

print ("\nThe ball will hit the ground approximately after " + str(t) + " seconds")

# Driver Code

main()

Answer:

I am writing a python code.

def getInput():

   h = int(input("enter the height: "))

   v = int(input("enter the velocity: "))

   isValid(h,v)    

def isValid(h,v):

   if (h<= 0 or v<=0):

       print("not positive ")            

   else:

       height = maximumHeight(h,v)

       print("maximum height of the ball is", height," ft.")

       balltime = ground_time(h,v)

       print("The ball will hit the ground after", balltime, "s approximately.")

def maximumHeight(h,v):

   t = (v/32)

   maxheight = (h + (v*t) - (16*t*t))

   return maxheight    

def ground_time(h,v):

   t = 0.1

   while(True):

       heightofball = (h + (v*t) - (16*t*t))

       if (heightofball <= 0):

           break

       else:

           t += 0.1  

   return t

Explanation:

There are four functions in this program.

getInput() function is used to take input from the user which is height and velocity. h holds  the value of height and v holds the value of velocity. input() function is used to accept values from the user.

isValid() function is called after the user enters the value of height and velocity. This function first checks if the value of height and velocity is less than 0. If it is true the message not positive is displayed. If its false then maximumHeight() is called which returns the maximum height of the ball and function ground_time() is called to return the time when the ball will hit the ground.

maximumHeight() function first divides the value of velocity with 32 as the ball will reach its maximum  height after v/32 seconds. It then returns the maximum height by using the formula:  heightofball = (h + (v*t) - (16*t*t)).

ground_time() calculates the time the ball takes to reach the ground. There is a while loop to height after every 0.1 second and determine when the height is no longer a positive. It uses (h + (v*t) - (16*t*t)) formula to calculate the height and when the value of height gets less than or equal to 0 the loop terminates otherwise it keeps calculating the height while adding 1 to the value of t at each iteration. After the loop breaks, it returns the value of t.

To see the output of the maximum height and time taken by ball to reach the ground, you can call the getInput() function at the end of the above program as:

getInput()

Output:

enter the height: 9

enter the velocity: 10

maximum height of the ball is 10.6525  ft.

the ball will hit the ground after 1.2 s approximately.