How many times will the while loop that follows be executed? var months = 5; var i = 1; while (i < months) { futureValue = futureValue * (1 + monthlyInterestRate); i = i+1; }

Answers

Answer 1

Answer:

4 times

Explanation:

It will be executed for values 1,2,3 and 4 for i.


Related Questions

Using a variable length array, write a C program that asks the user to enter test scores.Then, the program should calculate the average, determine the lowest test score, determine the letter grade, and display all three.

Answers

Answer:

Here is the C program :

#include<stdio.h>  // to use input output functions

   int main(){  //start of main() function body

   int n;  //to store the number of tests taken

   int test_scores[n], i;  //a variable length array test_score

   float sum=0,average;  //to store the sum and average of test scores

   int lowest;   //to store the lowest test score

   printf("Enter the number of tests taken :");//prompts user to enter number of test scores

   scanf("%d",&n); /  / reads the value of n from user

   printf("Enter test scores: ");  //prompts user to enter test scores

for(i=0; i<n; i++)  {  

 scanf("%d",&test_scores[i]);  //read the values of input test scores

 sum = sum + test_scores[i];   } //calculates the sum of the test scores by adding the values of test scores

        average=sum/n;  // compute the average by dividing sum of all test scores with the total number of test scores

               printf("Average is %.2f",average);  //displays the average

    printf("\nGrade is ");  // prints Grade is

    if (average >= 90) {  //if value of average is greater than or equal to 90

       printf("A");     }  //print the grade letter A

else if(average >= 80 && average < 90)  { //if value of average is greater than or equal to 80 and less than 90

 printf("B");  }   //print the grade letter B

else if(average>60 && average<80){ //if value of average is between 60 and 80

 printf("C");  }  //print the grade letter C

else if(average>40 && average<=60) {  //if value of average is greater than 40 and less than or equals to 60

 printf("D");  }  //print the grade letter D

else  {  //if the value of average is below 40

 printf("F");  }   //print the grade letter F

   lowest = test_scores[0];     //lowest points to the 1st element of test scores means the first input test score

   for (int j = 1; j < n;j++)     {  //loop iterates through the scores

       if (test_scores[j] < lowest)   {  // if the element at j-th index position of test_scores array is less than the element stored in the lowest variable

          lowest = test_scores[j];     }     } //then assign that element value of test_score to the lowest

     printf("\nLowest test score is:  %d.\n", lowest); } //displays the lowest test score

Explanation:

The program is well explained in the comments mentioned with each statement of the code.

The program prompts the user to enter the number of test scores as they are not already specified in the array because array test_scores is a variable length array which means its length is not fixed. The program then prompts the user to enter the test scores. The program then adds all the test scores and store the result in sum variable. Then it computes the average by dividing the value in sum variable to the number of test scores n. Then in order to determine the letter Grade the average value is used. The if else conditions are used to specify conditions in order to determine the Grade. Next the lowest score is determined by setting the value of lowest variable to the first element of the test_scores array. Then using for loop, the index variable j moves to each array element i.e. score and determines if the the value of element is less than that stored in the lowest variable. If the value positioned at j-th index of test_scores is less than that of lowest than this value is assigned to lowest. At last the lowest holds the minimum of the test scores.

The machine has to be returned to the vendor for proper recycling. Which stage of the hardware lifecycle does this scenario belong to?

Answers

Answer:

Decommission/Recycle

Explanation:

This specific scenario that is being described belongs to the final stage of the hardware lifecycle known as Decommission/Recycle. This is when the asset in question has completed its function for an extended period of time and is no longer functioning at maximum efficiency and/or newer hardware has hit the market. Once in this stage, the hardware in question is either repaired or scrapped for resources that can be used to create newer products.

g Write a program that asks for the weight of a package and the distance it is to be shipped. This information should be passed to a calculateCharge function that computes and returns the shipping charge to be displayed . The main function should loop to handle multiple packages until a weight of 0 is entered.

Answers

Answer:

I am writing a C++ program:

#include <iostream>  //to use input output functions

#include<iomanip>  // to format the output

using namespace std;   // to identify objects like cin cout

void calculateCharge(double weight, double distance);   // function prototype

int main(){  //start of main() function body

  double w = 0.0, t = 0.0;  // w variable is for weight and t is for total

   unsigned int d = 0;   // d variable is to hold the value of distance

   calculateCharge(w, d); }  //calls calculateCharge method by passing weight and distance values to this method

void calculateCharge(double weight, double distance){  //method that takes weight and distance as parameters and compute the shipping charge

   double charge = 0.0;  //to store the value of shipping charges

   do {  // do while loop to handle multiple packages until a weight of 0 is entered

       cout << "Enter weight: " << endl;  //prompts user to enter weight

       cin >> weight;  //reads the input weight value

       if (weight == 0){  // if the value of weight is equal to 0

           break; }  // the loop breaks if value of weight is 0

       cout << "Enter distance: " << endl;  // if value of weight is not zero then the program precedes by prompting user to enter the value of distance

       cin >> distance;  //reads the input distance value

       cout << fixed << setprecision(2) << endl;  //set the precision to 2 means the sets the number of digits of an output to 2 decimal places

       if(weight <= 2)  //if the value of weight is less than or equals to 2

charge = (distance/500) * 3.10;  //compute the charge by this formula

else if(weight > 2 && weight <= 6)  //if weight is over 2 kg but not more than 6 kg

charge = (distance/500) * 4.20;  //charge is computed by multiplying value of distance to that of weight and if distance is greater than 500 then it is divided by 500 first

else if(weight > 6 && weight <= 10)  // if weight is over 6 kg but not more than 10 kg

charge = (distance/500) * 5.30;  //compute shipping charges by this formula

else  //if weight is over 10 kg

charge = (distance/500) * 6.40;   // compute shipping charge by multiplying value of distance to that of 6.40 weight value and if distance is greater than 500 then distance is divided by 500 first

cout << "Shipping charges: $" << charge << "\n";   //display the computed shipping charge

   } while (weight != 0);  //the loop continues to execute until weight 0 is entered

}              

