Write a program that first reads in the name of an input file and then reads the input file using the file.readlines() method. The input file contains an unsorted list of number of seasons followed by the corresponding TV show. Your program should put the contents of the input file into a dictionary where the number of seasons are the keys, and a list of TV shows are the values (since multiple shows could have the same number of seasons).
Sort the dictionary by key (least to greatest) and output the results to a file named output_keys.txt, separating multiple TV shows associated with the same key with a semicolon (;). Next, sort the dictionary by values (alphabetical order), and output the results to a file named output_titles.txt.
Ex: If the input is:
file1.txt
and the contents of file1.txt are:
20
Gunsmoke
30
The Simpsons
10
Will & Grace
14
Dallas
20
Law & Order
12
Murder, She Wrote
the file output_keys.txt should contain:
10: Will & Grace
12: Murder, She Wrote
14: Dallas
20: Gunsmoke; Law & Order
30: The Simpsons
and the file output_titles.txt should contain:
Dallas
Gunsmoke
Law & Order
Murder, She Wrote
The Simpsons
Will & Grace
Note: There is a newline at the end of each output file, and file1.txt is available to download.
currently, my code is:
def readFile(filename):
dict = {}
with open(filename, 'r') as infile:
lines = infile.readlines()
for index in range(0, len(lines) - 1, 2):
if lines[index].strip()=='':continue
count = int(lines[index].strip())
name = lines[index + 1].strip()
if count in dict.keys():
name_list = dict.get(count)
name_list.append(name)
name_list.sort()
else:
dict[count] = [name]
return dict
def output_keys(dict, filename):
with open(filename,'w+') as outfile:
for key in sorted(dict.keys()):
outfile.write('{}: {}\n'.format(key,';'.join(dict.get(key))))
print('{}: {}\n'.format(key,';'.join(dict.get(key))))
def output_titles(dict, filename):
titles = []
for title in dict.values():
titles.extend(title)
with open(filename,'w+') as outfile:
for title in sorted(titles):
outfile.write('{}\n'.format(title))
print(title)
def main():
filename = input()
dict = readFile(filename)
if dict is None:
print('Error: Invalid file name provided: {}'.format(filename))
return
output_filename_1 ='output_keys.txt'
output_filename_2 ='output_titles.txt'
output_keys(dict,output_filename_1)
print()
output_titles(dict,output_filename_2)
main()
The problem is that when I go to submit and the input changes, my output differs.
Output differs. See highlights below. Special character legend Input file2.txt Your output 7: Lux Video Theatre; Medium; Rules of Engagement 8: Barney Miller;Castle; Mama 10: Friends; Modern Family; Smallville;Will & Grace 11: Cheers;The Jeffersons 12: Murder, She Wrote;NYPD Blue 14: Bonanza;Dallas 15: ER 20: Gunsmoke; Law & Order; Law & Order: Special Victims Unit 30: The Simpsons Expected output 7: Rules of Engagement; Medium; Lux Video Theatre 8: Mama; Barney Miller; Castle 10: Will & Grace; Smallville; Modern Family; Friends 11: Cheers; The Jeffersons 12: Murder, She Wrote; NYPD Blue 14: Dallas; Bonanza 15: ER 20: Gunsmoke; Law & Order; Law & Order: Special Victims Unit 30: The Simpsons

Answers

Answer 1

Answer:

Explanation:

The following is written in Python. It creates the dictionary as requested and prints it out to the output file as requested using the correct format for various shows with the same number of seasons.The output can be seen in the attached picture below.

mydict = {}

with open("file1.txt", "r") as showFile:

 for line in showFile:

   cleanString = line.strip()

   seasons = 0

   try:

       seasons = int(cleanString)

       print(type(seasons))

   except:

       pass

   if seasons != 0:

       showName = showFile.readline()

       if seasons in mydict:

           mydict[seasons].append(showName.strip())

       else:

           mydict[seasons] = [showName.strip()]

f = open("output.txt", "a")

finalString = ''

for seasons in mydict:

   finalString += str(seasons) + ": "

   for show in mydict[seasons]:

       finalString += show + '; '

   f.write(finalString[:-2] + '\n')

   finalString = ''

f.close()

