Though threads simplify sharing within a process, context-switching between threads within a process is just as expensive as context-switching between processes.
In: Computer Science
You have been asked to produce a spreadsheet analysis of the percentages of inpatients treated by patient age. You need to communicate the percentage of patients who were ages 1 through 18, 19 through 35, 36 through 55, and 55 and older. The best type of graph to depict this would be:
Group of answer choices
Line graph
Stacked bar graph
Cluster bar graph
Pie chart
A and C
The use of a Database Management System would be best suited for:
Group of answer choices
Producing thematic maps
Creating a financial model
Creating pie charts
Performing “what-if” analysis
Managing the patient records of a physical therapy clinic
As manager you must create an analysis of staffing requirements for multiple departments. You will need to calculate the number of employees needed for each position using a series of complex formulas incorporating factors such as new patient admissions, the projected numbers of procedures to be performed, follow-up appointments, and several other variables. The best program for this effort would be:
Group of answer choices
Microsoft Access
Microsoft Word
ArcMap GIS
Microsoft Excel
None of the above
Which two of the following describe a relational database?
Group of answer choices
A relational database can consist of one single table containing all of the information.
Microsoft Access is not capable of creating a relational database, only flat file databases are allowed
Tables containing names must be sorted in alphabetical order
A relational structure is the often the best design for databases in which a single person-level record must be associated with multiple transaction records for the same individual
Each table in the relational join must contain a unique key field allowing the records to be joined to another table containing the same key field.
In comparison to Microsoft Excel, which one of the following statements with respect to Microsoft Access is true?
Group of answer choices
Access is more flexible since you can enter the data at the same time that you create the database structure.
Access allows you to quickly create complex formulas for specific cells.
Access database fields must be defined prior to any data being input into it.
Due to its capacity limitations, Access should not be used if there are over 1,000 records and the number is expected to grow over time.
Access allows data to be copied from one range to another.
In: Computer Science
Hello. Please answer the following two-part question in Scheme. Not Python, not any form of C, but in the language Scheme. If you do not know Scheme, please do not answer the question. I've had to upload it multiple times now. Thank you.
2.1 Write a recursive function called eval-poly
that takes a list of numbers representing the coefficients of a
polynomial and a value for ? and evaluates the polynomial for the
given value of ?. The list of coefficients should start with the
term of lowest degree and end with the term of highest degree. If
any term of intermediate degree is missing from the polynomial it
should have a coefficient of zero. For example, the polynomial
?3+4?2+2 would be represented by the list '(2 0 4 1). Hint: the
polynomial above can be rewritten as 2+?⋅(0+?⋅(4+?⋅1))
> (eval-poly '() 0)
0
> (eval-poly '(5) 0)
5
> (eval-poly '(4 3) 2)
10
> (eval-poly '(2 7 1) 3)
32
2.2 Write a tail-recursive version of the
previous problem called eval-poly-tail. It should call a helper
function called eval-poly-tail-helper that uses tail recursion to
keep a running sum of the terms evaluated so far. You might want to
use the expt function to take a number to a power.
> (eval-poly-tail '() 0)
0
> (eval-poly-tail '(5) 0)
5
> (eval-poly-tail '(4 3) 2)
10
> (eval-poly-tail '(2 7 1) 3)
32
Edit: This is all the information given.
In: Computer Science
Write a c++ program that inputs a time from the console. The time should be in the format “HH:MM AM” or “HH:MM PM”. Hours may be one or two digits. Your program should then convert the time into a four-digit military time based on a 24-hour clock.
Code:
#include <iostream> #include <iomanip> #include <string> using namespace std; int main() { string input; cout << "Enter (HH:MM XX) format time: "; getline(cin, input); int h, m; bool am; int len = input.size(); char a=toupper(input.at(len-2)), b = toupper(input.at(len-1)); if(a=='A' && b == 'M') { am = true; } else { am = false; } h = input.at(0) - '0'; if(input.at(1) == ':') { input = input.substr(2); } else { h = 10*h + (input.at(1) - '0'); input = input.substr(3); } m = input.at(0) - '0'; if(input.at(1) != ' ') { m = 10*m + (input.at(1) - '0'); } // 12AM means midnight, 12PM means afternoon if(h == 12) { h = 0; } if(!am) { h += 12; } cout << setw(2) << std::setfill('0') << h << m << " hours" << endl; }
Is there any easier way and a simpler way to write the code other than the above code?
In: Computer Science
Analysis Study Case Question:
–Adjacency Matrix
–Adjacency List
–Edge List
In: Computer Science
PYTHON!!!
Radioactive materials decay over time and turn into other substances. For example, the most common isotope of uranium, U-238, decays into thorium-234 by emitting an alpha-particle. The rate of radioactive decay of a material is measured in terms of its half-life. The half-life of a material is defined to be the amount of time it takes for half of the material to undergo radioactive decay. Let m be the initial mass in grams of some material and let h be the material’s half-life in days. Then the remaining mass of the material on day t, denoted m(t), is given by the formula: m(t) = m × 0.5 t/h
Note: This formula is not a Python assignment statement! It is an equation that says: if you know the quantities m, t, and h, you can calculate a value using the right side of the equation. That value will be the amount of remaining mass of the material after t days. For this question, write a program which does the following: • Prompt the user to enter the initial mass of the material (in grams). You must make sure that the user enters a positive number. If they do not enter a positive number, print a message informing them so, and prompt them to enter the initial amount of material again. Keep doing this until they enter a positive number. • Prompt the user to enter the half-life of the material (in days). As above, make sure that the user enters a positive number, and if they don’t, keep asking until they do. • Starting from day 0, output the amount of the material remaining at one-day intervals. Thus, for day 0, day 1, day 2, etc., you should print out the amount of remaining mass according to the above formula. Your program should stop on the first day on which remaining mass is less than 1% of the initial mass. Don’t forget to import the math module if you need math functions. Hint: A correct solution should make use of three while-loops.
In: Computer Science
SLUGGING PERCENTAGES & BATTING AVERAGES - SENTINEL LOOP
Develop a program in JAVA that will determine the slugging percentages and batting average of several New York Yankees from the 2006 season. Slugging percentage is calculated by dividing the total number of bases by the number of at bats. The number of bases would be one for every single, two for every double, three for every triple, and four for every home run. The batting average is calculated by dividing the total number of hits by the number of at bats. You do not know the number of players in advance, but for each player you know their number of singles, doubles, triples, home runs, total number of at bats, and the player's name (use the proper type and method for each variable).
You will use a while sentinel loop on the 1st item to input. If it is not the sentinel, go into the while sentinel loop and separately input the rest of the input items (be careful of the enter in the input memory buffer for the player name). You will then calculate the total bases and the slugging percentage. You will then calculate the batting average. You will then print out the player's name, the labeled slugging percentage for that player to three decimal places, and the labeled batting average for that player to three decimal places. Use separate output statements. Print a blank line between players. This loop will repeat for as many players as you need.
Run your program with the following players and sentinel value (to show the sentinel value worked):
Singles: 158
Doubles: 39
Triples: 3
Home Runs: 14
At Bats: 623
Player: Derek Jeter
Singles: 51
Doubles: 25
Triples: 0
Home Runs: 37
At Bats: 446
Player: Jason Giambi
Singles: 104
Doubles: 26
Triples: 1
Home Runs: 35
At Bats: 572
Player: Alex Rodriguez
Singles: -1
In: Computer Science
Create the Database:
The data is the same as was described in the ER Design Project assignment. In that assignment you were asked to map the ER diagram to relations in the database. Here is a formal description of the relations that you will use in this assignment:
streamTV Database Relations
shows(showID, title, premiere_year, network, creator, category)
episode(showID, episodeID, airdate, title)
showID is a foreign key to shows
actor(actID, fname, lname)
main_cast(showID, actorID, role)
actID is a foreign key to actor
recurring_cast(showID, episodeID, actorID, role)
actID is a foreign key to actor
customer(custID, fname, lname, email, creditcard,membersince,renewaldate, password, username)
cust_queue(custID, showID, datequeued)
showID is a foreign key to shows
watched(custID, showID, episodeID, datewatched)
Primary keys are in bold.
Question:
SQL Queries:
The management at streamTV needs to retrieve certain information about their the data in the database. Specify the SQL queries for the questions listed here:
1. Find the titles and premiere years of all shows that were created after 2005.
2. Find the number of episodes watched by each customer, sorted by customer last name.
3. Find the names and roles of all actors in the main cast of Friday Night Lights.
4. Find all actors who are in the main cast of at least one show and in the recurring cast of at least one show. Display the actor's first name, last name, the title of the show in which the actor is in the main cast, the title of the show in which the actors is in the recurring cast, and the role the actor plays in each show.
5. How many shows have episodes with the word "good" in the title.
6. List the show title, episode number, date and episode title for all of the shows with the word "good" in the title. Sort the list by airdate.
7. Which episodes that have been watched originally aired in 2005. Display the show title, the episode title and the original air date.
8. Display the names of all actors who have had recurring roles in shows on NBC. Include the name of the actor, the title of the show and the role.
9. A customer wants to add to her queue every show that Amy Poehler has appeared in. List all of these shows by title.
10. For each customer (display first and last name), display which show and episode was the first one watched by that customer. Sort the result by the customer's last name.
11. Find all shows that have more than 5 seasons. Display the title of the show, and the number of seasons. Sort the result by the number of seasons. Note that the first digit of each episode number represents the season number.
12. Find the titles of all shows that were not watched by any customers in August of 2013.
13. List the title of the show that has been watched the most by
customers. Also display the number of times it has been
watched.
14. For each show, list the number of customers who have that show in their queue. Display the show title and the number of customers. Sort by show title.
In: Computer Science
Write a program in Python to determine how many months it will take to pay off a $10,000 car loan with 4% interest. Choose your own monthly payment.
In: Computer Science
PYTHON
The game of Morra is a hand game that dates back to ancient Greece and Rome. In the real game, any number of players can play, but for this question we will assume two players only. The game is played in rounds. Each round, both players throw out one hand showing between 0 and 5 fingers and simultaneously call out what they think the sum of the fingers on the hands of all players will be. Any player who guesses correctly gets a point. The first player to 3 points wins. You will write a program that simulates a two-player game of Morra. Your program must do the following for each round of play until the game is over: • At the beginning of each round, print out the round number. The first round is round 1. • Read from the console the number of fingers shown by player 1, the number of fingers shown by player 2, player 1’s guess at the sum, and player 2’s guess at the sum. • Print to the console whether any players made a correct guess, and if so, that player’s new point total. If neither player guessed correctly, print a message indicating this. Note that BOTH players might guess correctly, in which case they both earn a point! Once the game is over, print the final outcome of the game. There are a few possibilities: • Print Player X wins! where X is either 1 or 2 depending on which player won. • If, however, the winning player won by a score of 3 to 0, instead print Player X wins a glorious victory!, again where X is either 1 or 2 as appropriate. • It is possible that the game is a tie. For example, if the score is 2 to 2, and both players guess correctly in the next round, both players will have three points when the game ends. In such a case, instead of printing either of the above messages, print It’s a tie!.
(a) Remember: you don’t have to generate player moves randomly. You are reading them from the console each round. Think of your program as the referee — it asks for the players moves each round using console input, then reports on the outcome of each round using console output, and finally prints the outcome of the game. (b) Your program only has to play one full game. To referee another game, run the program again! (c) You may assume that the user enters only valid data. That is, you do not have to actually check whether player moves are between 0 and 5 and that their guesses are between 0 and 10. Just assume that valid values are always entered.
In: Computer Science
Minicomputers were developed to take advantage of the use of transistors.
True
False
This technique breaks up a message into smaller pieces for transmission over a network.
Slicing |
||
Packet switching |
||
Compiling |
||
Routing |
QUESTION 3
One advantage of the stored-program concept is that a computer can easily return to a previous instruction and repeat it.
True
False
QUESTION 4
The PDP series of minicomputers were developed by IBM.
True
False
QUESTION 5
This person was given credit for developing the stored program concept
Alan Turing |
||
John Mauchly |
||
J. Presper Eckert |
||
John von Neumann |
In: Computer Science
From the MNIST dataset introduced in class, write code in Python that
a) Splits the 42000 training images into a training set (50% of all the data) and a test set (the rest). The labels should also be split accordingly. [10 points]
b) Use this training set for training a multi-class logistic regression model and test it on the test set. Report the score. [10 points]
c) Use this training set for training a multi-class support vector machine model and test it on the test set. Report the score.
In: Computer Science
Python
Pikachu is surrounded by pesky zubats! Will Pikachu be able to defeat all the bats, or will their numbers prove too great for our hero? You must write a program to answer this question. When your program starts, allow the user to input the number of zubats that are attacking Pikachu (you may assume the user enters a positive number). Then, you must simulate a series of battles between Pikachu and a zubat. Initially, Pikachu has 35 health, but he may lose health during the battles, and if he ever runs out of health, he faints! The zubats will attack one at a time, and the rules for the battle simulation are as follows. Note that you will definitely need to import Python’s random module, as there is luck in the simulation. • The zubat attacks rst. It has a 50% chance to hit Pikachu (Hint: Use the random() function to generate a random float between 0 and 1, then check if that oat is less than 0.5). If the zubat hits, it will randomly deal either 1, 2, or 3 damage to Pikachu. • Then Pikachu attacks. Pikachu has a 60% chance to hit the zubat. If he does, he will defeat the bat. The bats will attack in turn until either they are all defeated, or Pikachu faints. When that happens, print out a message that describes the outcome. • If Pikachu defeated all the zubats, print out that he triumped and how much health he has left • If Pikachu fainted, print out how many of the zubats he managed to defeat.
First, write a function to simulate a single battle between Pikachu and one zubat. Pikachu’s current health should be a parameter to this function, and the function should return the amount of health Pikachu has remaining after the battle is over. Make sure this function is working before going on! Put print() statements into your function to print out intermediate values during the battle to see if they make sense. You’ll take these print() statements out later (the sample output above doesn’t have them), but they’re invaluable for testing your function.
Second, in the “main” part of your Python program, use console input to ask the user for the number of zubats. You can assume the user will enter a positive integer. Then, use a loop to keep calling your function from Step 1 so long as there are still zubats to defeat and Pikachu hasn’t fainted. Once the loop is done, display the outcome to the console as per the sample output shown above.
In: Computer Science
Write a program that dynamically allocates a built-in array large enough to hold a user-defined number of test scores. (Ask the user how many grades will be entered and use a dynamic array to store the numbers.) Once all the scores are entered, the array should be passed to a function that calculates the average score. The program should display the scores and average. Use pointer notation rather than array notation whenever possible. (Input Validation: Do not accept negative numbers for test scores.) Make it a class, call it something like gradeholder. You will need a destructor because you are using dynamic arrays.
please help!! this is C++ programming fundamental 2 and this is visual studio, thank you!
In: Computer Science