4) What is the output? int n; for (n = 0; n < 10; n =...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
4) What is the output? int n; for (n = 0; n < 10; n = n + 3) { System.out.print(n + " "); } a. 0 123456789 b. 147 10 c. 0369 036912 n 0 a(! (userInput < 10) ) b. (userInput < 10) c. (! (userInput > 10)) d. (userInput > 10) 3 6 9 } 5) Which XXX will prompt the user to enter a value greater than 10, until a value that is greater than 10 is actually input? X 10 do { output System.out.println("Enter a number greater than 10:"); userInput = scnr.nextInt (); } while XXX; 430 6) Which XXX causes every character in string inputWord to be output? for (XXX) { System.out.println (inputWord.charAt(i)); a. i = 0; i < (inputWord.length() - 1); ++i b. i = 0; i < inputWord. length (); ++i ci = 0; i < (inputWord. length() +1); ++i d. i = 0; i < inputWord.length(); ++i 19) For the given program, how many print statements will execute? 17 public static void printShipping Charge (double weight) { if ((weight > 0.0) && (weight <= 10.0)) { System.out.println (weight 0.75);✓ 3 else if ((weight >10.0) && (weight <= 15.0)) ( System.out.println (weight * 0.85); } else if ( (weight > 15.0) && (weight <= 20.0)) ( 18. System.out.println (weight * 0.95); public static void main(String args[]) { printShippingCharge (18); print Shipping Charge (6); printshippingCharge (25); } a. 1 b2 c. 3 d. 9 20) The following program generates an error. Why? public static void print Sum (int numi, int num2) { System.out.print (num1 + num2); } public static void main(String args []) { int y; y = printSum (4, 5); return 0; } a. printSum() is missing a "return;" statement. C b. The values 4 and 5 cannot be passed directly to printSum() main() has a return statement that returns the value 0 d. printSum() has void return type, so cannot be assigned to a variable 18, *** 6, 25. 4) What is the output? int n; for (n = 0; n < 10; n = n + 3) { System.out.print(n + " "); } a. 0 123456789 b. 147 10 c. 0369 036912 n 0 a(! (userInput < 10) ) b. (userInput < 10) c. (! (userInput > 10)) d. (userInput > 10) 3 6 9 } 5) Which XXX will prompt the user to enter a value greater than 10, until a value that is greater than 10 is actually input? X 10 do { output System.out.println("Enter a number greater than 10:"); userInput = scnr.nextInt (); } while XXX; 430 6) Which XXX causes every character in string inputWord to be output? for (XXX) { System.out.println (inputWord.charAt(i)); a. i = 0; i < (inputWord.length() - 1); ++i b. i = 0; i < inputWord. length (); ++i ci = 0; i < (inputWord. length() +1); ++i d. i = 0; i < inputWord.length(); ++i 19) For the given program, how many print statements will execute? 17 public static void printShipping Charge (double weight) { if ((weight > 0.0) && (weight <= 10.0)) { System.out.println (weight 0.75);✓ 3 else if ((weight >10.0) && (weight <= 15.0)) ( System.out.println (weight * 0.85); } else if ( (weight > 15.0) && (weight <= 20.0)) ( 18. System.out.println (weight * 0.95); public static void main(String args[]) { printShippingCharge (18); print Shipping Charge (6); printshippingCharge (25); } a. 1 b2 c. 3 d. 9 20) The following program generates an error. Why? public static void print Sum (int numi, int num2) { System.out.print (num1 + num2); } public static void main(String args []) { int y; y = printSum (4, 5); return 0; } a. printSum() is missing a "return;" statement. C b. The values 4 and 5 cannot be passed directly to printSum() main() has a return statement that returns the value 0 d. printSum() has void return type, so cannot be assigned to a variable 18, *** 6, 25.
Expert Answer:
Answer rating: 100% (QA)
4 The output of the given code snippet will be c 0369 5 The correct condition to prompt the u... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
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...
-
The number of claims filed each week with Security Insurance Company has a mean of 700 and a standard deviation of 250. Calculate the probability that the number of claims this week will be: (a)...
-
A researcher recorded the calories burned by subjects during a 10-minute treadmill exercise. All participants had televisions located in front of them while exercising. In one group, the television...
-
Determine the median of the numbers of the given set. Set D D: 105, 108, 103, 108, 106, 104, 109, 104, 110, 108, 108, 104, 113, 106, 107, 106, 107, 109, 105, 111, 109, 108
-
What is a compilation unit?
-
Governmental Hospital. During 2011, the following selected events and transactions were recorded by Nichols County Hospital. 1. Gross charges for hospital services, all charged to accounts and notes...
-
In one month Ashton earned $800 at her part-time job, and $80 was withheld for federal income tax. Suppose she earns $1200 next month. How much will be withheld for federal income tax?
-
Describe the 6 guidelines for using the PIC/NIC Analysis effectively When should a PIC/NIC Analysis be conducted? Describe and give an example of: Adding PICs for desired performance Adding...
-
Reflect on a recent, enjoyable guest experience OR on a disappointing guest experience: What were the significant events, the moments of truth, during each experience? How did they contribute to your...
-
For an agency, like the law society that creates law, interprets law and enforces law and adjudicates and punishes breaches of the law, how is it the law allows them to operate despite the fact they...
-
Evaluate the "Product and Market" fit and competitive advantages for Uber. why would UBER's "Product and Market" cause the issues?
-
Identify the statement that is NOT relevant information in a decision as it relates to retaining or relacing an old equipment Annual operating cost of the new equipment Annual operating cost of the...
-
Below are Infographics from the Congressional Budget Office showing Mandatory Spending and Discretionary Spending for FY2022. Examine the types of Mandatory and Discretionary Spending and their...
-
Giraffe Ltd has a financial year end of 31 December. On 1 July 2011, Giraffe issued 5-year, 3% per annum, convertible bonds with face value of $200,000 at par. If issued on the same date, similar...
-
The graph of an equation is given. (a) Find the intercepts. (b) Indicate whether the graph is symmetric with respect to the x-axis, the y-axis, or the origin. -3 6 -6 3 x
-
Rectifying a sinusoid provides a way to create a dc source. In this problem we consider the Fourier series of the full and the half-wave rectified signals. The full-wave rectified signal x f (t) has...
-
A periodic signal x(t) has a fundamental frequency 0 = 1 and a period of it is x 1 (t) = u(t) 2u(t ) + u(t 2) (a) Find the Fourier series coefficients {X k } of x(t) using their integral...
-
Consider a system represented by a first-order ordinary differential equation: (a) Show first that for a function f(t) using the definition of the derivative. (b) Apply the above result to show that...
-
Let \(Y\) be \(\operatorname{binomial}(n=5=6)\). (a) Calculate the mean and variance by lling in the following table: i. \(\mathrm{E}[Y]=\) ii. \(\operatorname{Var}[Y]=\) (b) Calculate the mean and...
-
Let \(Y\) have the Poisson \((=3)\) distribution. (a) Calculate \(P(Y=3)\). (b) Calculate \(P\left(\begin{array}{ll}Y & 3\end{array} ight)\). (c) Calculate \(P(1 \quad Y <5)\).
-
Let \(X\) and \(Y\) be jointly distributed discrete random variables. Their joint probability distribution is given in the following table: (a) Calculate the marginal probability distribution of...
Study smarter with the SolutionInn App