Write A Program That First Reads In The Name Of An Input File And Then Reads The Input File Using The

Related Questions

Viết chương trình kiểm tra số nguyên dương N có phải là số nguyên tố không?

Answers

Could you say that in English please? I can try helping

Write a c++ program to find;
(I). the perimeter of rectangle.
(ii). the circumference of a circle.

Note:
(1). all the programs must allow the user to make his input .
(2).both programs must have both comment using the single line comment or the multiple line comment to give description to both programs.​

Answers

Answer:

Perimeter:

{ \tt{perimeter = 2(l + w)}}

Circumference:

{ \tt{circumference = 2\pi \: r}}

Just input the codes in the notepad

The following program generates an error. Why? #include #include using namespace std; class Arcade { public: Arcade(); Arcade(string name, int r); void Print(); private: string arcName; int rating; }; Arcade:: Arcade() { arcName = "New"; rating = 1; } Arcade:: Arcade(string name, int r) { arcName = name; rating = r; } void Arcade:: Print() { cout << "Name is: " << arcName << endl; cout << "Rating is: " << rating << " stars" << endl; } int main() { Arcade myArc(Games Ablaze, 5); myArc.Print(); }

Answers

Answer:

The object creation should be Arcade myArc("Games Ablaze",5);

Explanation:

Required

Why does the program generate an error?

The class definition is correctly defined and implemented;

The methods in the class are also correctly defined and implemented.

The error in the program is from the main method i.e.