Explanation:

The program is explained in the comments mentioned above. The program has a main() function that declares variable for weight, distance and total and then calls calculateCharge() method passing weight and dsitance in order to compute and return the shipping charge.

In calculateCharge() the user is prompted to enter the values for weight and distance. Then the based on the value of weight , the shipping charge is computed. Shipping charge is computed by multiplying the weight with distance. The distance is assumed to be 500 but if the distance entered by user exceeds 500 then the distance value is divided by 500 and then multiplied by the specified weight (according to if or else if conditions) in order to compute shipping charge. The program has a do while loop that keeps taking input from user until the user enters 0 as the value of weight.

The screenshot of the program and its output is attached.

An admission charge for The Little Rep Theater varies according to the age of the person. Develop a solution to print the ticket charge given the age of the person. The charges are as follows:

a. Over 55: $10.00
b. 21-54: $15.00
c. 13-20: $10.00
d. 3-12: $5.00
e. Under 3: Free

Use a Multiple Alternative IF Statement

Answers

Answer:

age = int(input("Enter your age: "))

charge = 0

if age > 55:

   charge = 10

if 21 <= age <= 54:

   charge = 15

if 13 <= age <= 20:

   charge = 10

if 3 <= age <= 12:

   charge = 5

if 0 <= age < 3:

   charge = 0

   

print(charge)

Explanation:

*It is in Python.

Ask the user for the age

Check the each given range and set the charge accordingly using if statements

Print the charge

