Answer:
See explanation.
Explanation:
Given:
Instruction miss rate = I-cache miss rate = 5% = 0.05
Data miss rate = D-cache miss rate = 4% = 0.04
CPI (without including the stall cycles) = 1.5
Miss Penalty = 40 ns × 3 GHz = 120 cycles
load and store instructions = 25% = 0.25
hit time = 1 clock cycle
a. Compute the number of stall cycles per instruction
Instruction miss cycles = I-cache miss rate * miss penalty
= 0.05 * 120
= 6
Data miss cycles = D-cache miss rate * miss penalty * load and store
instructions
= 0.04 * 120 * 0.25
= 1.2
Total memory stall cycles = Instruction miss cycles + Data miss cycles
= 6 + 1.2
= 7.2
number of stall cycles per instruction = 7.2
b. Compute the overall (cycle per instruction) CPI
CPI (stall) = 1.5 + 7.2
= 8.7
Ideal CPU = CPU time with stalls / CPU time with perfect cache
= I x CPI (stall) x Clock cycle/ I x CPI x Clock cycle
= 8.7 / 1.5
= 5.8
c. Compute the average memory access time (AMAT) in ns.
Combined misses per instruction = 0.05 + 0.25 * 0.04 = 0.06
Combined Miss Rate = Combined misses per I/ 1.25 access per I
Combined Miss Rate = 0.06 / 1.25 = 0.048
Average Memory Access time (AMAT) = Hit time + Miss rate × Miss penalty
= 1 + 0.048 * 120
= 6.7
= 6.76 cycles
= 6.76 / 3
= 2.253 ns
AMAT = 2.253 ns
#We've started a recursive function below called #measure_string that should take in one string parameter, #myStr, and returns its length. However, you may not use #Python's built-in len function. # #Finish our code. We are missing the base case and the #recursive call. # #HINT: Often when we have recursion involving strings, we #want to break down the string to be in its simplest form. #Think about how you could splice a string little by little. #Then think about what your base case might be - what is #the most basic, minimal string you can have in python? # #Hint 2: How can you establish the base case has been #reached without the len() function? #You may not use the built-in 'len()' function.
Answer:
Here is the Python program:
def measure_string(myStr): #function that takes a string as parameter
if myStr == '': #if the string is empty (base case)
return 0 #return 0
else: #if string is not empty
return 1 + measure_string(myStr[0:-1]) #calls function recursively to find the length of the string (recursive case)
#in order to check the working of the above function the following statement is used
print(measure_string("13 characters")) //calls function and passes the string to it and print the output on the screen
Explanation:
The function works as following:
Suppose the string is 13 characters
myStr = "13 characters"
if myStr == '': this is the base case and this does not evaluate to true because myStr is not empty. This is basically the alternate of
if len(myStr) == 0: but we are not supposed to use len function here so we use if myStr == '' instead.
So the program control moves to the else part
return 1 + measure_string(myStr[0:-1]) this statement is a recursive call to the function measure_string.
myStr[0:-1] in the statement is a slice list that starts from the first character of the myStr string (at 0 index) to the last character of the string (-1 index)
This statement can also be written as:
return 1 + measure_string(myStr[1:])
or
return 1 + measure_string(myStr[:-1]) This statement start from 1st character and ends at last character
This statement keeps calling measure_string until the myStr is empty. The method gets each character using a slice and maintains a count by adding 1 each time this statement is returned.The function breaks string into its first character [0:] and all the rest characters [:-1]. and recursively counts the number of character occurrences and add 1. So there are 13 characters in the example string. So the output is:
13
Using Python code.
Fill in the gaps in the nametag function so that it uses the format method to return first_name and the first initial of last_name followed by a period. For example, nametag("Jane", "Smith") should return "Jane S."
def nametag(first_name, last_name):
return("___.".format(___))
print(nametag("Jane", "Smith"))
# Should display "Jane S."
print(nametag("Francesco", "Rinaldi"))
# Should display "Francesco R."
print(nametag("Jean-Luc", "Grand-Pierre"))
# Should display "Jean-Luc G."
Answer:
def nametag(first_name, last_name):
return("{} {[0]}.".format(first_name, last_name))
print(nametag("Jane", "Smith"))
# Should display "Jane S."
print(nametag("Francesco", "Rinaldi"))
# Should display "Francesco R."
print(nametag("Jean-Luc", "Grand-Pierre"))
# Should display "Jean-Luc G."
Explanation:
First you must think about that the question ask about the first letter for last_name, remember [0] is the first letter not [1], the other part is about format function and its order
The format method to return first_name and the first initial of last_name followed by a period in python is represented as follows:
def nametag(first_name, last_name):
return '{} {}.'.format(first_name, last_name[0])
print(nametag("Jane", "Smith"))
print(nametag("Francesco", "Rinaldi"))
print(nametag("Jean-Luc", "Grand-Pierre"))
A function named nametag is declared with the arguments first_name and last_name.
Then it returns the first name and the initial of the last_name using the .format method.
Then we call the function using the print statement with the arguments.
learn more on python code; https://brainly.com/question/17184408?referrer=searchResults
Which advantage of database processing makes it easier to make a change in the database structure?
Answer:
I HOPE IT WORK
Explanation:
An advantage of using the database approach to processing is that it facilitates consistency. True. Users never interact with a database, directly; database interaction is always through the DBMS
If you were the IT manager for a large manufacturing company,what issues might you have with the use of opensource software? What advantage might there be for use of such software?
Answer: Having the ability to change the source code to fit your needs
Explanation:
The final step of the decision-making model is to make your decision and take action.
Answer:
No, it is not the final step in decision-making model. It is rather the penultimate stage of the model of decision making.
Explanation:
The final step of the decision-making model is reviewing your decision and its consequences. The decision-making model has total of 7 steps. One should follow these all the steps to make it error free and more efficient then it rather would have been when the decision was made without following it.
The very first step of this model is to identify the decision. And it is one of the most important steps to be followed to avoid any error.
Select the components of a search engine.
a. robot
b. database
c. search form
d. all of the above
Answer:
C because whatever a search engine is it will need a search form to do its job, so C (maybe d)
Java provides a number of interfaces and classes to systematically implement collections.
a. True
b. False
Answer:
A) True
Explanation:
Java provides collections architecture or framework used to store and manipulate a group of objects or collections.
The collection framework has interfaces which include; Set, Queue, Deque, List, as well as classes which include; Hashset, ArrayList, LinkedList, LinkedHashset, PriorityQueue, Vector and TreeSet.
There are also many methods declared in the collection interface which include; add(), addAll(), remove(), removeAll(),retainAll(), clear(), size(), iterator(), toArray() etc
Why would you set up a workbook to be shared if you are the only one using the workbook?
a. You can send emails of your edits to yourself.
b. You can track changes.
c. You can make a draft copy of the workbook.
d. You can password protect the workbook.
Answer:
b. You can track changes.
Explanation:
Setting up a workbook to be shared if you are the only one using the workbook is to enable you track the changes that may occur.
When sharing a workbook, you can allow users gain access to it, make changes and then you easily track those changes.
It makes a team to work simultaneously on the same workbook.
A work book is a file that consists of more than work sheet that helps you to organize A workbook can be created from a blank workbook or a template.
MS excel has a collection of many work books and many worksheets that can help in keeping the track of changes. They are arranged in a network of rectangle cells. In the tabular form of rows and columns.Hence the option B is correct.
Learn more about the set up of a workbook to be shared if you.
brainly.in/question/20376644.
Vector testGrades contains NUM_VALS test scores. Write a for loop that sets sumExtra to the total extra credit received. Full credit is 100, so anything over 100 is extra credit. Ex: If testGrades = {101, 83, 107, 90}, then sumExtra = 8, because 1 + 0 + 7 + 0 is 8.
Answer:
Here is for loop that sets sumExtra to the total extra credit received. I am writing a program in C++
for(i = 0; i <= testGrades.size() - 1; i++){
if(testGrades.at(i) > 100){
sumExtra = sumExtra + (testGrades.at(i) - 100); } }
Explanation:
The complete program is:
#include <iostream> //to use input output functions
#include <vector> //to use vectors
using namespace std; //to identify objects like cin cout
int main() { //start of main function
const int NUM_VALS = 4; // sets the value of NUM_VALS as a constant to 4
vector<int> testGrades(NUM_VALS); // initialize the vector of int (integer) type
int i = 0; // i is initialzed to 0
int sumExtra = 0; //stores the total extra credit
testGrades.at(0) = 101; //sets 101 at first position in vector
testGrades.at(1) = 83; //sets value 83 at second position
testGrades.at(2) = 107; //sets value 107 at third position
testGrades.at(3) = 90; //sets value 90 at fourth position
for(i = 0; i <= testGrades.size() -1; i++){ //loop iterate through each value of in a vector testGrades
if(testGrades.at(i) > 100){ // if the value in a vector exceeds 100
sumExtra = sumExtra + (testGrades.at(i) - 100); } } //computes total extra credit
cout << "sumExtra: " << sumExtra << endl;} //displays the value of computed total extra credit in output
The loop works as follows:
In the first iteration the value of vector testGrades at(i) is at(0) = 101.
if statement checks if this value/element is greater than 100. This is true as 101 > 100. So sumExtra = sumExtra + (testGrades.at(i) - 100); statement is executed in which 100 is subtracted from that element and the result is added to the sumExtra. sumExtra is initialized to 0 so the value of sumExtra becomes: 0+ 101 - 100= 1 So the value of sumExtra = 1
In the second iteration the value of i = 1 and it is positioned at 2nd value of vector testGrades i.e. 83. Then if statement checks if this value/element is greater than 100. This is false as 83 < 100. So the value of sumExtra = 1
In the third iteration the value of i = 2 and it is positioned at 3rd value of vector testGrades i.e. 107. Then if statement checks if this value/element is greater than 100. This is true as 107 > 100.
sumExtra = sumExtra + (testGrades.at(i) - 100); statement is executed in which 100 is subtracted from that element and the result is added to the sumExtra
sumExtra is 1 so the value of sumExtra becomes: 1+ 107 - 100= 8 So the value of sumExtra = 8
In fourth iteration the value of i = 3 and it is positioned at 4th value of testGrades vector i.e. 90. Then the if statement checks if this element is greater than 100. This is false as 90 < 100. So the value of sumExtra remains 8.
Finally the loop breaks as the value of i becomes 4. So the output is 8.
Answer:
sumExtra = 0;
for (i = 0; i < NUM_VALS; ++i) {
if (testGrades[i] >= 101) {
sumExtra += (testGrades[i] - 100);
}
}
cout << "sumExtra: " << sumExtra << endl;
Explanation:
what keyboard command that will allow you to copy text
Answer:
Control + c
Explanation:
If you click and drag over text to highlight it and press on the control or command key (CTRL) and the "C" key, it will copy the text. When you want to paste it, you press control or command key (CRTL) and key "V" at the same time.
The balanced F measure (a.k.a. F1) is defined as the harmonic mean of precision and recall. What is the advantage of using the harmonic mean rather than "averaging" (using the arithmetic mean)?
Answer:
Because the value derived from harmonic mean reflects the credible result of search engine
Explanation:
Given that the value of arithmetic mean tends to be closer to the highest value between Precision and Recall, while the value of the harmonic mean, is the lowest value between Precision and Recall, in a situation where all documents relevant to a query are returned, where R = 1 and P is closer to 0, the arithmetic mean will be greater than 0.5 and will not reflects the credible result of search engine
However, if the harmonic mean is utilized, the value will be closer to the low Precision value, hence it closely reflects the credible result of search engine
Error messages are a key part of an overall interface design strategy of guidance for the user. Discuss strategies to ensure integrated, coordinated error messages that are consistent across an application.
Answer:
Answered below
Explanation:
In order to not discourage the user, error messages must be implemented in a user-friendly way with the use of strategies which ensure coordination, consistency and simplicity.
Error messages should be short, direct and communicate clearly, the right amount of information to a user. These messages should be sorted into categories which represent different kinds of errors. These specific categories should have a brief alphanumeric code that can be easily shared with a customer support personnel for solution and also to help users search for solutions themselves, on the internet.
definition of letter in communication skills
Answer:
Explanation:A letter is a written message conveyed from one person to another person through a medium. Letters can be formal and informal. Besides a means of communication and a store of information, letter writing has played a role in the reproduction of writing as an art throughout history.
Answer:
A letter is a written message conveyed from one person to another person through a medium. Letters can be formal and informal. Besides a means of communication and a store of information, letter writing has played a role in the reproduction of writing as an art throughout history.
Excellent written and verbal communication skills. Confident, articulate, and professional speaking abilities (and experience) Empathic listener and persuasive speaker. Writing creative or factual. Speaking in public, to groups, or via electronic media. Excellent presentation and negotiation skills.The following are types of numbers except one. Select the one which is not an integer.
A. Float
B. Int
C. Long
D. Boolean
Answer:
D) Boolean
Explanation:
Int, Float, Long and Boolean are commonly used data types in programming languages. Of these data types, the Boolean data type, named after George Boole, does not represent a numerical value. Rather it has one of two possible values, True and False. These values represent the two truth values of logic and Boolean algebra.
The Boolean data type is basically associated with conditional statements which specifies different actions to be taken depending on whether the Boolean condition evaluates to true or false. Therefore it influences the control flow of a program.
1. For what purposes do you use the internet? State at least 3. 2. What is the benefits of using the internet? State atleast 3 with explanations. 3. What website do you mainly use? How often do you visit these website? 4. What browser do you use for searching information in the web? 5. Have you tried communicating through the internet? If yes, how did the internet improve your communication with others? ANSWER IN 5 SENTENCES 6. It is true that the coming of the internet has brought us even more opportunities compared than before but what is your opinion about its influence on the people of this modern world, especially younger generations? ANSWER IN 5 SENTENCES non se nse, unacceptable or inapropriate answers will be r e por ted :) mind you
Explanations
__________________________________________________________
1: Education, entertainment, notifications, etc.
2: The internet is a fast, easy and effeciant way to communicate. other reasons may be for banking purposes, online grocery shopping, etc.
3 & 4: Self answerable questions.
5: Common communication nowadays is texting, phone calls, etc. It's easier to press a button or two to send out information than what it used to be. For example, it often took days, weeks, and even months for messages to be sent from one location to a far-flung position.
6: ( MY OPINION ) I feel like the internet is (in a lot of ways) bad for the younger generation and the ( soon to come ). There are alot of online predators, blogs/websites that have inappropriate content. It's quite easy for a teen to just go to a po**ographic site nowadays, type in his/her email and just simply watch it like that. Some of them don't require sign up to view videos, images, gifs. And about the online predator situation, a lot of teenagers (girls AND boys) often feel pressured into sending images of themselves now.
__________________________________________________________
If you’re storing some personal information like Debit/Credit card numbers or Passwords etc, on different sites for running you’re E-business. Do you think that cookies are stored and maintain such information on the server-side and hackers can''t steal user''s information from these cookies easily? Do you agree with the above statement? Please give short comments in favor of or against the statement.
Answer:
No, hackers can steal information from cookies. This many times depend on the type of cookies.
Cookies, by general definition, are programs embedded onto browsers which collect non-invasive information about our activities such so that it can adapt to our needs.
The type of information that a cookie collects depends on what type of cookie it is.
Session Cookies: These types of cookies only collect information about the movement of the user on the website such as pages visited, products that were examined (for e-commerce websites) and products/services that the user put in their cart.
These type of cookies are temporary and are deleted as soon as the browser is shut down.
Persistent Cookies:
These do the same thing that the Session cookies do only that they are more permanent and are stored in a text file even after the browser and the computer has been shut down.
It is these types of cookies that pose a threat. These type of cookies many store codes and passwords and log-in details which may be exploited by a hacker.
Cheers!
1. For what purposes do you use the internet? State at least 3. 2. What is the benefits of using the internet? State atleast 3 with explanations. 3. What website do you mainly use? How often do you visit these website? 4. What browser do you use for searching information in the web? 5. Have you tried communicating through the internet? If yes, how did the internet improve your communication with others? ANSWER IN 5 SENTENCES 6. It is true that the coming of the internet has brought us even more opportunities compared than before but what is your opinion about its influence on the people of this modern world, especially younger generations? ANSWER IN 5 SENTENCES non se nse, unacceptable or inapropriate answers will be r e por ted :) mind you
Answer:
1) communication
entertainment
sharing information and news
2) helps to easily get access to any sort of information
we can easily come to know the recent happenings in the world
helps to communicate with people living in other countries
helps in earning money through online jobs
3) wiki(wikipedia) whenever needed
4) google chrome
5) yes.
sorry i don know what to say
6) i think internet has both good and bad effects on younger generations.its helping them with their work but also kind of misleading them too.
Explanation:
Assume the following Python code has already executed.
import os
cwd = os.getcwd()
Which answer is most likely output from the following Python statement?
os.path.join(cwd, 'Documents/file.txt')
Select one:
a. ['Music', 'Pictures', 'Desktop', 'Library', 'Documents', 'Downloads']
b. False
c. True
d. /Users/me
e. /Users/me/Documents/file.txt
e. /Users/me/Documents/file.txt
The Python statement is an illustration of file manipulations
The output from the Python statement is: (e) /Users/me/Documents/file.txt
From the given statement, the first line imports the Python os module.
While the second line gets the current working file path.
So, the statement os.path.join(cwd, 'Documents/file.txt') means that:
The current working file path is Documents/file.txt
Hence, the output from the Python statement is: (e) /Users/me/Documents/file.txt
Read more about file manipulations at:
https://brainly.com/question/19386916
A smart refrigerator can use _____ to detect when you are running low on milk, and then send a reminder to you on a wireless network.
Answer:
IoTs
Explanation:
Arrays save space because all elements of an array are stored in a single memory location while a list of variables needs a separate location for each variable.
a. True
b. False
Answer:
The correct option is A True
Explanation:
Arrays are implemented to store sevaral variables of the same type as a single array object in java for example. The arrays therefore acts as a container that can store several variables of the same type hence preventing the need to declare those variables seperately thus giving more code efficiency and better storage space management.
Write a copy assignment operator for CarCounter that assigns objToCopy.carCount to the new objects's carCount, then returns *this. Sample output for the given program:
Answer:
Here is the copy assignment operator for CarCounter:
CarCounter& CarCounter::operator=(const CarCounter& objToCopy) {
carCount = objToCopy.carCount;
return *this; }
The syntax for copy assignment operator is:
ClassName& ClassName :: operator= ( ClassName& object_name)
In the above chunk of code class name Is CarCounter and object name is objToCopy.
Assignment operator = is called which assigns objToCopy.carCount to the new objects's carCount.
This operator basically is called when an object which is already initialized is assigned a new value from another current object.
Then return *this returns the reference to the calling object
Explanation:
The complete program is:
#include <iostream> //to use input output functions
using namespace std; //to access objects like cin cout
class CarCounter { //class name
public: // public member functions of class CarCounter
CarCounter(); //constructor of CarCounter
CarCounter& operator=(const CarCounter& objToCopy); //copy assignment operator for CarCounter
void SetCarCount(const int setVal) { //mutator method to set the car count value
carCount = setVal; } //set carCount so setVal
int GetCarCount() const { //accessor method to get carCount
return carCount; }
private: //private data member of class
int carCount; }; // private data field of CarCounter
CarCounter::CarCounter() { //constructor
carCount = 0; //intializes the value of carCount in constructor
return; }
// FIXME write copy assignment operator
CarCounter& CarCounter::operator=(const CarCounter& objToCopy){
/* copy assignment operator for CarCounter that assigns objToCopy.carCount to the new objects's carCount, then returns *this */
carCount = objToCopy.carCount;
return *this;}
int main() { //start of main() function
CarCounter frontParkingLot; // creates CarCounter object
CarCounter backParkingLot; // creates CarCounter object
frontParkingLot.SetCarCount(12); // calls SetCarCount method using object frontParkingLot to set the value of carCount to 12
backParkingLot = frontParkingLot; //assigns value of frontParkingLot to backParkingLot
cout << "Cars counted: " << backParkingLot.GetCarCount(); //calls accessor GetCarCount method to get the value of carCount and display it in output
return 0; }
The output of this program is:
Cars counted = 12
Can folders have mixed apps?
Answer:
what
Explanation:
The figure below shows a black and white image with a resolution of 720×504. Identify how much memory (in bits) will be occupied by this image in the hard drive of your computer, if it is stored. (2 marks)
Answer:
362880
Explanation:
In black and white images each pixel is 1 bit. You need to first find the total number of pixels, to do this you multiply the width and length of the picture (720x504) and you will get 362880. From there you would multiply the amount of pixels by how many bits each pixel is. In this case, since its black and white you multiply it by 1, which is 362880.
Write a program that reads a person's first and last names separated by a space, assuming the first and last names are both single words. Then the program outputs last name, comma, first name. End with newline. Example output if the input is: Maya Jones
Complete Question:
Write a program that reads a person's first and last names, separated by a space. Then the program outputs last name, comma, first name. End with newline.
Example output if the input is: Maya Jones
Jones, Maya
In C++
Answer:
The program written in C++ is as follows
#include<iostream>
using namespace std;
int main(){
string lname, fname;
cout<<"First name: ";
cin>>fname;
cout<<"Last name: ";
cin>>lname;
cout<<lname<<", "<<fname;
return 0;
}
Explanation:
This line declares lname, fname as string to get the user's last name and first name, respectively
string lname, fname;
This line prompts the user for first name
cout<<"First name: ";
This line gets the user first name
cin>>fname;
This line prompts the user for last name
cout<<"Last name: ";
This line gets the user last name
cin>>lname;
This line prints the desired output
cout<<lname<<", "<<fname;
The program in Python is
person_name = input("Enter your first name and last name separated
by space: ")
split_names = person_name.split( )
first_name = split_names[0]
last_name = split_names[1]
print(last_name + ", " + first_name)
The first line of the program requests the first and last names as a single string, separated by a space.
The next line splits the name into first and last names
Finally, the print statement displays the names reversed, but separated with a comma
See another example of a Python program here: https://brainly.com/question/21861447
The factorial of a nonnegative integer n is written n ! (pronounced "n factorial") and is defined as follows: n ! = n · (n - 1) · (n - 2) · … · 1 (for values of n greater than or equal to 1) and n ! = 1 (for n = 0). For example, 5! = 5 · 4 · 3 · 2 · 1, which is 120.
a) Write a program that reads a nonnegative integer and computes and prints its factorial.
b) Write a program that estimates the value of the mathematical constant e by using the formula:
e = 1 + 1/1! +1/2! + 1/3! +.......
c) Write a program that computes the value of by using the formula
e^x = 1 + x/1! + x^2/2! + x^3/3! +.......
Answer:
Here are the programs. I am writing C++ and Python programs:
a)
C++
#include<iostream>
using namespace std;
int factorial(int number) {
if (number == 0)
return 1;
return number * factorial(number - 1); }
int main() {
int integer;
cout<<"Enter a non negative integer: ";
cin>>integer;
cout<< "Factorial of "<< integer<<" is "<< factorial(integer)<< endl; }
Python:
def factorial(number):
if number == 0:
return 1
return number * factorial(number-1)
integer = int(input("Enter a non negative integer: "))
print("Factorial of", integer, "is", factorial(integer))
b)
C++
#include <iostream>
using namespace std;
double factorial(int number) {
if (number == 0)
return 1;
return number * factorial(number - 1); }
double estimate_e(int num){
double e = 1;
for(int i = 1; i < num; i++)
e = e + 1/factorial(i);
cout<<"e: "<< e; }
int main(){
int term;
cout<<"Enter a term to evaluate: ";
cin>>term;
estimate_e(term);}
Python:
def factorial(number):
if number == 0:
return 1
return number * factorial(number-1)
def estimate_e(term):
if not term:
return 0
else:
return (1 / factorial(term-1)) + estimate_e(term-1)
number = int(input("Enter how many terms to evaluate "))
print("e: ", estimate_e(number))
c)
C++
#include <iostream>
using namespace std;
int main(){
float terms, sumSeries, series;
int i, number;
cout << " Input the value of x: ";
cin >> number;
cout << " Input number of terms: ";
cin >> terms;
sumSeries = 1;
series = 1;
for (i = 1; i < terms; i++) {
series = series * number / (float)i;
sumSeries = sumSeries + series; }
cout << " The sum is : " << sumSeries << endl; }
Python
def ePowerx(number,terms):
sumSeries = 1
series =1
for x in range(1,terms):
series = series * number / x;
sumSeries = sumSeries + series;
return sumSeries
num = int(input("Enter a number: "))
term=int(input("Enter a number: "))
print("e^x: ",ePowerx(num,term))
Explanation:
a)
The program has a method factorial that takes numbers as parameter and computes the factorial of that number by using recursion. For example if the number = 3
The base case is if (number == 0)
and
recursive is return number * factorial(number - 1);
Since number = 3 is not equal to zero so the method calls itself recursively in order to return the factorial of 3
return 3* factorial(3- 1);
3 * factorial(2)
3* [2* factorial(2- 1) ]
3 * 2* [ factorial(1)]
3 * 2 * [1* factorial(1- 1) ]
3 * 2 * 1* [factorial(0)]
Now at factorial(0) the base condition is reached as number==0 So factorial(0) returns 1
Now the output is:
3 * 2 * 1* 1
return 6
So the output of this program is
Factorial of 3 is 6
b)
The method estimate_e takes a number i.e. num as parameter which represents the term and estimates the value of the mathematical constant e
The for loop iterates through each term. For example num = 3
then
e = e + 1/factorial(i);
The above statement calls works as:
e = 1 + 1/1! +1/2!
since the number of terms is 3
e is initialized to 1
i is initialized to 1
So the statement becomes:
e = 1 + 1/factorial(1)
factorial function is called which returns 1 since factorial of 1 is 1 So,
e = 1 + 1/1
e = 2
Now at next iteration at i = 2 and e = 2
e = 2 + 1/factorial(2)
e = 2 + 1/2
e = 2.5
Now at next iteration at i = 3 and e =3
e = 3 + 1/factorial(3)
e = 3 + 1/6
e = 3.16666
So the output is:
e: 3.16666
c)
The program computes the sum of series using formula:
e^x = 1 + x/1! + x^2/2! + x^3/3! +...
The for loop iterates till the number of terms. Lets say in the above formula x is 2 and number of terms is 3. So the series become:
e^x = 1 + x/1! + x^2/2!
So number = 2
terms = 3
series =1
sumSeries = 1
i = 1
The statement series = series * number / (float)i; works as following:
series = 1 * 2 /1
series = 2
sumSeries = sumSeries + series;
sumSeries = 1 + 2
sumSeries = 3
At next iteration: i=2, series =2 , sumSeries =3
series = 2 * 2/2
series = 2
sumSeries = 3 + 2
sumSeries = 5
Now the loop breaks as i=3
So output returns the value of sumSeries i.e. 5
Output:
e^x: 5
Outline a scenario in which you might be acting ethically but might still want to remain anonymous while using the Internet. How might someone learn your identity even if you attempt to remain anonymous?
Answer:
I would like to stay anonymous while criticizing the current government. As there have been many cases when people who wrote against the government's decisions were caught by the police.
So I would prefer to stay anonymous while commenting on various government policies. My friends would know about it because I share my posts only with them.
The government can know about my identity by ordering the social networking site to reveal it.
One scenario in which you can act ethically but still remain anonymous when using the internet could be to guarantee your freedom of expression on a certain subject, sharing your ideas in the way you think is ideal for the situation.
Is anonymity on the internet legal?It is protected by the US Supreme Court under the First Amendment, but its protection is balanced, that is, anonymity on the internet can be dissolved and the user can be found if the use of this function occurs to commit cyber crimes.
Therefore, it is essential that every individual action on the internet and outside of it is based on ethics and legality, so that there is an orderly and positive society for all citizens.
Find out more information about cyber crimes here:
https://brainly.com/question/25157310
Explain 3 ways you can be an upstander when seeing cyberbullying.
Answer:
Assuming an upstander is someone that opposes cyberbullying:
(1) Call them out
(2) Report the behavior to proper moderation authority
(3) Tell the person to block messages from the cyberbully
I don't really know what else you want from this.
Cheers.
Dani wants to create a web page to document her travel adventures. Which coding language should she use? HTML Java Python Text
Answer:
HTML, CSS, JavaScript, python, SQL
Explanation:
To create a web page for her travel adventures Dani has to use HTML and CSS to design the page's layout. A beautiful simple design such as one which shows photos of her on her travel destinations, and a paragraph for her to write a little story on her travels would do.
Dani needs JavaScript to animate the photos she's going to post on the page. Dani also should use python to build the backend of her page so she can write codes to save and access her documented adventures from the database. She should use a database language like SQL to save all of her adventures so she can view them at a later time for the memories.
Answer:
Dani should use HTML
Explanation:
You are entering command that operates on a file. The path to the file is lengthy and confusing and you are afraid that you will misspell part of it. You can help yourself out via the use of:________
Complete Question:
You are entering command that operates on a file. The path to the file is lengthy and confusing and you are afraid that you will misspell part of it. You can help yourself out via the use of?
Group of answer choices
A. Wildcard
B. The Tab key
C. Regular expressions
D. The Escape key
Answer:
B. The Tab key
Explanation:
In this scenario, You are entering command that operates on a file. The path to the file is lengthy and confusing and you are afraid that you will misspell part of it. You can help yourself out via the use of the Tab key.
When working with the command line prompt (cmd) on a Windows, Unix or Linux computer, typing file paths is sometimes difficult or considered to be a burden because they are lengthy (too long) and perhaps confusing to the user. To help yourself out, you can always use the "Tab key" to autocomplete names of directories or file paths in an alphabetical order, while in the command line.
Additionally, pressing the "Tab key" continuously while in the command line would cycle or toggle all available commands in an alphabetical order.
Write a program to complete the task given below: Ask the user to enter any 2 numbers in between 1-10 and add both of them to another variable call z. Use z for adding 30 into it and print the final result by using variable results.
Answer:
a = int(input("Enter first value between 1 - 10"))
b = int(input("Enter second value between 1 - 10"))
z = a + b
z += 30
print("The value of z = ", z)
Explanation:
The code is written above in python language to perform the given task.
Now, let us explain each statement of code.
Step 1: The first two lines take input from the user prompting the user to enter the values between 1 to 10.
Then the values are type casted to int using int().
The values are stored in variables a and b.
Step 2: Then, the values of a and b are added to get another variable z.
Step 3: The statement 'z += 30' is equivalent to z = z+30
It adds 30 to the variable z and stores it in the same variable z.
Step 4: Finally the value of variable 'z' is printed using print() command.