int main() {  

       Arcade myArc('ames Ablaze, 5);  

       myArc.Print();  

   }

In the class definition;

Variable name was declared as string and variable rating was declared as integer

This means that, a string variable or value must be passed to name and an integer value or variable to rating.

Having said that:

Arcade myArc(Games Ablaze, 5); passes Games Ablaze as a variable to th function.

Game Ablaze is an incorrect string declaration in C++ because of the space in between Game and Ablaze

Also, no value has been assigned to the variable (assume the variable definition is correct).

This will definitely raise an error.

To correct the error, rewrite the object creation as:

Arcade myArc("Games Ablaze",5); where "Game Ablaze" is passed as string

Determine the following information about each value in a list of positive integers.
a. Is the value a multiple of 7, 11, or 13?
b. Is the sum of the digits odd or even?
c. Is the value a prime number?

You should write a function named test7_11_13 with an integer input parameter and three type int output parameters (aka pointers) that send back the answers to these three questions. If the integer is evenly divisible by 7, 11 or 13, its respective output parameter should be set to 1, otherwise zero. Some sample input data might be:

104 3773 13 121 77 30751

Answers

Answer and Explanation:

Using Javascript:

test7_11_13(num){

If(num%7===0||num%11===0||num%13===0){

Console.log("yes it is a multiple of 7,11 or 13");

}

else{

Console.log("It is not a multiple of any of the numbers");

}

function(num){

var makeString= num.toString();

var splitString= makeString.split("");

var makeNumber= splitString.map(Number());

var New_number= makeNumber.reduce(function(a, b) {

return a+b};,0)

}

If(New_number%2===0){

Console.log("it's an even number");

}

else{

Console.log("it's an odd number")

}

If(num%2===0||num%3===0||num%5===0||num%7===0||num%11===0){

console.log("it's not a prime number");

}

else{

console.log("it's a prime number");

}

}

From the above we have used javascript if..else statements to test the conditions for each question and output the answer to the console using console.log(). In the last part for prime number, you could also choose to use else if statements(if,else if, else if) to test the value of the num parameter and output if it's a prime number.

After the explosion of the Union Carbide plant the fire brigade began to spray a curtain of water in the air to knock down the cloud of gas.a. The system of water spray pipes was too high to helpb. The system of water spray pipes was too low to helpc. The system of water spray pipes broked. The system of water spray pipes did not have sufficient water supply

Answers

Answer:

d. The system of water spray pipes did not have sufficient water supply

Explanation:

The Union Carbide India Ltd. was chemical factory situated at Bhopal that produces various pesticides, batteries, plastics, welding equipment, etc. The plant in Bhopal produces pesticides. In the year 1984, on the night of 2nd December, a devastating disaster occurred on the Bhopal plant which killed millions of people due to the leakage of the poisonous, methyl isocyanate. This disaster is known as Bhopal Gas tragedy.

Soon after the gas pipe exploded, the fire brigade started spraying water into the air to [tex]\text{knock down}[/tex] the cloud of the gases in the air but there was not sufficient amount of water in the water sprays and so it was not effective.

Thus the correct answer is option (d).

Alex, a web designer, is assigned the task of creating a mobile device-friendly website for a leading fashion outlet called AllStyles. A desktop version of AllStyles's website already exists. Alex can refer to this desktop version of the website to create the mobile website design The desktop version of the website contains a long list of hyperlinks and this can obstruct the view of the main content when Viewed from a mobile device. Which of the following should Alex use to hide this long list of hypertext links so that it appears only in response to a tap of a major heading in the navigation list?
a. Navigator menus
b. Pulldown menus
c. Pop-up links
d. Header links

Answers

Answer: Pulldown menus

Explanation:

Pulldown menus refer to the graphical control element, that is identical to a list box, which enables user to be bake to select one value from a list.

They're regarded as the menu of options that will appear when an item is selected with a mouse. In this case, the item that the user selected will show at the top of the display screen, while the menu appears will show below it.

Therefore, Alex should use the pulldown menus to hide the long list of hypertext links so that it appears only in response to a tap of a major heading in the navigation list.

How is an API different from a web application?

Answers

Answer:

Web services (web application) are an API type to be accessed via a network connection. While APIs are application interfaces, this means standardized communication between one application and another application.

Explanation:

Web service is used for communication with REST, SOAP, and XML-RPC.

        While API for all communication styles is used.

The APIs are all web services. Whereas web services are not APIs.The Web application has no lightweight design, needs a SOAP agreement for sending or receiving system information. While the architecture is lightweight, API is useful for gadgets with limited transmission capacities like smartphones.The web application supports the HTTP protocol only. Whereas the API HTTP/s protocol supports: URL Request / Answer Header etc.The web application is not open source, but any customer who contains XML can devour it. While API  is open-source and has a .net framework.

Create a file named A10.java. Place all your code in this file. Create a publicstatic ArrayList of integers named intList.
Define a public static method addNumber(int i) that adds ito your list.
Exercise 2
Create a publicstatic HashMap of integers,integers namedintMap.
Define a public static method addPair(int i,int j) that adds i,jto your HashMap (make ithe key and j the value).

Answers

Explanation:

The file named as A10.java has been attached to this response. It contains the source code for the exercises. The source code contains comments explaining important parts of the code.

A few things to note;

i. To add an item to an arraylist, the add() method is used. For example to add an integer 7 to the arraylist named intList, simply write;

intList.add(7);

ii. To add an item to a hashmap, the put() method is used. The put method receives two parameters which are the key and value respectively. The key is a form of identifier used to store or retrieve a particular value in a hashmap. To store an integer 8 with a key of 5 in a hashmap named intMap, for example, simply write;

intMap.put(5,8);

which feature of organisations to manage needs to know about to build and use information system successfully

Answers

The correct answer to this open question is the following.

The feature of organizations to manage needs to know about to build and use information system successful is the following.

Managers of successful organizations should know that companies have hierarchies and different structures in which these companies are organized.

Every company use systems and procedures that could be specialized to the degree the company requires. For that system to function, they have to be perfectly interconnected to all the areas of the company. The goal: to maximize efficiency and accomplish the goals.

Systems and procedures should take into consideration the culture and diversity of the workplace. There are interest groups in every organization that have special characteristics and requirements that have to be taken into consideration to create a much better system.

Good managers must be aware of these elements, and the different roles, goals, management styles, tasks, incentives, and departmental structure of the company so the system can better serve the purpose of the entire organization.

6.23 LAB: Convert to binary - functions Instructor note: This is a lab from a previous chapter that now requires the use of a function. If you weren't able to solve it before, think of this as a new opportunity. Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binary. For an integer x, the algorithm is: As long as x is greater than 0 Output x % 2 (remainder is either 0 or 1) x = x // 2 Note: The above algorithm outputs the 0's and 1's in reverse order. You will need to write a second function to reverse the string. Ex: If the input is: 6 the output is: 110 Your program must define and call the following two functions. The function integer_to_reverse_binary() should return a string of 1's and 0's representing the integer in binary (in reverse). The function reverse_string() should return a string representing the input string in reverse. def integer_to_reverse_binary(integer_value) def reverse_string(input_string)

Answers

Answer:

The program in Python is as follows:

import math

def integer_to_reverse_binary(integer_value):

   remainder = ""

   while integer_value>=1:

       remainder+=str(integer_value % 2)

       integer_value=math.floor(integer_value/2)

   reverse_string(remainder)

def reverse_string(input_string):

   binaryOutput=""

   for i in range(len(input_string)-1,-1,-1):

       binaryOutput = binaryOutput + input_string[i]

   print(binaryOutput)

integer_value = int(input("Enter a Number : "))

integer_to_reverse_binary(integer_value)

Explanation:

This imports the math module

import math

This defines the integer_to_reverse_binary function

def integer_to_reverse_binary(integer_value):

This initializes the remainder to an empty string

   remainder = ""

This loop is repeated while the integer input is greater than or equal to 1

   while integer_value>=1:

This calculates the remainder after the integer value is divided by 2

       remainder+=str(integer_value % 2)

This gets the floor division of the integer input by 2

       integer_value=math.floor(integer_value/2)

This passes the remainder to the reverse_string function

   reverse_string(remainder)

The reverse_string function begins here

def reverse_string(input_string):

This initializes the binaryOutput to an empty string

   binaryOutput=""

This iterates through the input string i.e. the string of the remainders

   for i in range(len(input_string)-1,-1,-1):

This reverses the input string

       binaryOutput = binaryOutput + input_string[i]

This prints the binary output

   print(binaryOutput)

The main begins here

This gets input for integer_value

integer_value = int(input("Enter a Number : "))

This passes the integer value to the integer_to_reverse_binary function

integer_to_reverse_binary(integer_value)

Suppose users share a 3 Mbps link. Also suppose each user requires 150 kbps when transmitting, but each user transmits only 10 percent of the time. (See the discussion of packet switching versus circuit switching in Section 1.3.)
a. When circuit switching is used, how many users can be supported?
b. For the remainder of this problem, suppose packet switching is used. Find the probability that a given user is transmitting.
c. Suppose there are 120 users. Find the probability that at any given time, exactly n users are transmitting simultaneously. (Hint: Use the binomial distribution.)
d. Find the probability that there are 21 or more users transmitting simultaneously.

Answers

Answer:

a) 20 users