Consider these functions:_________.
def f(x) :
return g(x) + math.sqrt(h(x))
def g(x):
return 4 h(x)
def h(x):
return x x + k(x)-1
def k(x):
return 2 (x + 1)
Without actually compiling and running a program, determine the results of the following function calls.
a. x1 = f(2)
b. x2 = g(h(2)
c. x3 = k(g(2) + h(2))
d. x4 - f(0) + f(l) + f(2)
e. x5 - f{-l) + g(-l) + h(-1) + k(-l)

Answers

Answer:

x1 = 39

x2 = 400

x3 = 92

x4 = 62

x5 = 0

Explanation:

a. x1 = f(2)

This statement calls the f() function passing 2 to the function. The f(x) function takes a number x as parameter and returns the following:

g(x) + math.sqrt(h(x))

This again calls function g() and h()  

The above statement calls g() passing x i.e. 2 to the function g(x) and calls function h() passing x i.e. 2 to h() and the result is computed by adding the value returned by g() to the square root of the value returned by the h() method.

The g(x) function takes a number x as parameter and returns the following:

return 4*h(x)

The above statement calls function h() by passing value 2 to h() and the result is computed by multiplying 4 with the value returned by h().

The h(x) function takes a number x as parameter and returns the following:

return x*x + k(x)-1

The above statement calls function k() by passing value 2 to k() and the result is computed by subtracting 1 from the value returned by k() and adding the result of x*x (2*2) to this.

The k(x) function takes a number x as parameter and returns the following:

return 2 * (x + 1)

As the value of x=2 So

2*(2+1) = 2*(3) = 6

So the value returned by k(x) is 6

Now lets go back to the function h(x)

return x*x + k(x)-1

x = 2

k(x) = 6

So

x*x + k(x)-1 = 2*2 + (6-1) = 4 + 5 = 9

Now lets go back to the function g(x)

return 4*h(x)

As x = 2

h(x) = 9

So

4*h(x)  = 4*9 = 36

Now lets go back to function f(x)

return g(x) + math.sqrt(h(x))

As x=2

g(x) = 36

h(x) = 9

g(x) + math.sqrt(h(x))  = 36 + math.sqrt(9)

                                  = 36 + 3 = 39

Hence

x1 = 39b. x2 = g(h(2) )

The above statement means that first the function g() calls function h() and function h() is passed a value i.e 2.

As x=2

The function k() returns:

2 * (x + 1)   = 2 * (2 + 1) = 6

The function h() returns:

x*x + k(x)-1 = 2*2 + (6-1) = 4 + 5 = 9

Now The function g() returns:

4 * h(x)  = 4 * h(9)

This method again calls h() and function h() calls k(). The function k() returns:

2 * (x + 1)   = 2 * (9 + 1) = 20

Now The function h() returns:

x*x + k(x)-1 = 9*9 + (20-1) = 81 + 19 = 100

h(9) = 100

Now The function g() returns:

4 * h(x)  = 4 * h(9) = 4 * 100 = 400

Hence

x2 = 400c. x3 = k(g(2) + h(2))

g() returns:

return 4 h(x)

h() returns:

return x*x + k(x)-1

k(2) returns:

return 2 (x + 1)

          = 2 ( 3 ) = 6

Now going back to h(2)

x * x + k(x)-1  = 2*2 + 6 - 1 = 9

Now going back to g(2)

4 h(x)  = 4 * 9 = 36

So k(g(2) + h(2)) becomes:

   k(9 + 36 )

    k(45)

Now going to k():

return 2 (x + 1)

2 (x + 1)   = 2(45 + 1)

             = 2(46)

             = 92

So k(g(2) + h(2)) = 92

Hence

x3 = 92d. x4 = f(0) + f(1) + f(2)

Compute f(0)

f() returns:

return g(0) + math.sqrt(h(0))

f() calls g() and h()

g() returns:

return 4 * h(0)

g() calls h()

h() returns

return 0*0 + k(0)-1

h() calls k()

k() returns:

return 2 * (0 + 1)

2 * (0 + 1)  = 2

Going back to caller function h()

Compute h(0)

0*0 + k(0)-1  = 2 - 1 = 1

Going back to caller function g()

Compute g(0)

4 * h(0)  = 4 * 1 = 4

Going back to caller function f()

compute f(0)

g(0) + math.sqrt(h(0))  = 4 + 1 = 5

f(0) = 5

Compute f(1)

f() returns:

return g(1) + math.sqrt(h(1))

f() calls g() and h()

g() returns:

return 4 * h(1)

g() calls h()

h() returns

return 1*1 + k(1)-1

h() calls k()

k() returns:

return 2 * (1 + 1)

2 * (1 + 1)  = 4

Going back to caller function h()

Compute h(0)

1*1 + k(1)-1  = 1 + 4 - 1 = 4

Going back to caller function g()

Compute g(1)

4 * h(1)  = 4 * 4 = 16

Going back to caller function f()

compute f(1)

g(1) + math.sqrt(h(1))  = 16 + 2 = 18

f(1) = 18

Compute f(2)

f() returns:

return g(2) + math.sqrt(h(2))

f() calls g() and h()

g() returns:

return 4 * h(2)

g() calls h()

h() returns

return 1*1 + k(2)-1

h() calls k()

k() returns:

return 2 * (2+1)

2 * (3)  = 6

Going back to caller function h()

Compute h(2)

2*2 + k(2)-1  = 4 + 6 - 1 = 9

Going back to caller function g()

Compute g(2)

4 * h(2)  = 4 * 9 = 36

Going back to caller function f()

compute f(2)

g(2) + math.sqrt(h(2))  = 36 +3 = 39

f(1) = 13.7

Now

x4 = f(0) + f(l) + f(2)

    = 5 + 18 + 39

    = 62

Hence  

x4 = 62e. x5 = f(-1) + g(-1) + h(-1) + k(-1)

Compute f(-1)

f() returns:

return g(-1) + math.sqrt(h(-1))

f() calls g() and h()

g() returns:

return 4 * h(-1)

g() calls h()

h() returns

return 1*1 + k(-1)-1

h() calls k()

k() returns:

return 2 * (-1+1)

2 * (0)  = 0

Going back to caller function h()

Compute h(-1)

-1*-1 + k(-1)-1  = 1 + 0 - 1 = 0

Going back to caller function g()

Compute g(-1)

4 * h(-1)  = 4 * 0 = 0

Going back to caller function f()

compute f(-1)

g(-1) + math.sqrt(h(-1))  = 0

f(-1) = 0

Compute g(-1)

g() returns:

return 4 * h(-1)

g() calls h()

h() returns

return 1*1 + k(-1)-1

h() calls k()

k() returns:

return 2 * (-1+1)

2 * (0)  = 0

Going back to caller function h()

Compute h(-1)

-1*-1 + k(-1)-1  = 1 + 0 - 1 = 0

Going back to caller function g()

Compute g(-1)

4 * h(-1)  = 4 * 0 = 0

g(-1) = 0

Compute h(-1)

h() returns

return 1*1 + k(-1)-1

h() calls k()

k() returns:

return 2 * (-1+1)

2 * (0)  = 0

Going back to caller function h()

Compute h(-1)

-1*-1 + k(-1)-1  = 1 + 0 - 1 = 0

h(-1) = 0

Compute k(-1)

k() returns:

return 2 (x + 1)

k(-1) = 2 ( -1 + 1 ) = 2 ( 0 ) = 0

k(-1) = 0

x5 = f(-1) + g(-1) + h(-1) + k(-1)

    = 0  + 0 + 0 + 0

    = 0

Hence

x5 = 0

Define a method printAll() for class PetData that prints output as follows with inputs "Fluffy", 5, and 4444. Hint: Make use of the base class' printAll() method. Name: Fluffy, Age: 5, ID: 4444

Answers

Answer and Explanation:

public class petData

{

private int ageYears;

private String fullName;

private int IdNumber;

public void setName (String givenName)

{

fullName = givenName;

return;

}

public void setAge (int numYears)

{

ageYears = numYears;

return;

}

public void setID (int numID)

{

IdNumber = numID;

return;

}

public void printAll ()

{

System.out.print ("Name: " + fullName);

System.out.print (", Age: " + ageYears);

return;

}

}

From the above, we have defined a class petData, with methods setName, setAge, printAll. These methods all make use of the string variable fullName and integer variable ageYears. From the above, setName method sets fullName variable to name given to its string parameter givenName while setAge method does the same with the ageYears variable in initializing it. This is also done by the ID method. These variables are then used by printAll method in printing out the Name and age of the object which would be created with the petData class

E. g: petData dog= new petData();

? Question
Which term describes a population's attitudes and beliefs?
demographics
infographics
psychographics
geographics
psychgraphics
geographics​

Answers

Answer:

psychographics

Explanation:

The study of people according to their attitudes, aspirations and other psychological criteria

Programming Challenge: Test Average CalculatorUsing a variable length array, write a C program that asks the user to enter test scores.Then, the program should calculate the average, determine the lowest test score, determine the letter grade, and display all three.

Answers

Answer:

well you could use variables in C and display them

Explanation:

A company wants a recruiting app that models candidates and interviews; displays the total number of interviews on each candidate record; and defines security on interview records that is independent from the security on candidate records. What would a developer do to accomplish this task? Choose 2 answers


a. Create a roll -up summary field on the Candidate object that counts Interview records.

b. Create a master -detail relationship between the Candidate and Interview objects.

c. Create a lookup relationship between the Candidate and Interview objects.

d. Create a trigger on the Interview object that updates a field on the Candidate object.

Answers

Answer:

c. Create a lookup relationship between the Candidate and Interview objects.

d. Create a trigger on the Interview object that updates a field on the Candidate object.

Explanation:

Objects relationships is considered a form of field type that joins two or more objects together such that, after understanding objects and fields, it creates some form of bonding known as object relationships. This helps define security on interview records that is independent from the security on candidate records.

For an example, in a standard object like Account, where a sales representative opens an account, and has had interviews or chats with a few people at that account’s company, and as well made contacts with the likes of executives or IT managers and still stored those contacts’ information in salesforce.

Hence, what would a developer do to accomplish this task is to:

1. Create a lookup relationship between the Candidate and Interview objects.

2. Create a trigger on the Interview object that updates a field on the Candidate object.

In Network Address and Port Translation (NAPT), which best describes the information used in an attempt to identify the local destination address?

Answers

Answer:

Hello your question lacks the required options here are the options

source IP and destination IPsource IP and destination portsource IP and source portsource port and destination IPsource port and destination port

answer : source IP and destination port

Explanation:

The information that is used in an attempt to identify the local destination address is the source IP and destination port

source IP is simply the internet protocol address of a device from which an IP packet is sent to another device while destination port are the ports found in a destination device that receives IP packets from source ports  they are found in many internet applications  

Describe in detail how TCP packets flow in the case of TCP handoff, along with the information on source and destination addresses in the various headers.

Answers

Answer:

Following are the answer to this question:

Explanation:

There will be several ways to provide it, although it is simpler to let another front side Will work out a three-way handshake or transfer packages to there with a Server chosen. Its application responds TCP packets with both the destination node of the front end.

The very first packet was sent to a computer as an option. Mention, even so, that perhaps the end of the queue end remains in the loop in this scenario. Rather than obtaining this information from the front end like in the primary healthcare services, you have the advantage of this capability: its selected server helps to generate TCP state.

When you sustain program implementation by staying true to the original design, it is termed A. Goals and objectives B. Program fidelity C. Program evaluation D. Program management

Answers

Answer:

Program fidelity

Explanation:

1. Two TCP entities communicate across a reliable network. Let the normalized time to transmit a fixed length segment equal 1. Assume that the end-to-end propagation delay is 3 and that it takes 2 to deliver data from a received segment to the transport user. The receiver initially grants a credit of 7 segments. The receiver uses a conservative flow control policy and updates its credit allocation at every opportunity. What is the maximum achievable throughput

Answers

Answer:

The answer is "0.77"

Explanation:

The fixed-length segment value = 1  

The propagation time of one end to another end is = 3  

The Transfer power to move the consumer from the obtained segment = 2  

The second last sender assigns a loan = 7 segments  

The overall transmission time = 3+2+3   =  8  

The maximum throughput value is:

[tex]\to \frac{7}{(1 + 8)}\\\\ \to \frac{7}{9}\\\\\to 0.77[/tex]

_____ are networks that learn and are capable of performing tasks that are difficult with conventional computers.

Answers

Answer:

Artificial Neural

Explanation:

An artificial neural is the piece of a computing system designed to simulate the way the human brain analyzes and processes information. It is the foundation of artificial intelligence.

An Open Authorization (OAuth) access token would have a _____ that tells what the third party app has access to

Answers

Answer:

scope

Explanation:

An Open Authorization refers to a method  that helps to share data using third party services without giving your credentials and there is a mechanism in an Open Authorization that allows to limit the access that the third party app has to an account that is called scope. Because of that, the answer is that an Open Authorization (OAuth) access token would have a scope that tells what the third party app has access to because it is what limits the access the app has to an account and it shows the access given in a consent screen.

The code below takes the list of country, country, and searches to see if it is in the dictionary gold which shows some countries who won gold during the Olympics. However, this code currently does not work. Correctly add try/except clause in the code so that it will correctly populate the list, country_gold, with either the number of golds won or the string "Did not get gold".
1
​2 gold = {"US":46, "Fiji":1, "Great Britain":27, "Cuba":5, "Thailand":2, "China":26, "France":10}
3 country = ["Fiji", "Chile", "Mexico", "France", "Norway", "US"]
4 country_gold = []
5
​6 for x in country:
7 country_gold.append(gold[x])
8 country_gold.append("Did not get gold")

Answers

Answer:

Modify your program by replacing

for x in country:

       country_gold.append(gold[x])

       country_gold.append("Did not get gold")

with

for x in country:

       try:

               country_gold.append(gold[x])

       except:

               country_gold.append("Did not get gold")

Explanation:

The addition of try/except clause in the program is to let the program manage error;

In this case, the program checks for a country in the list country; This is implemented using the following line

for x in country:

If the country exists, the statement in the try block is executed

try:

 country_gold.append(gold[x])  ->This appends the country name to the country_gold list

Otherwise, the statement in the except clause is executed

except:

 country_gold.append("Did not get gold")  -> This appends "Did not get gold" to the country_gold list

To confirm what you've done, you may add the following line of code at the end of the program: print(country_gold)

Which is the first step in the process of reading materials critically

Answers

Answer:

SQRRR or SQ3R is a reading comprehension method named for its five steps: survey, question, read, recite, and review. The method was introduced by Francis P. Robinson, an American education philosopher in his 1946 book Effective Study. The method offers a more efficient and active approach to reading textbook material

Which are true of the Transmission Control Protocol (TCP)? Multiple answers: You can select more than one option A it supports full duplex communication B it has graceful connection shutdown C its connections are logical D its data is sent as a discrete messages E it is an end-to-end protocol

Answers

Answer:

A, B, C, D and E

Explanation:

Transmission Control protocol (TCP) is a protocol that describes how connections are made and maintained between devices in a network which will help applications in these devices communicate and transmit data.

The following are some of the features of TCP:

i. It supports full duplex communication: In other words, TCP allows for concurrent transmission of data in both directions.

ii. it has a graceful connection shutdown: TCP allows for graceful termination and closing of connection. This means that when there is no more data to be sent by any of the communicating devices, rather than just close connection from its end, it first informs the other device about its completion and asks if it's safe to close the connection. From there, if the other device then says it doesn't have any data to send either, they then reach a consensus to close the connection at their respective ends.

iii. Its connections are logical: TCP makes use of the reliability and flow control mechanisms which require that it initialize and maintain some status information for each stream of data. This status information containing sockets, sequence numbers and window sizes is called a logical connection.

iv. Data is sent as discrete messages: Like other discrete messages, the IP treats the data in TCP as discrete messages by placing them into the IP datagram and transmitting to the target host.

v. It is an end-to-end protocol: TCP governs the way data is transmitted between two devices at their respective ends to ensure reliable delivery. In other words, it is responsible for the transmission of data from a source to one or more destinations. It sits on the operating system of the source and also on the operating system(s) of the destination(s).

Passing structured query language commands to a web application and getting the website to execute it is called SQL script:______.
A) Injection.
B) Processing.
C) Attacking.
D) Execution.

