3. What is the output of the following program ? (2pts) = int Alpha [6] [600,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
3. What is the output of the following program ? (2pts) = int Alpha [6] [600, 500, 400, 300, 200, 100}; int i; for (i=5; i > 0; i--) cout << Alpha[i] << 4. Given a 5000-element integer array Alpha[], which of the code fragments below could be used to print out the values of Alpha[1], Alpha[3], Alpha[5], and so forth? (2pts) = 1) for (int i 0; i < 5000; i = i + 2) cout << Alpha[i] << endl; 2) for (int i = 0; i < 2500; i++) cout << Alpha [2*i + 1] << endl; 3) for (int i = 0; i < 2500; i++) cout << Alpha[i]*2 - 1 << endl; 4) all of the above 5) 1 and 2 only 6) none of these 5. You are given a main function as following: main() { for (int i=0; i<8; i++) cout << } " << calc_function(i); Output of the program is: 1 1 2 6 24 120 720 5040 Write out the calc_function that will provide the output above. (4pts) 3. What is the output of the following program ? (2pts) = int Alpha [6] [600, 500, 400, 300, 200, 100}; int i; for (i=5; i > 0; i--) cout << Alpha[i] << 4. Given a 5000-element integer array Alpha[], which of the code fragments below could be used to print out the values of Alpha[1], Alpha[3], Alpha[5], and so forth? (2pts) = 1) for (int i 0; i < 5000; i = i + 2) cout << Alpha[i] << endl; 2) for (int i = 0; i < 2500; i++) cout << Alpha [2*i + 1] << endl; 3) for (int i = 0; i < 2500; i++) cout << Alpha[i]*2 - 1 << endl; 4) all of the above 5) 1 and 2 only 6) none of these 5. You are given a main function as following: main() { for (int i=0; i<8; i++) cout << } " << calc_function(i); Output of the program is: 1 1 2 6 24 120 720 5040 Write out the calc_function that will provide the output above. (4pts)
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
"internet radios" for streaming audio, and personal video recorders and players. Describe design and evaluation processes that could be used by a start-up company to improve the usability of such...
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
Below are three independent and unrelated errors. a. On December 31, 2020, Wolfe-Bache Corporation failed to accrue salaries expense of $1,800. In January 2021, when it paid employees for the...
-
The following situations occur independently. 1. A company knows that it will require a large quantity of euros to pay for some imports in three months. The current exchange rate is satisfactory, and...
-
Five point charges, all with q = 7.5 C, are spaced equally along a semicircle as shown in Figure P17.48. If the semicircle has a radius of 2.3 m, what are the magnitude and direction of the electric...
-
Assume the same information as in question 4. Also assume that beginning work in process had \($6,000\) in conversion cost and that \($84,000\) in conversion is added during this period. What is the...
-
Optix Camera Shop uses the lower-of-cost-or-market basis for its inventory. The following data are available at December 31. Instructions Determine the amount of the ending inventory by applying the...
-
Information (feedback) from customers that use a large number of Charm Financial Bank's products or earn significantly more money annually than other customers may be useful, but particular attention...
-
What is the present value of a $20 million pool of 15-year mortgages with an 8.5 percent per year monthly mortgage coupon if market rates are 5 percent? The GNMA guarantee fee is 5 basis points and...
-
I walked into the empty restaurant in Managua carrying a backpack stuffed with cash, thick stacks of Nicaraguan crdobas bound by rubber bands. The waiter, as expected, asked me to hand over the...
-
Assume that, before purchasing Acuxen, a patient in a pharmacy asked the pharmacist about the product and that the pharmacist remarked that in his opinion the product seemed to be effective for...
-
This is an administrative hearing before the DEA, not a court case. The pharmacist in this case initially meant well by refilling a narcotic prescription for an employee that he was certain would be...
-
To make a zig-zag pattern, a graphic designer sketches two parallel line segments. Then the designer draws blue and green triangles as shown below. A B C D K E F G
-
The pharmacist in this case was an employee at will, which means that he was not subject to an employment contract and as such could be terminated for any reason or no reason at all. Despite this...
-
Create an Eclipse Java project that utilize attached "Selection Sort" and "Binary Search" algorithms to search for an Employee object in an Employee[] of size 5, for which, need to write an Employee...
-
On January 2, 20X3, Sheldon Bass, a professional engineer, moved from Calgary to Edmonton to commence employment with Acco Ltd., a large public corporation. Because of his new employment contract,...
-
Write a three-file program based on the following namespace: namespace SALES { const int QUARTERS = 4; struct Sales { double sales[QUARTERS]; double average; double max; double min; }; // copies the...
-
Write a program that asks the user to enter his or her first name and then last name, and that then constructs, stores, and displays a third string consisting of the users last name followed by a...
-
Do the same problem as described in Programming Exercise 4, except make it a template function: template int reduce(T ar[], int n); Test the function in a short program, using both a long...
-
A candlestick chart is similar to a bar chart except that the candlestick chart: A. Represents upward movements in price with Xs. B. Also graphically shows the range of the periods highs and lows. C....
-
What considerations might encourage a market analyst to rely more on a top-down or bottom-up forecast of S&P 500 operating earnings?
-
Which of the following advantages listed by Ryan with respect to the earnings-based approach studied by Atkinson is most likely correct? The model A. Can be used for non-U.S. equity markets. B....
Study smarter with the SolutionInn App