b) 0.1  or 1/10

c) P ( X = n )   =   [tex]^{120}C_{n} ( 0.10 )^n (0.9)^{120-n}[/tex]

d) 0.008

Explanation:

Given data:

Link shared by users = 3 Mbps

each user requires ; 150 kbps

percentage transmitted by each user = 10%

a) Determine the number of users can be supported

number of users = 3 Mbps / 150 kbps = 3000 / 150 = 20 users

b) P( user is transmitting )

given that percentage transmitted by each user = 10%

since packet switching is used ; P ( user is transmitting ) = 10% = 0.1

c) P ( n users are transmitting simultaneously )

let the number of users ( i.e. N ) = 120

number transmitting = n

P ( user is transmitting ) = 0.10

using Binomial distribution

P ( X = n ) = [tex]^{N}[/tex]Cₙ ( P )ⁿ ( 1 - P )^[tex]^{N-n}[/tex]

                = [tex]^{120}C_{n} ( 0.10 )^n (0.9)^{120-n}[/tex]

d) P( X ≥ 21 transmitting simultaneously )

P ( X = n ) = [tex]^{120}C_{n} ( 0.10 )^n (0.9)^{120-n}[/tex]

Therefore ; P( X ≥ 21 ) = 1 - P( X ≤ 20 )

                                   = 1 - BINOMDIST(20,120,0.1,1)  ( excel function )

∴ P( X ≥ 21 ) = 1 - 0.992059 ≈ 0.008