Answers

Answer:

(A) Injection

Explanation:

SQL injection is one of the most common web attacks used by attackers to steal data or compromise a web application (especially the database) by inserting or "injecting" SQL queries or commands through the input data from the web application.

In web applications, form inputs are used to make requests to the database either for validation or submission of data by executing queries in the database. If these queries are interfered with by passing query like commands into the form input fields rather than some regular alphanumeric characters, then we have an SQL injection.

When this happens;

i. the attackers can modify an SQL query to return additional results from the database

ii. the attackers can change a query to interfere with the application's regular logic flow.

iii. the attackers can extract sensitive information about the database such as its version and structure.

C++ Fibonacci
Complete ComputeFibonacci() to return FN, where F0 is 0, F1 is 1, F2 is 1, F3 is 2, F4 is 3, and continuing: FN is FN-1 + FN-2. Hint: Base cases are N == 0 and N == 1.
#include
using namespace std;
int ComputeFibonacci(int N) {
cout << "FIXME: Complete this function." << endl;
cout << "Currently just returns 0." << endl;
return 0;
}
int main() {
int N = 4; // F_N, starts at 0
cout << "F_" << N << " is "
<< ComputeFibonacci(N) << endl;
return 0;
}

Answers

Answer:

int ComputeFibonacci(int N) {

   if(N == 0)

       return 0;

   else if (N == 1)

       return 1;

   else

       return ComputeFibonacci(N-1) + ComputeFibonacci(N-2);

}

