Answer:
counting
Explanation:
It looks like you're initializing your counter variable before you create the for loop.
The intelligence displayed by humans and other animals is termed?
Answer:
ᗅгᝨเŦเςเᗅl เภᝨєllเﻮєภςє, Տ⌾๓єᝨเ๓єՏ ςᗅllє๔ ๓ᗅςђเภє เภᝨєllเﻮєภςє ⌾г ๓ᗅςђเภє lєᗅгภเภﻮ, เՏ เภᝨєllเﻮєภςє ๔є๓⌾ภՏᝨгᗅᝨє๔ ๒γ ๓ᗅςђเภєՏ, เภ ς⌾ภᝨгᗅՏᝨ ᝨ⌾ ᝨђє ภᗅᝨႮгᗅl เภᝨєllเﻮєภςє ๔เՏקlᗅγє๔ ๒γ ђႮ๓ᗅภՏ ᗅภ๔ ⌾ᝨђєг ᗅภเ๓ᗅlՏ. ... Տ⌾๓єᝨђเภﻮ ᝨђᗅᝨ'Տ ђєlקเภﻮ ᝨђเՏ ςђᗅภﻮє เՏ ᗅгᝨเŦเςเᗅl เภᝨєllเﻮєภςє.
հօթҽ íԵ հҽlթs
Natural intelligence relates to life concepts and life choices which adhere to the natural constraints or boundaries of the world's resources and the further discussion can be defined as follows:
It is defined as an emotional impulse ingrained into the common myth that drives us to value & defend the integrity of any living creatures.It is the polar opposite of artificial intelligence, which is all of the control mechanisms found in life. Nature also displays non-neural control in plants and protozoa, as well as dispersed intellect in colonies species including such ants, jackals, and people.Therefore, the final answer is "Natural intelligence".
Learn more:
brainly.com/question/16456970
Compilers can have a profound impact on the performance of an application. Assume that for a program, compiler A results in a dynamic instruction count of 1.0E9 and has an execution time of 1.1 s, while compiler B results in a dynamic instruction count of 1.2E9 and an execution time of 1.5 s. a. Find the average CPI for each program given that the processor has a clock cycle time of 1 ns.
Answer:
The answer is "1.25"
Explanation:
[tex]{CPU \ time}= {instructions \times CPI \times cycle\ time}[/tex]
[tex]\therefore\\\CPI= \frac{CPU \ time}{instructions \times cycle \ time} \\\\cycle \ time = 1 \\\\ns = 10^{-9} s \\[/tex]
Also for this context, it executes the time = CPU time. So, the compiler A, we has
[tex]CPI_{A}= \frac{CPU \ time_{A}} {instructions_{A} \times cycle \ time}= \frac{1.1 s}{10^{9} \times 10^{-9} s}= 1.1[/tex]
For compiler B, we have
[tex]CPI_{B}= \frac{CPU \ times_{B}} {instructions_{B} \times cycle \ time}[/tex]
[tex]= \frac{1.5\ s}{ 1.2 \times 10^{9} \times 10^{-9} \ s}\\\\= \frac{1.5}{ 1.2 }\\\\= 1.25[/tex]
The average CPI for each program given that the processor has a clock cycle time of 1 ns is : 1.1, 1.25.
Average CPI for each programCPI (Complier A)=CPU time/Instruction×Cycle time
Where:
Cycle time=1ns=10^-9s
Hence:
CPI (Complier A)=1.1s/10^9×10^-9s
CPI (Complier A)=1.1
CPI (Complier B)=CPU time/Instruction×Cycle time
CPI (Complier B)=1.5s/1.2×10^9×10^-9s
CPI (Complier B)=1.25
Inconclusion the average CPI for each program given that the processor has a clock cycle time of 1 ns is : 1.1, 1.25.
Learn more about average CPI here:https://brainly.com/question/24723238
In this assignment, you will implement an online banking system. Users can sign-up with the system, log in to the system, change their password, and delete their account. They can also update their bank account balance and transfer money to another user’s bank account.
You’ll implement functions related to File I/O and dictionaries. The first two functions require you to import files and create dictionaries. User information will be imported from the "users.txt" file and account information will be imported from the "bank.txt" file. Take a look at the content in the different files. The remaining functions require you to use or modify the two dictionaries created from the files.
Each function has been defined for you, but without the code. See the docstring in each function for instructions on what the function is supposed to do and how to write the code. It should be clear enough. In some cases, we have provided hints to help you get started.
def import_and_create_dictionary(filename):
'''
This function is used to create a bank dictionary. The given argument is the filename to load.
Every line in the file will look like
key: value
Key is a user's name and value is an amount to update the user's bank account with. The value should be a
number, however, it is possible that there is no value or that the value is an invalid number.
What you will do:
- Try to make a dictionary from the contents of the file.
- If the key doesn't exist, create a new key:value pair.
- If the key does exist, increment its value with the amount.
- You should also handle cases when the value is invalid. If so, ignore that line and don't update the dictionary.
- Finally, return the dictionary.
Note: All of the users in the bank file are in the user account file.
'''
d = {}
# your code here
return d
##########################
### TEST YOUR SOLUTION ###
##########################
bank = import_and_create_dictionary("bank.txt")
tools.assert_false(len(bank) == 0)
tools.assert_almost_equal(115.5, bank.get("Brandon"))
tools.assert_almost_equal(128.87, bank.get("James"))
tools.assert_is_none(bank.get("Joel"))
tools.assert_is_none(bank.get("Luke"))
tools.assert_almost_equal(bank.get("Sarah"), 827.43)
#user.txt
Brandon - brandon123ABC
Jack
Jack - jac123
Jack - jack123POU
Patrick - patrick5678
Brandon - brandon123ABCD
James - 100jamesABD
Sarah - sd896ssfJJH
Jennie - sadsaca
#bank.txt
Brandon: 5
Patrick: 18.9
Brandon: xyz
Jack:
Sarah: 825
Jack : 45
Brandon: 10
James: 3.25
James: 125.62
Sarah: 2.43
Brandon: 100.5
Answer:
# global variable for logged in users
loggedin = []
# create the user account list as a dictionary called "bank".
def import_and_create_dictionary(filename):
bank = {}
i = 1
with open(filename, "r") as file:
for line in file:
(name, amt) = line.rstrip('\n').split(":")
bank[i] = [name.strip(), amt]
i += 1
return bank
#create the list of user login details.
def import_and_create_accounts(filename):
acc = []
with open(filename, "r") as file:
for line in file:
(login, password) = line.rstrip('\n').split("-")
acc.append([login.strip(), password.strip()])
return acc
# function to login users that are yet to login.
def signin(accounts, login, password):
flag="true"
for lst in accounts:
if(lst[0]==login and lst[1] == password):
for log in loggedin:
if(log ==login):
print("You are already logged in")
flag="false"
break
else:
flag="false"
if(flag=="true"):
loggedin.append(login) # adding user to loggedin list
print("logged in succesfully")
return True
return False
# calling both the function to create bank dictionary and user_account list
bank = import_and_create_dictionary("bank.txt")
print (bank)
user_account = import_and_create_accounts("user.txt")
print(user_account)
# check for users loggedin
signin(user_account,"Brandon","123abcAB")
signin(user_account,"James","100jamesABD")
signin(user_account,"Sarah","sd896ssfJJH")
Explanation:
The python program is a banking application system that creates a list of user accounts and their login details from the bank.txt and user.txt file. The program also uses the information to log in and check for users already logged into their account with the "loggedin" global variable.
In this exercise we have to use the knowledge of programming in the python language, in this way we find that the code can be written as:
The code can be seen in the attached image.
To make it even simpler to visualize the code, we can rewrite it below as:
def import_and_create_dictionary(filename):
bank = {}
i = 1
with open(filename, "r") as file:
for line in file:
(name, amt) = line.rstrip('\n').split(":")
bank[i] = [name.strip(), amt]
i += 1
return bank
#create the list of user login details.
def import_and_create_accounts(filename):
acc = []
with open(filename, "r") as file:
for line in file:
(login, password) = line.rstrip('\n').split("-")
acc.append([login.strip(), password.strip()])
return acc
def signin(accounts, login, password):
flag="true"
for lst in accounts:
if(lst[0]==login and lst[1] == password):
for log in loggedin:
if(log ==login):
print("You are already logged in")
flag="false"
break
else:
flag="false"
if(flag=="true"):
loggedin.append(login) # adding user to loggedin list
print("logged in succesfully")
return True
return False
bank = import_and_create_dictionary("bank.txt")
print (bank)
user_account = import_and_create_accounts("user.txt")
print(user_account)
signin(user_account,"Brandon","123abcAB")
signin(user_account,"James","100jamesABD")
signin(user_account,"Sarah","sd896ssfJJH")
See more about programming at brainly.com/question/11288081
In an independent software organization, who owns the copyright of the developed software?
O A.
client
OB
software organization
C.
project manager
D.
testing team
OE.
change committee
Answer:
The correct answer is B) The software organization.
Explanation:
An independent software organization is one that specializes in writing or creating software or applications that are eventually sold to the end-users. The End-Users are usually a broad-based market. The users only purchase a right to use the software, not the right to own the software. This means that the rights and ownership of the software remain that of the independent software organization or vendor (ISV).
Examples of applications that an ISV can create include but are not limited to the following list:
Healthcare Management System; Real Estate Management System; Accounting and Finance Management System Gambling Softwares University or School Management Software etc
Examples of Accounting and Finance Management Systems are:
Quickbooks by IntuitFreshbooksSage and Xero
Cheers
Concentrate strings
Write code that concatenates the character strings in str1 and str2, separated by a space, and assigns the result to a variable named joined. Assume that both string variables have been initialized.
Two Letters in Word
Given a character string stored in a variable called word, write code that concatenates the fifth character of the word to the third character from the end of the word, and assigns that string to a variable named two_letters. Assume that word already has a value and is at least five characters long.
Set the Number of Cards if Necessary
Write code that sets the value of the variable num_cards to seven if its current value is less than seven. Otherwise, don't change the value. Assume that nuncards already has an initial value.
Answer:
In Python:
(a) Concatenate strings:
joined = str1+" "+str2
(b) Two Letters in Word :
two_letters = word[4]+word[-3]
(c) Set Numbers in Card
if num_cards < 7:
num_cards = 7
Explanation:
The code segments were written in Python
All variables were assumed to have been initialized
Solving (a): Concatenate strings:
To do this, we make use of + operator.
So, the concatenation of str1 and str2 with space in between is
str1+" "+str2
When assigned to variable joined, it becomes
joined = str1+" "+str2
Solving (b): Two Letters in Word :
The character at the 5th position is represented with index 4 i.e. word[4]
To access a character from the end, we make use of - sign. So, the third character from the end is word[-3]
Concatenate them using + operator.
So, we have:
two_letters = word[4]+word[-3]
Solving (c): Set Numbers in Card
Here, we make use of the if condtion.
First, check if num_cards is less than 7(i.e. num_cards < 7)
If true, assign num_cards to 7
So, we have:
if num_cards < 7:
num_cards = 7
Match the web development languages to their types.
PHP
HTML
ASP
JavaScript
XML
SGML
MARKUP LANGUAGE
SCRIPTING LANGUAGE
Answer:
HTML, XML and SGML are the markup languages (hence the "ML" suffix on each of their acronyms).
PHP, ASP and Javascript are scripting languages.
A kind of markup language is HTML. It "marks up" or encapsulates data using HTML tags that specify the data and explain how it will be used on the webpage. Following that, the web browser examines the HTML, which instructs it as to what sections are headings, paragraphs, links, etc.
What are the different web development languages?OOP scripting is used in Java, whereas OOP programming is used in Java. JavaScript code can only be run on a browser, while Java applications can run on a virtual machine or browser.
While JavaScript code is completely in text, Java code must be compiled. They both need various plug-ins.
Therefore, The "ML" suffix on each acronym stands for markup languages, which are HTML, XML, and SGML respectively. Scripting languages include JavaScript, ASP, and PHP.
Learn more about languages here:
https://brainly.com/question/29239656
#SPJ2
what is hyperlink and its used in website
Explanation:
Hyperlink is the primary method used to navigate between webpages.
Hyperlink can redirect us to another webpages, such as websites that has graphics, files, sounds on the same webpage.
Let A and B be two stations attempting to transmit on an Ethernet. Each has a steady queue of frames ready to send; A’s frames will be numbered ????1, ????2 and so on, and B’s similarly. Let T = 51.2 ????????????c be the exponential backoff base unit. Suppose A and B simultaneously attempt to send frame 1, collide, and happen to choose backoff times of 0 × T and 1 × T, respectively. As a result, Station A transmits ????1 while Station B waits. At the end of this transmission, B will attempt to retransmit ????1 while A will attempt to transmit ????2. These first attempts will collide, but now A backs off for either 0 × T or 1 × T (with equal probability), while B backs off for time equal to one of 0 × T, 1 × T, 2 × T and 3× T (with equal probability).(a) Give the probability that A wins this second backoff race immediately after his first collision.(b) Suppose A wins this second backoff race. A transmits ????2 and when it is finished, A and B collide again as A tries to transmit ????3 and B tries once more to transmit ????1. Give the probability that Awins this third backoff race immediately after the first collision.(c) What is the probability that A wins all the ???? backoff races. (???? is a given constant)(d) Assume that there are 3 stations sharing the Ethernet. Will the chance for A to win all the backoffraces decrease or increase? Why?
Answer:
Following are the solution to the given question:
Explanation:
Please find the complete and correct question in the attachment file.
For Point a:
For the second round,
A is selects kA(2) either 0 or 1, so for each of them, that is [tex]\frac{1}{2}[/tex].
B selects [tex]kB(2)\ from\ (0, 1, 2, 3)[/tex] for each choice with the probability of [tex]\frac{1}{4}[/tex].
If [tex]kA(2) < kB(2)[/tex] wins the second rear race.
[tex]\to P[A \ wins] = P[kA(2) < kB(2)][/tex]
[tex]= P[kA(2) = 0] \times P[kB(2) > 0] + P[kA(2) = 1] \times P[kB(2) > 1]\\\\= \frac{1}{2} \times \frac{3}{4} + \frac{1}{2} \times \frac{2}{4} \\\\=\frac{3}{8} +\frac{2}{8} \\\\= \frac{3+2}{8}\\\\= \frac{5}{8}[/tex]
For Point b:
Throughout this example, [tex]kA(3)[/tex] also selects to be either 0 or 1 with such a [tex]\frac{1}{2}[/tex] probability. So, although B chooses [tex]kB(3)[/tex] from [tex](0, 1, 2, 3, 4, 5, 6, 7),[/tex] the probabilities each are [tex]\frac{1}{8}[/tex]:
[tex]\to P[A \ wins] = P[kA(3) < kB(3)][/tex]
[tex]= P[kA(3) = 0] \times P[kB(3) > 0] + P[kA(3) = 1] \times P[kB(3) > 1]\\\\= \frac{1}{2} \times \frac{7}{8} + \frac{1}{2} \times \frac{6}{8}\\\\= \frac{7}{16} + \frac{6}{16}\\\\= \frac{7+6}{16} \\\\= \frac{13}{16}\\\\[/tex]
For point c:
Assume that B tries again 16 times (typical value), and it destroys. In addition, throughout the exponential background n is obtained at 10 when choosing k between 0 to 2n−1. The probability of A winning all 13 backoff events is: [tex]P[A \text{wins remaining races}] = 16\pi i =4P[A \ wins \ i |A \ wins \ i -1 ][/tex]
Let the k value kA(i) be A for the backoff race I select. Because A retains the breed
[tex]=(kA(i)] \cdot P[kA(i+ 1)< kB(i+ 1)] \geq P[kA(i) + 1<kB(i)] \cdot P[kA(i+ 1)< kB(i+1)]+P[kA(i) + 1 \geq kB(i)] \cdot P[kA(i+ 1)< kB(i+ 1)] \\\\= (P[kA(i) + 1< kB(i)] +P[kA(i) + 1 \geq kB(i)]) \times P[kA(i+ 1) < kB(i+ 1)]\\\\=P[kA(i+ 1)< kB(i+ 1)]\\\\[/tex]
For point d:
Two stations A and B are supposed. They assume that B will try 16 times afterward. Even so, for A, 16 races were likely to also be won at a rate of 0.82 For Just higher expectations of three A, B, and C stations. For Station A, possibility to win all backoffs
Without this step of the problem solving process you might solve the wrong problem, not know where to start, or not know when you are finished.
Select one:
Define
Prepare
Try
Reflect
SAM trainings include 4 parts, which of the following is NOT one of them?
A.practice
B.grading
C.guide
D.Observe
Answer:
doon sa pasay nag kakapi
0111101101010110101110110001001011101001011101101010101010110101
Refer to the above bit string to answer the below questions.
Create a valid IPv4 addresses using the above bit string.
Answer:
binary digits in computer system it belongs
five advantages of Internet
Answer:
1. Accessible to find information
2. Computer can store information you need
3. Communication world wide to connect with others
4. High tech learning
5. Many entertaining platforms and games
Explanation:
Hope that helps
Film and video speak the same audiovisual’’__________.’’
Answer:
Film and video speak the same audiovisual ’’Technology’’
15. Select the correct answer.
What determines the measure of height and width of an image in pixels?
A.
pixel depth
B.
pixel dimension
C.
resolution
D.
image size
E.
interpolation
Answer:
Pixel dimensions
Explanation:
measure of height and width of a image in pixels
What is the algorithm to determine the absolute of a number
This was written in python, let me know if it needs to be in another language.
Answer:
Conditionals are slower than plain arithmetic operations, but much, much faster than something as silly as calculating the square root
Explanation:
integer or bitwise op: 1 cycle floating -point add/ sub/mul: 4 cycles . Floating- point div ~ 30 cycles Floating - point exponentiation :~ 60 cycles depending on implementation Conditional branch : avg. 10_ cycles, better if well- predicted , much worse if mispredicted.
Write formal descriptions of the following sets.
(a) The set containing the numbers 1, 10, and 100
(b) The set containing all integers that are greater than 10
(c) The set containing all natural numbers that are less than 10
(d) The set containing nothing at all
(e) The set containing the empty string
(f) The set containing the string abc
Answer:
{1, 10, 100}
{a : a ∈ Z and a > 10}
{a : a ∈ N and a < 10}
∅
{ε}
{abc}
Explanation:
1.) A set containing the numbers 1, 10 and 100
2.) Z represents integers, hence numbers n the set are integers values greater Than 100
3.) N represents natural numbers, this the set contains natural numbers less Than 10
4.)∅ represents a null or empty set
5.)represents an empty string
6) contains the sting values a, b and c
When you check your hard drive to see how much space is available, you are checking your
O primary memory
O secondary storage
O tertiary storage
O primary storage
Answer:
secondary storage
What is software?
a. The soft parts of a computer, like the mouse pad. b. The collection of programs that make the computer do useful work
c. The physical components that come together to form a computer
d. A special kind of CD-ROM
Answer:
B
Explanation:
Answer:
I believe the answer is B
Select the correct answer.
Jane's team is using the V-shaped model for their project. During the high-level design phase of the project, testers perform integration testing
What is the purpose of an integration test plan in the V-model of development?
OA. checks if the team has gathered all the requirements
OB. checks how the product interacts with external systems
ОC. checks the flow of data in internal modules
OD. checks how the product works from the client side
Answer:
a
Explanation:
Which version of Microsoft Office is free?
Answer:
the older versions and really all of them are
Answer:
This is what I found on the internet that I hope will help you! :3
Explanation:
It's a free app that will be preinstalled with Windows 10, and you don't need an Office 365 subscription to use it. The existing My Office app has many of these features, but the new Office app puts the focus on the free online versions of Office if you're not an Office 365 subscriber.
Consider a computer system with three users: Alice, Bob, and Cyndy. Alice owns the file alicerc, and Bob and Cyndy can read it. Cyndy can read and write the file bobrc, which Bob owns, but Alice can only read it. Only Cyndy can read and write the file cyndyrc, which she owns. Assume that the owner of each of these files can execute it.
a. Create the corresponding access control matrix.
b. Cindy gives Alice permission to read cyndyrc, and Alice removes Bob's ability to rad alicerc. Show the new access control matrix.
Answer:
Following are the solution to this question:
Explanation:
For point a:
[tex]alicerc \ \ \ \ \ \ \ \ \ \ \ bobrc \ \ \ \ \ \ \ \ \ \ \ \ \ \ cyndyrc\\[/tex]
[tex]Alice \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ox \ \ \ \ \ \ \ \ \ \ \ \ \ \ r\\\\ Bob \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ r \ \ \ \ \ \ \ \ \ \ \ \ \ \ ox \\\\Cyndy \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ r\ \ \ \ \ \ \ \ \ \ \ \ \ \ rw \ \ \ \ \ \ \ \ \ \ \ \ \ \ orwx[/tex]
For point b:
[tex]alicerc \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ bobrc \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ cyndyrc[/tex]
[tex]Alice \ \ \ \ \ \ \ \ \ \ \ \ \ \ ox \ \ \ \ \ \ \ \ \ \ \ \ \ \ r \ \ \ \ \ \ \ \ \ \ \ \ \ \ r\\\\Bob \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ox \\\\Cyndy \ \ \ \ \ \ \ \ \ \ \ \ \ \ r \ \ \ \ \ \ \ \ \ \ \ \ \ \ rw \ \ \ \ \ \ \ \ \ \ \ \ \ \ orwx[/tex]
At which stage should Joan discuss the look and feel of her website with her website designer?
At the
stage, Joan should discuss the look and feel of her website with her website designer.
Answer:
Development stage: It is great to talk with the website designer during the development stages to understand the goalsAnswer:
At the planning stage maybe?
Explanation:
I'm not positive but in plato it discusses this in the Website Development Proccess lesson.
match each option to the description of the task it accomplishes?
Answer:
did u mean to send a picture
Explanation:
I don't get the width and height part (PLEASE HELP WILL GIVE BRAINLIEST ANSWER)
Answer:
What they're saying is that the first two bytes (first two eight bit segments) tell you the width and height of the pattern.
In the example given, you'll notice that the first 16 digits are 00000100 00000100. If you convert those to decimal, you'll see that those are both equal to four.
If instead the second block of eight bits was 00000111, the image height would then be seven.
What are other ways you could use the shake or compass code blocks in physical computing projects?
Answer:there are different ways of quick navigation between files and functions. ... You should use the menu 'Remove file from project' instead of deleting files. ... A Makefile generation tool for Code::Blocks IDE by Mirai Computing
4. What are the traits of a good follower?
Answer:
Judgment. Followers must take direction, but not blindly. Work ethic. Good followers are good workers. Competence. In order to follow, followers must be competent. Honesty. Followers have a responsibility to be honest. Courage. Discretion. Loyalty. Ego management.Match the following
A. Birju Maharaj Brain Lara
B. Jhaveri Sister Mike Tyson
C. Hockey Major Dhyan Chand
D. Boxing Manipur
E. Cricket Uttar Pradesh
Electronic mail is best used to:
Question 31 options:
Send and Receive messages over a network
Send and Receive messages via the Internet
Send and Receive messages via radio waves.
A and B
Answer:
send and receive messages via the internet
Answer:
a and b
Explanation:
because iam smart
The Boolean Foundation hosted a raffle to raise money for charity and used a computer program to notify the participants about the results. Unfortunately, the program they used was not very robust and all 250 participants received an email telling them that they won... and that their name is Shauna.
Improve this program by writing a function called sendEmail to print a personalized email to stdout. The function should take three parameters:
The name of the recipient
The prize for the raffle
Whether or not the recipient won
Use the email template from the existing program.
#include
using namespace std;
int main() {
cout << "Dear Shauna," << endl;
cout << "You are the winner of our raffle for charity." << endl;
cout << "The prize was: a stuffed giraffe toy" << endl;
cout << "Thank you for giving to charity!" << endl;
cout << "Sincerely," << endl;
cout << "The Boolean Foundation" << endl;
return 0;
}
Answer:
The function is as follows:
void sendEmail(string name, string prize, string win_lose){
cout << "Dear "<<name<<", " << endl;
cout << "You are the "<<win_lose<<" of our raffle for charity." << endl;
cout << "The prize was: "<<prize<< endl;
cout << "Thank you for giving to charity!" << endl;
cout << "Sincerely," << endl;
cout << "The Boolean Foundation" << endl;
}
Explanation:
This defines the function along the three parameters
void sendEmail(string name, string prize, string win_lose){
This prints the salutation with the person's name
cout << "Dear "<<name<<", " << endl;
This prints if the person won or lost
cout << "You are the "<<win_lose<<" of our raffle for charity." << endl;
This prints the prize, if any
cout << "The prize was: "<<prize<< endl;
The following is the closing remark
cout << "Thank you for giving to charity!" << endl;
cout << "Sincerely," << endl;
cout << "The Boolean Foundation" << endl;
}
Suppose a program contains 500 million instructions to execute on a processor running on 2.2 GHz. Half of the instructions takes 3 clock cycles to execute, where rest of the instructions take 10 clock cycle. What is the execution time of the program
Answer:
1.48 s
Explanation:
Number of instructions = 500 million = 500 * 10⁶
clock rate = 1 / 2.2 GHz = 1 / (2.2 * 10⁹ Hz) = 0.4545 * 10⁻⁹ s
We need to compute the clocks per instruction (CPI)
The CPI = summation of (value * frequency)
CPI = (50% * 3 clock cycles) + (50% * 10 clock cycles)
CPI = (0.5 * 3) + (0.5 * 10) = 1.5 + 5 = 6.5
Execution time = number of instructions * CPI * clock rate
Execution time = 500 * 10⁶ * 6.5 * 0.4545 * 10⁻⁹ =1.48 s