Prime numbers can be generated by an algorithm known as the Sieve of Eratosthenes. The algorithm for this procedure is presented here. Write a program called primes.js that implements this algorithm. Have the program find and display all the prime numbers up to n = 150.
Sieve of Eratosthenes Algorithm
To Display All Prime Numbers Between 1 and n
Step 1: We need to start with all the numbers representing the range of numbers that are possible candidate primes. So, create an array of consecutive integers from 2 to n: (2,3,4,..n). I wouldn't hand-code this. I would use a loop to populate the array.
Step 2: At each step we select the smallest number and remove all it's multiples. So we'll start with an outer loop that goes from 2 to n. initially, let p equal 2, the first prime number.
Step 3: In an inner loop we need to iterate over all the numbers that are multiples of p, i.e for 2, that's 2,4,6,8 etc. Each time, setting it's value to false in the original array.
Step 4: Find the first number greater than p in the list that is not marked False. If there was no such number, stop. Otherwise, let p now equal this number( which is the next prime), and repeat from step 3.
When the algorithm terminates, all the numbers in the list that are not marked False are prime
Example: Let us take an example when n = 50. So we need to print all print numbers smaller than or equal to 50. We create list of all numbers from 2 to 50.
2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30
31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50

Answers

Answer:

const MAXNR=150;

let candidates = {};

for(let i=2; i<=MAXNR; i++) {

   candidates[i] = true;

}

for(let p=2; p <= MAXNR; p++) {

   if (candidates[p]) {

       process.stdout.write(`${p} `);

       // Now flag all multiples of p as false

       i=2;

       while(p*i <= MAXNR) {

           candidates[p*i] = false;

           i++;

       }

   }

}

Identify the hardware components in your own computer. If you don't have a computer, use a friend's, or one at work or in an NVCC lab. The following list shows the components you should identify and how to find the information on a Windows computer. Describe model computer: type (laptop, desktop, notebook, tablet, etc.) Indicate your manufacturer (HP, Apple: iPad, MacBook Air, etc., Lenovo, Dell, etc.) of the computer. Input devices (include internal and external devices) - they usually have a model name and number somewhere on the device. Output devices (include internal and external devices) - they usually have a model name and number somewhere on the device. Storage devices (include internal and external devices, and how much data each can hold) - Open Windows Explorer and right click on a drive name to open its properties. Amount of RAM - Open System Properties in the Windows Control Panel. Type and speed of CPU - Open System Properties in the Windows Control Panel. Ports (number and type) - Look for jacks into which a connector can be plugged on the front, back and sides of the machine. Compare the jacks to pictures in your textbook.

Answers

Solution :

A friend of mine have an old version of computer PC having the following components :

Input devices

Model name of the keyboard -- PUNTA , model number -- P-KB515

Model name of the mouse -- PUNTA, model number -- P-KB515

Output devices

Speaker : COMPAQ

Monitor : ACER,  Model Number  --- EB192Q

Storage : 500 MB capacity hard disk

RAM : 2 GB

Processor : Intel Pentium dual E1260 at the rate 1.80 GHz

It is provided with audio jacks

Which one of these statements about digital signatures is true? A digital signature:
a. Is used to add a personal touch to e-mail messages.
b. Automatically encrypts the contents of an e-mail.
c. Is a scanned image of your real signature.
d. Is used to verify the identity of the sender of a message.​

Answers

Answer:

A. Is used to add a personal touch to e-mail messages.

Explanation:

A digital signature—a type of electronic signature—is a mathematical algorithm routinely used to validate the authenticity and integrity of a message (e.g., an email, a credit card transaction, or a digital document). ... Digital signatures are significantly more secure than other forms of electronic signatures.

the combination of hardware and software assembly accomplish some specific task as how...?​

Answers

Answer:

A computing system can be referred to as a combination of hardware and software forms created to intentionally interact in specific ways such that the combination of both is able to achieve certain tasks.

Explanation:

Whilst a hardware refers to all the visible parts of the computing system such as the Visual Display Monitor or Screen, Keypads or Keyboards, Mouse and other input devices such as the camera, storage devices etc, the Software refers to intangible part - the logical instructions (machine language) which instructions the hardware on what or what not to do.

Cheers

You are the owner of a small business. In the last year, you have started to hire employees and you now have 5 employees. Each has his or her own personal computer and you have hired a consultant to establish a local area network for your business. You realize that you should draw up a user access agreement and a code of conduct for your employees. Which of the three documents listed below should you create first?