Explanation:

Inside the function ComputeFibonacci that takes one parameter, N, check the base cases first. If N is eqaul to 0, return 0. If N is eqaul to 1, return 1. Otherwise, call the ComputeFibonacci function with parameter N-1 and N-2 and sum these and return the result.

For example,

If N = 4 as in the main part:

ComputeFibonacci(4) → ComputeFibonacci(3) + ComputeFibonacci(2) = 2 + 1 = 3

ComputeFibonacci(3) → ComputeFibonacci(2) + ComputeFibonacci(1) = 1 + 1 = 2

ComputeFibonacci(2) → ComputeFibonacci(1) + ComputeFibonacci(0) = 1 + 0  = 1

*Note that you need to insert values from the bottom. Insert the values for ComputeFibonacci(1) and  ComputeFibonacci(0) to find ComputeFibonacci(2) and repeat the process.

Consider the following code segment. It should display a message only if the cost is between 50 and 75 dollars. The message should also be displayed if the cost is exactly 50 dollars or exactly 75 dollars. if _________________ : print("The cost is in the desired range") What condition should be placed in the blank to achieve the desired behavior

Answers

Answer:

In C++ it can be written as:

if(cost>=50&&cost<=75)

   { cout<<"The cost is in the desired range";}

In Python:

if(cost <= 75 and cost>= 50):

   print("The cost is in the desired range")

Explanation:

cost>50&&cost<75 covers the requirement that cost should be between 50 and 75 dollars

But the whole statement cost>=50&&cost<=75 covers the requirement that cost should be between 50 and 75 dollars and message should also be displayed if the cost is exactly 50 dollars or exactly 75 dollars. For example if the value of cost=50 then this message The cost is in the desired range is displayed.

In the above program && in C++, and in Python is used which is a logical operator which means that both the conditions cost <= 75 and cost>= 50 should be true for the if condition to evaluate to true. For example if cost=35 then this message is not printed because both the conditions are false i.e. 35 is neither less than or equal to 75 nor greater than or equal to 50.

state five uses of building​

Answers

Housing, warmth, shelter, to flex on others and pleasure

Hope this helped, but I doubt it(╹◡╹)
Answer

1) Housing

2) Power generation (factories and nuclear reactors)

3) Agriculture (greenhouse)

4) Research (Infectious Diseases Research, isolating different viruses to study them in laboratory conditions)

5) Entertainment and leisure (cinemas, shopping centres)

6) Law and governmental buildings

