Reference no: EM13690147
Refer the following program segment.
Question: Assume that all variables are of type int. z = 0; g = 0; s = 0; i = 0; while (i < 50){ scanf (“%dâ€, &t); s = s + t; if (t >= 0) g = g + 1; else z = z + 1; i = i + 1; }
Part 1.How many time is the loop body of the while statement executed? a) once, b) never, c) 49 times, d) 50 times, e) until a number 50 or larger is entered
Part -2 .The value stored in variable s at the end of the execution of the loop could best be described as a) the average of the numbers scanned, b) the sum of the numbers scanned, c) the largest of the numbers scanned, d) how many numbers were scanned, e) the sentinel value
Part 3.The value stored in variable z at the end of the execution of the loop could best be described. a) how many positive items were scanned, b) the sum of all positive items scanned, c) how many negative items were scanned, d) the sum of all negative items scanned, e) the sentinel value
Part 4.The loop can best be categorized as a. a) counter-controlled loop, b) sentinel-controlled loop, c) loop that computes a product, d) general condition loop, e) non of the above
Explain each and every part in depth with examples.
Theory also suggests a relationship-arithmetic average
: Using the file FARM.csv. Construct the variable Q = (PBARL*QL + PBARC*QC + PBARO*QO)/10 where PBARL, PBARC and PBARO are the arithmetic averages of PL, PC and PO respectively.
|
Contains data on output quantities and input quantities
: The file FARM.csv contains data on output quantities (QL, QC and QO), input quantities (XK, XL, XA and XM) and environmental variables (ZD and ZR) for 11 states in the Northeast Farm Production Region of the U.S.
|
Find the socially optimum output in both periods
: Let the social discount rate equal 10%. Find the socially optimum output in both periods. Calculate the Dead Weight Loss of the unrestricted equilibrium.
|
Describe the output of the series of stack operations
: Describe the output of the series of stack operations: push(5), push(3), push(2), push(8), pop(), top(), push(9), push(1), pop(), push(7), push(6), top(), pop(), push(4), pop()
|
How many time is loop body of while statement executed
: How many time is the loop body of the while statement executed? a) once, b) never, c) 49 times, d) 50 times, e) until a number 50 or larger is entered
|
Charges and electron dots as needed on each ion
: To add formal charges, click the button below (which will turn yellow when activated) before clicking on the molecule. You may need to hit Enter on your keyboard after typing the charge to make it register before clicking submit. Place charges and..
|
Create a two-dimensional array
: Describe a problem where you might need to create a two-dimensional array to accurately model the data, and describe how you would use the data to help solve the problem.
|
Reverse the order of the characters in the string
: Write a program which will perform the following " using MARS - Assembly language"
|
Explain why would it be important to place the same amount
: Problem- Why would it be important to place the same amount of a solution in the polarimeter tube when measuring optical rotation as the amount of solvent when measuring the blank
|