a. The user access agreement
b. The code of conduct
c. The professional association code of ethics

Answers

Answer:

a. The user access agreement

Explanation:

The first document that should be created would be the user access agreement. This is a document that holds all of the policies and guidelines that the employees of a company need to follow when using the companies equipment, software, or network. This includes behavior on the internet such as browsing specific sites, illegal activity, or personal hobbies during work hours, as well as offline such as using company hardware for personal gain. This is a document that is absolutely required for every company in order to protect the company from the consequences of certain employee activity.

Decision support systems (or DSSs) model information using OLAP, which provides assistance in evaluating and choosing among different courses of action. Which of the following does not represent an example of a DSS in business?

a. An insurance company using a system to gauge risk of providing insurance to drivers who have imperfect driving records
b. A medical doctor entering symptoms into a system to aid in diagnosing and treating patients
c. A manufacturing digital dashboard showing visualizations of inventory and production
d. A dentist entering symptoms into a system to help diagnose and treat patients

Answers

Answer:

C

Explanation:

Decision Support Systems (DSSs) model information using OLAP, helps in providing assistance to evaluate and choose among different course of action.

For option A, an insurance company using DSS to evaluate risk of providing insurance to drivers who doesn't have perfect records and option B and D medical doctor entering symptoms into a system to aid in diagnosing and treating patients and dentist entering symptoms into a system to help diagnose and treat patients respectively

is a collection of information stored under a single name ​

Answers

[tex]\boxed{ File }[/tex] is a collection of information stored under a single name.

[tex]\bold{ \green{ \star{ \orange{Mystique35}}}}⋆[/tex]

Answer:

Explanation:A collection of information that is stored on a computer under a single name, for example a text document, a picture, or a program. The association between a file and the program that created the file. Displays the contents of the current folder or library.