#The Fibonacci sequence is a number sequence where each #number is the sum of the previous two numbers. The first #two numbers are defined as 0 and 1, so the third number is #1 (0 + 1 = 1), the fourth number is 2 (1 + 1 = 2), the #fifth number is 3 (1 + 2 = 3), the sixth number is 5 #(2 + 3 = 5), and so on.
#
#Below we've started a class called FibSeq. At any time, #FibSeq holds two values from the Fibonacci sequence: #back1 and back2.
#
#Create a new method inside FibSeq called next_number. The #next_number method should:
#
# - Calculate and return the next number in the sequence, # based on the previous 2. # - Update back2 with the former value of back1, and update # back1 with the new next item in the sequence.
#
#This means that consecutive calls to next_number should #yield each consecutive number from the Fibonacci sequence. #Calling next_number 5 times would print 1, 2, 3, 5, and 8.
class FibSeq:
def __init__(self):
self.back1 = 1
self.back2 = 0
def next_number(self):
self.back1=self.back1+self.back2 # updated the back1 value to the next number in the series first
self.back2=self.back1-self.back2 #updated the back2 value with previous back1 value
yield (self.back1) # yielded the next number in the series since it is updated as back1 so yielded back1
f = FibSeq()
for i in range(5): # here i have iterated the series only 5 times u can change it as you like
s=f.next_number()
print(next(s))# here next is an iterator function for the yield generator.
#The code below will test your method. It's not used for
#grading, so feel free to change it. As written, it should
#print 1, 2, 3, 5, and 8.
newFib = FibSeq()
print(newFib.next_number())
print(newFib.next_number())
print(newFib.next_number())
print(newFib.next_number())
print(newFib.next_number())

Answers

Answer:

Here is the next_number method:

def next_number(self): #method to return next number in the sequence

    temporary = self.back1 + self.back2 # adds previous number to next number and stores the result in a temporary variable

    self.back2 = self.back1 #Updates back2 with the former value of back1,

    self.back1 = temporary #update back1 with the new next item in the sequence.

    return temporary #

Explanation:

I will explain the working of the above method.

back1 = 1

back2 = 0

At first call to next_number()  method:

temporary = back1 + back2

                 = 1 + 0

temporary = 1

self.back2 = self.back1

self.back2 = 1

self.back1 = temporary

self.back1 = 1

return temporary

This return statement returns the value stored in temporary variable i.e. 1

Output: 1

back1 = 1

back2 = 1

At second call to next_number()  method:

temporary = back1 + back2

                 = 1 + 1

temporary = 2

self.back2 = self.back1

self.back2 = 1

self.back1 = temporary

self.back1 = 2

return temporary

This return statement returns the value stored in temporary variable i.e. 2

output: 2

back1 = 2

back2 = 1

At second call to next_number()  method:

temporary = back1 + back2

                 = 2 + 1

temporary = 3

self.back2 = self.back1

self.back2 = 2

self.back1 = temporary

self.back1 = 3

return temporary

This return statement returns the value stored in temporary variable i.e. 3

Output: 3

back1 = 3

back2 = 2

At second call to next_number()  method:

temporary = back1 + back2

                 = 3 + 2

temporary = 5

self.back2 = self.back1

self.back2 = 3

self.back1 = temporary

self.back1 = 5

return temporary

This return statement returns the value stored in temporary variable i.e. 5

Output: 5

back1 = 5

back2 = 3

At second call to next_number()  method:

temporary = back1 + back2

                 = 5 + 3

temporary = 8

self.back2 = self.back1

self.back2 = 5

self.back1 = temporary

self.back1 = 8

return temporary

This return statement returns the value stored in temporary variable i.e. 8

Output: 8

Calling next_number 5 times would print 1, 2, 3, 5, and 8.

The complete program along with its output is attached.

#Write a function called string_finder. string_finder should #take two parameters: a target string and a search string. #The function will look for the search string within the #target string. # #The function should return a string representing where in #the target string the search string was found: # # - If search string is at the very beginning of target # string, then return "Beginning". For example: # string_finder("Georgia Tech", "Georgia") -> "Beginning" # # - If search string is at the very end of target string, # then return "End". For example: # string_finder("Georgia Tech", "Tech") -> "End" # # - If search string is in target string but not at the # very beginning or very end, then return "Middle. For # example: # string_finder("Georgia Tech", "gia") -> "Middle" # # - If search string is not in target string at all, then # return "Not found". For example: # string_finder("Georgia Tech", "Idaho") -> "Not found" # #Assume that we're only interested in the first instance #of the search string if it appears multiple times in the #target string, and that search string is definitely #shorter than target string. # #Hint: Don't be surprised if you find that the "End" case #is the toughest! You'll need to look at the lengths of #both the target string and the search string. #Write your function here!

Answers

Answer:

I am writing a Python program:

def string_finder(target,search): #function that takes two parameters i.e. target string and a search string

   position=(target.find(search))# returns lowest index of search if it is found in target string

   if position==0: # if value of position is 0 means lowers index

       return "Beginning" #the search string in the beginning of target string

   elif position== len(target) - len(search): #if position is equal to the difference between lengths of the target and search strings

       return "End" # returns end

   elif position > 0 and position < len(target) -1: #if value of position is greater than 0 and it is less than length of target -1

       return "Middle" #returns middle        

   else: #if none of above conditions is true return not found

       return "not found"

#you can add an elif condition instead of else for not found condition as:

#elif position==-1    

#returns "not found"

#tests the data for the following cases      

print(string_finder("Georgia Tech", "Georgia"))

print(string_finder("Georgia Tech", "gia"))

print(string_finder("Georgia Tech", "Tech"))

print(string_finder("Georgia Tech", "Idaho"))

Explanation:

The program can also be written in by using string methods.

def string_finder(target,search):  #method definition that takes target string and string to be searched

       if target.startswith(search):  #startswith() method scans the target string and checks if the (substring) search is present at the start of target string

           return "Beginning"  #if above condition it true return Beginning

       elif target.endswith(search):  #endswith() method scans the target string and checks if the (substring) search is present at the end of target string

           return "End" #if above elif condition it true return End

       elif target.find(search) != -1:  #find method returns -1 if the search string is not in target string so if find method does not return -1 then it means that the search string is within the target string and two above conditions evaluated to false so search string must be in the middle of target string

           return "Middle"  #if above elif condition it true return End

       else:  #if none of the above conditions is true then returns Not Found

           return "Not Found"