interpret the following SQL create table persons (person I'd int, last name varchar (255) first name varchar (255) address varchar (255) city varchar (255)​

Answers

Answer:

Kindly check explanation

Explanation:

The SQL statement above could be interpreted as follows :

create table command is used to create a table named 'persons' with five columns which are labeled :

person I'd : whose data type is an integer

last name column with a variable character data type with maximum length of 255

first name column with a variable character data type with maximum length of 255

address column with a variable character data type with maximum length of 255

city column with a variable character data type with maximum length of 255

The VARCHAR data type is ideal since we expect the column values to be of variable length.

what are the physical aspect of a presentation​

Answers

Answer:

1. It has a clear objective.

2. It's useful to your audience.

3. It's well-rehearsed.

4. Your presentation deck uses as little text as possible.

5. Your contact information is clearly featured.

6. It includes a call-to-action.

Explanation:

Define a class Person that represents a person. People have a name, an age, and a phone number. Since people always have a name and an age, your class should have a constructor that has those as parameters.

Answers

Answer:

public class Person {

   String name;

   int age;

   String phoneNumber;

   public Person(String name, int age, String phoneNumber){

          this.name = name;

          this.age = age;

          this.phoneNumber = phoneNumber;

   }

}

Explanation:

The code above is written in Java.

The following should be noted;

(i) To define a class, we begin with the keywords:

public class

This is then followed by the name of the class. In this case, the name is Person. Therefore, we have.

public class Person

(ii) The content of the class definition is contained within the block specified by the curly bracket.

(iii) The class contains instance variables name, age and phoneNumber which are properties specified by the Person class.

The name and phoneNumber are of type String. The age is of type int. We therefore have;

String name;

int age;

String phoneNumber;

(iv) A constructor which initializes the instance variables is also added. The constructor takes in three parameters which are used to respectively initialize the instance variables name, age and phoneNumber.

We therefore have;

public Person(String name, int age, String phoneNumber){

          this.name = name;

          this.age = age;

          this.phoneNumber = phoneNumber;

   }

(v) Notice also that a constructor has the same name as the name of the class. In this case, the constructor's name is Person.

Answer:

The class and constructor in C++ is as follows:

class Person {

 public:

   string name;     int age;     int phone;

   Person (string x, int y) {  

     name = x;       age = y;  

   }

};

Explanation:

This defines the class

class Person {

The specifies the access specifier

 public:

This declares the attributes; name, age and phone number

   string name;      int age;      int phone;

This defines the constructor for the name and age

   Person (string x, int y) {  

This gets the name and age into the constructor

     name = x;       age = y;  

   }

};

In a paragraph, describe in detail a practical real-world example of where you would implement a singly-linked list and why a singly-linked list is best for this use. Do not list the properties of a singly-linked list....
Rather identify a real-world example or application. If you identify this through research, cite your source.

Answers

Answer:

travel

Explanation:

One real world example of a singly-linked list would be travel. Imagine that you want to take a trip to your nearest neighbor state. To do so you would need to take a 2 buses and a train, but you can't just take any or in any order you wish. You first need to take the first bus at your current location, get off at the train station, take that train to the final stop, get off and take the bus to the final destination. Meaning there is a sequence of connected events that you must follow in order to get to your destination and the same opposite sequence of events to get back. This is exactly like a singly-linked list.

In which type of class methods is it typically necessary to filter bad arguments (either directly or indirectly with the help of validators) in order to protect private data of your class

Answers

Answer: hello your question is incomplete attached below is the complete question

answer :

A set() method (non-constructor mutator). ( B )

Explanation:

The type of class methods that is necessary to filter bad arguments to protect private data of your class using validators is :

A set() method (non-constructor mutator)

Thành phần bên trong nào thực hiện các tính toán và các phép toán logic?
a. Bộ vi xử lý
b. ROM_BIOS
c.Các chip RAM
d. Bo mạch chủ

Answers

Answer:

A

Explanation:

Trình bày phép biến đổi tịnh tiến và quay quanh trục tọa độ? Hãy xác định ma trận chuyển đổi của các phép biến đổi sau :
H = trans(3,7,2). Rot(x,30).Rot(z,45)

Answers

Answer:B

Explanation: she she

An array A[0..n - 2] contains `n-1` integers from 1 to `n` in increasing order. (Thus one integer in this range is missing.) Design an algorithm in $\Theta(\log n)$ to find the missing integer. Your algorithm should be given in **pseudo code**. For example, the array `A` could be `{1, 2, 3, 4, 6, 7, 8, 9, 10}` in which `5` is missing.

Answers

Answer:

I do not understand anything

Regarding the role played by the “victim” in deadlock resolution, give an example of such a deadlock in real life and explain your answers to these questions.

a. Describe how you might choose the victim to be removed and the consequences, both positive and negative, of that removal.

b. Describe the fate of the victim and the chances of eventually completing its processing.

c. Describe the actions required, if any, to complete the victim’s tasks. ​

Answers

Answer:

Here the answer is given as follows,

Explanation:  

The real-life situation of a deadlock resolution where a role is played by the victim is given as follows:  

Example: An example of such a situation are often a one-way lane where the flow of traffic is merely in a method. Thus, on just one occasion, the flow of traffic can enter one direction only. Each entrance/exit gate is often considered a resource. during this case, if two cars are coming from both the entrances and that they are often considered as two tasks, then one among the cars must copy or we will say hand over its resource in order that the opposite car gets the prospect to first cross the lane or we will say the opposite task gets executed.  

 a)  Victim: The steps which describe how a victim is chosen are given as follows :  

   The task which is terminated so as to interrupt things of deadlock is taken into account because of the victim.

There are often a variety of job pools that will be under a deadlock situation and therefore the victim is usually a low-priority task in order that the performance isn't affected that much and termination of this task doesn't cause any effect on the opposite jobs.

the main positive effect of selecting and terminating a victim is that things of deadlock are resolved and every one of the tasks can execute now.

The negative effect is that the task that's chosen because the victim is terminated and is executed at the previous. This whole process for choosing a victim then terminating it then restarting it again may consume some longer also.

b)  An easy deadlock priority is often set. this suggests that the victim’s task or the task is often terminated so as to interrupt the deadlock and other jobs can finish executing. After this, the task which is terminated are often later restarted and every one of the tasks can then execute without a deadlock.

 c) When employment gets terminated, the knowledge associated with it's stored. Are often This is often done in order that the work can be restarted again and therefore the information in it's not lost. Since the progress of the victim is stopped. Thus, the sole thanks to complete the victim’s task would be to start out it again. But before restarting the task, this must be considered that the victim’s task doesn't cause any deadlock within the system.  

Given 4 floating-point numbers. Use a string formatting expression with conversion specifiers to output their product and their average as integers (rounded), then as floating-point numbers. Output each rounded integer using the following: print('{:.0f}'.format(your_value)) Output each floating-point value with three digits after the decimal point, which can be achieved as follows: print('{:.3f}'.format(your_value))

Answers

Answer:

The program is as follows:

prod = 1

isum = 0

for i in range(4):

   num = float(input())

   prod*=num

   isum+=num

avg = isum/4

print('{:.0f}'.format(prod))

print('{:.3f}'.format(avg))  

Explanation:

This initializes the product to 1

prod = 1

..... and sum to 0

isum = 0

The following iteration is repeated 4 times

for i in range(4):

Get input for each number

   num = float(input())

Calculate the product

   prod*=num

Add up the numbers

   isum+=num

This calculates the average

avg = isum/4

Print the products

print('{:.0f}'.format(prod))

Print the average

print('{:.3f}'.format(avg))  

job evaluation for technical consultant​

Answers

There is no question. Why is this telling me incorrect
There is no question

Can you help me in this question

Answers

Answer:

I think the third one (or the one with monkeys).

Explanation:

2+2 does not equal 5, so the if then statement is void because both parts are wrong.

1+1 does not equal 3 even if 2+3 =5, so it is not the second answer.

3+1 does not equal 3, but monkeys do fly and it is an or option, so when one of them is correct in an or, it is correct.

Other Questions
Which of the following inferences is best supported by the passage below (paragraph 34) from "I've Been to the Mountaintop" speech? Find x and then find the measure of the exterior angle Please help ASAP !!! 2) Recently your school organised a presentation on 'Effect of pollution on quality oflife'. As the editor of the school magazine, you were requested to write a report onthe event and suggestions to improve this event. Make sure you give the purposeof the report and conclude by saying how successful you think the event wasoverall. Find all solutions to the equation in the interval [0, 2pie]. Enter the solutions in increasing order. cos 2x = sin x Linda flew into the diner, soared over the tables, and perched next to her friends. She looked brightlyaround the table and chirped, "I just got the lead in the school play."Which figure of speech, or literary device, does the author use in the passage?allusionpersonificationo simileextended metaphor Describe the characteristics of Greek and Roman historigraphy How might long-term exposure to extreme cold affect the body? What changed in the relationship between the Soviet Union and Yugoslavia in 1990? Kyle was trying to decide which type of soda to restock based on popularity: regular cola or diet cola. After studying the data, he noticed that he sold less diet cola on weekdays and weekends. However, after combing through his entire sales records, he actually sold more diet cola than regular cola. Which paradox had Kyle encountered? In 8 days, a group of workers can plant 72 acres.What is their rate in acres per dayHelppp fastttt which statement summarized the difference between mass and weight? A market Group of answer choices always requires face-to-face contact between buyer and seller. reflects upsloping demand and downsloping supply curves. is an institution that brings together buyers and sellers. entails the exchange of goods, but not services. calculate the volume of 150 kg of chlorine gas. - y = 7 is a line which is-(A) Parallel to y-axis (B) Parallel to x-axis (C) Passing through (7, 7) (D) Passing through origin Please help, find the area of the polygon. Identify the following costs as fixed or variable: Costs related to plane trips between Boston, Massachusetts, and San Diego, California, follow. Pilots are paid on a per-trip basis.a. Pilots salaries relative to the number of trips flown.b. Depreciation relative to the number of planes in service.c. Cost of refreshments relative to the number of passengers.d. Pilots salaries relative to the number of passengers on a particular trip.e. Cost of a maintenance check relative to the number of passengers on a particular trip.f. Fuel costs relative to the number of trips. One-half (x + 6) = 18 Why was the last Han Emperor considered. Emperor Xiandi, not considered a strong Emperor?What is the answer Sarah is a 21 year old college student. Sarah comes home each day from class and cries because her classes are so difficult. One day Sarah walks into her dorm room and screams at her roommate for not putting the laundry away. She then storms out of the room, to then find herself sobbing uncontrollably on a park bench. Sarah is not a/an __________.