A sample containing 4.30 g of O2 gas has an initial volume of 13.0 L. What is the final volume, in liters, when each of the following changes occurs in the quantity of the gas at constant pressure and temperature.

A sample of 200 g of O, is removed from the 4.30 g of O, in the container.​

Answers

Answer:

Total amount of O₂ occupy volume = 76.50 L

2 .30 gm O₂ occupy volume = 7.48 L

Explanation:

We konw that,

Molar mass of O₂ = 31.9988 gm / mol

1 mole of O₂ = 31.9988 gm

Sample of oxygen = 0.600 mole

Computation:

0.600 mole = 31.9988 × 0.600

0.600 mole = 19.199 gm

Total amount of O₂ = 4.30 + 19.199

Total amount of O₂ = 23.499 gm

Total amount of O₂ occupy volume = 14 × 23.499/4.30

Total amount of O₂ occupy volume = 76.50 L

Total gm of O₂ = 4.30 - 2.00= 4.30 gm

2 .30 gm O₂ occupy volume = 14 × 2.30/4.30

2 .30 gm O₂ occupy volume = 7.48 L

Write a program whose input is a string which contains a character and a phrase, and whose output indicates the number of times the character appears in the phrase. Ex: If the input is:

Answers

Answer:

The program written in python is as follows

def countchr(phrase, char):

     count = 0

     for i in range(len(phrase)):

           if phrase[i] == char:

                 count = count + 1

     return count

phrase = input("Enter a Phrase: ")

char = input("Enter a character: ")

print("Occurence: ",countchr(phrase,char))

Explanation:

To answer this question, I made use of function

This line defines function countchr

def countchr(phrase, char):

This line initializes count to 0

     count = 0

This line iterates through each character of input phrase

     for i in range(len(phrase)):

This line checks if current character equals input character

           if phrase[i] == char:

The count variable is incremented, if the above condition is true

                 count = count + 1

The total number of occurrence is returned using this line

     return count

The main method starts here; This line prompts user for phrase

phrase = input("Enter a Phrase: ")

This line prompts user for a character

char = input("Enter a character: ")

This line prints the number of occurrence of the input charcater in the input phrase

print("Occurence: ",countchr(phrase,char))

Write a program that writes a series of random numbers to a file. Each random number should be in the range of 1 through 1000. The application should let the user specify how many random numbers the file will hold.

Answers

Answer:

The programming language is not stated;

I'll answer this question using python programming language

The program starts here (Lines written in bold are comments and are used for explanatory purpose)

#This line imports the random module into the program

import random

#This line prompts the user to enter the filename

filename = input("Enter file name: ")

#This line prompts the user to enter the number of random numbers to generate

num = int(input("Number of random  numbers: "))

#This line adjusts the filename to a .txt file

filename = filename+".txt"

#This line checks if the filename exists; if yes, it creates and open a new file and if otherwise, it uses the existing filr

f = open(filename,'a+')

#This line iterates through the number of random to generate

for i in range(1,num+1):

     #This line generates random number within the range of 1 to 1000

     n = random.randint(1,1000)

     #This line prints the generated random number to file

     print(n, file = f)

#This line closes the created file

f.close()

Using SQL
Use the blog database
Write a SQL RIGHT OUTER JOIN statement that joins the user_id column from the blog.posts table, the name column of the blog.users table and the body column of the blog.posts table together

Answers

Answer:

Following are the code to this question:

/*using the select statement, that selects column name from the table blog.posts */  

SELECT blog.posts.user_id, blog.posts.body, users.name/*column name user_id, body, name*/  

FROM blog.posts/* use table name blog.posts*/

RIGHT OUTER JOIN users ON blog.posts.user_id = users.id;/*use right join that connect table through user_id*/

Explanation:

In the structured query language, RIGHT JOIN  is used to recovers from both the right side of the table both numbers, although the left table has no sets. It also ensures that even if the 0 (null) documents are linked inside this left table, its entry will always return the outcome row, but still, the number of columns from its left table will be NULL.

In the above-given right join code, the select statements used that selects the column names "user_id, body, and the name" from the table "blog. posts" and use the right join syntax to connect the table through the id.    

Write a Python program that asks the user for a positive, odd value. Once the value is validated determine if the number is Prime (i.e., divisible only by itself and 1.)

Answers

Answer:

val = int(input("Enter a positive odd value "))

flag = True # let the number entered is alreay prime

if(val > 2 and val%2 == 1):  # prime numbers start from 2

   half = int(val/2);

   for div in range(2,half):  # dividing the number from 2 to half of its number

       if(val % div == 0): # if completely divisible

           print("Not prime")

           flag = False   # Changing the status of prime number as false

           break

   if(flag == True):

       print(val, "is a prime number")

else:

   print("Invalid input, Please Enter a valid positive odd number")

Explanation:

Steps:

1. Let us take input from the user using input() method.

2.  Initially, let the number is prime.

3. If the number is negative or even, the go to else part and ask the user for a valid input and terminate the program by giving a message to user.

(We actually check for values greater than 2 because 1 is not considered as  a prime number)

4. If the number is positive and odd, then we keep on dividing the number from 2 to half of its number.

(We actually check for values greater than 2 because 1 is not considered as  a prime number)

5. If the number is divisible, we change the status to False and break the loop.

6. If the flag is still True, we print that it is a Prime number else we print that it is not a prime number.

Please refer to the comments section as well and the attached image for proper indentation of the program.

A technician wants to configure the inbound port of a router to prevent FTP traffic from leaving the LAN.
Which of the following should be placed on the router interface to accomplish this goal?
A. Static routes for all port 80 traffic
B. DHCP reservations for all /24 subnets
C. ACL for ports 20 and 21
D. MAC filtering using wildcards

Answers

Answer:

The technician will want to add ACL for ports 20 and 21

Explanation:

The FTP protocol by default will attempt to use 21 for TCP access and 20 for data access.  By enabling an Access Control List (ACL) on ports 20 and 21, the technician can prevent FTP traffic from leaving the network on the default ports.

Cheers.

Other Questions
The true average diameter of ball bearings of a certain type is supposed to be 0.5 in. A one-sample t test will be carried out to see whether this is the case. What conclusion is appropriate in each of the following situations? (a) n 15 t 1.66 a 0.05 A. Reject the null hypothesis. There is sufficient evidence that the true diameter differs from 0.5 in B. Reject the null hypothesis. There is not sufficient evidence that the true diameter differs from 0.5 in C. Do not reject the null hypothesis. There is sufficient evidence that the true diameter differs from 0.5 in D. Do not reject the null hypothesis. There is not sufficient evidence that the true diameter differs from 0.5 in (b) n 15 t 1.66 a 0.05 Reject the null hypothesis. There is sufficient evidence that the true diameter differs from 0.5 in Reject the null hypothesis. There is not sufficient evidence that the true diameter differs from 0.5 in Do not reject the null hypothesis. There is sufficient evidence that the true diameter differs from 0.5 in Do not reject the null hypothesis. There is not sufficient evidence that the true diameter differs from 0.5 in (c) n 26, t 2.55 a 0.01 A. Reject the null hypothesis. There is sufficient evidence that the true diameter differs from 0.5 in B. Reject the null hypothesis. There is not sufficient evidence that the true diameter differs from 0.5 in C. Do not reject the null hypothesis. There is sufficient evidence that the true diameter differs from 0.5 in D. Do not reject the null hypothesis. There is not sufficient evidence that the true diameter differs from 0.5 in (d) n 26, t 3.95 A. Reject the null hypothesis. There is sufficient evidence that the true diameter differs from 0.5 in B. Reject the null hypothesis. There is not sufficient evidence that the true diameter differs from 0.5 in C. Do not reject the null hypothesis. There is not sufficient evidence that the true diameter differs from 0.5 in D. Do not reject the null hypothesis. There is sufficient evidence that the true diameter differs from 0.5 in The 1854 Ostend Manifesto a. prohibited enslaved labor in the Hawaiian Islands. b. was directed at limiting England's influence in the Caribbean. c. enraged southern enslavers. d. was part of an attempt by the United States to acquire Cuba. e. saw several European powers denounce the American enslaved labor system. Use Kepler's third law to determine how many days it takes a spacecraft to travel in an elliptical orbit from a point 6 965 km from the Earth's center to the Moon, 385 000 km from the Earth's center. MATH HELP ASAP BRAINLIEST!!!! The path followed by a roller coaster as it climbs up and descends down from a peak can be modeled by a quadratic function, where h(x) is the height, in feet, and x is the horizontal distance, also in feet. The path begins and ends at the same height, covers a total horizontal distance of 100 feet, and reaches a maximum height of 250 feet. Which of the functions could be used to model this situation? A. h(x)=-0.1x^2-50x+250 B. h(x)=-0.1(x-50)^2+250 C. h(x)=-0.1(x-100)^2+250 D. h(x)=-0.1x^2+100x+250 It began to rain just as the party goers _____.were leavingare leavinglefthave left y + 2 = -3 (x - 4) Complete the missing value in the solution to the equation. (____, -2) ASL: When counting by tens, sign the first digit and face your palm down follow it up with a zero keep your eyes on your hand sign at chest height Royal Lawncare Company produces and sells two packaged productsWeedban and Greengrow. Revenue and cost information relating to the products follow: Product Weedban Greengrow Selling price per unit $ 9.00 $ 39.00 Variable expenses per unit $ 2.70 $ 14.00 Traceable fixed expenses per year $ 131,000 $ 33,000 Last year the company produced and sold 40,500 units of Weedban and 18,500 units of Greengrow. Its annual common fixed expenses are $101,000. Required: Prepare a contribution format income statement segmented by product lines. these are the poems Poem 1: Fire and Ice by Robert Frost Poem 2: This Is Just to Say by William Carlos Williams 1st paragraph: talk about the similarities of both authors 2nd paragraph: talk about the differences between both authors I need a good and full response for the paragraphs :) Claire is cycling at a speed of 12 miles per hour. Han is cycling at a speed of 8 miles per hour. If they start at the same position, chosen at zero, and bike in straight opposite directions, what will the distance between them be after 45 minutes? The route that the sensation of taste follows is a: Primary axons pass along cranial nerves VII and IX. b: Primary neurons synapse in the nucleus solitarius. c: Secondary neurons synapse in the thalamus. d: Tertiary neurons travel to the primary gustatory cortex. Determine the quotient. Write your answer in scientific notation.(8.4 * 10%) + (1.2 x 102) 4 1/2 +1 3/5 (in the simplest form) in 50 gram portion of cereal 8 grams of it are sugar which of the following represents the present of the 50 grams that is sugara)4b)8c)16d)24 What does the Declaration of Independence say about rights? Given here is the price list of vegetables shown at a Mother Dairy vegetable Booth. Mrs. Khanna brought the following vegetables: potatoes [tex]2 \frac{1}{2} [/tex] onions [tex]3 \: kg[/tex] Peas [tex]1 \frac{1}{2} kg[/tex] Carrots[tex]1 \frac{1}{2} kg[/tex]She Gave a 500 - Rupee note to the man at the counter. How Much balance did she get? How do Run-DMC and the Beastie Boys make more direct connections to rock than some of their rap successors? find the area of the quadrilateral ABCD in which ab=5cm,bc=4.5cm,cd=3.5cm,da=4cm and ac=6.5cm What is the approximate circumference of the circle shown below?