Consider the following three Java functions. public static int halvel (int x) { x = x...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Consider the following three Java functions. public static int halvel (int x) { x = x / 2; return x; } public static void halve 2 (int[] a) ( int na.length; for (int i=0; i < n; i++) { halvel (a[i]); a[i] halvei (a[i]); } public static void halve3 (int[] a) { int na.length; int] b new int [n/2]; for (int i=0; i < n/2; i++) b[i] =a[i]; a = b; } (a) What are the contents of the array a[] after executing the following three lines of code? Write your answer in the box below. int a 16, 32, 48, 64 }; halve2(a); halve2(a); (b) What are the contents of the array a[] after executing the following three lines of code? Write your answer in the box below. int a 16, 32, 48, 64 }; halve3(a); halve3(a); Consider the following three Java functions. public static int halvel (int x) { x = x / 2; return x; } public static void halve 2 (int[] a) ( int na.length; for (int i=0; i < n; i++) { halvel (a[i]); a[i] halvei (a[i]); } public static void halve3 (int[] a) { int na.length; int] b new int [n/2]; for (int i=0; i < n/2; i++) b[i] =a[i]; a = b; } (a) What are the contents of the array a[] after executing the following three lines of code? Write your answer in the box below. int a 16, 32, 48, 64 }; halve2(a); halve2(a); (b) What are the contents of the array a[] after executing the following three lines of code? Write your answer in the box below. int a 16, 32, 48, 64 }; halve3(a); halve3(a);
Expert Answer:
Related Book For
Engineering Economic Analysis
ISBN: 9780195168075
9th Edition
Authors: Donald Newnan, Ted Eschanbach, Jerome Lavelle
Posted Date:
Students also viewed these databases questions
-
s1 educated (SSE) student for every three public school educated (PSE) students. Reasoning that students are not very dissimilar from threads, he suggests the following entry and exit routines be...
-
Developments in Technology Light is incident from air on the end face of a multimode optical fibre at angle of incidence as shown below. n n 1 2 The refractive indices of the core and cladding are...
-
The Jasper SkyTram transports passengers to the top of Whistler Mountain in the Canadian Rockies where there are spectacular views, boardwalks, and hiking trails. The SkyTram travel time (in minutes)...
-
Refer to the West Hill Hardware information in E12-18A. Compute the ARR for the investment. Refer To West Hill Hardware Information In E12-18A West Hill Hardware is adding a new product line that...
-
Write the numeral as a HinduArabic numeral.
-
For a ternary system having a homogeneous single phase, the degree(s) of freedom will be (a) 3 (b) 4 (c) 2 (d) 1 .
-
Lindas Luxury Travel (LLT) is considering the purchase of two Hummer limousines. Various information about the proposed investment follows: Initial investment (2 limos) ....$600,000 Useful life...
-
Research and select two (2) to three (3) analytical and decision intelligence frameworks and/or models. Outline the components of those models as they relate to data in organizations. Make sure to...
-
The trial balance of Pacilio Security Services Inc. as of January 1, 2017, had the following normal balances: Cash ................. 78 , 972 P e t t y C a s h . . . . . . . . . . . . . . . . 100 A c...
-
producing a musical mosts 88,000 plus 5900 per performance. one sold-out performance earns 7500 in revenue. if every performance sells out, how many performances are needed to break even?
-
1 2 3 4 5 6 7 8 An ARM assembly code consists of following instructions: MOV R5, #10 MOV R4,0x500 L1: LDR R1, [R4] ADD R5, R5, #4 CMP R5, #18 BLT L1 ADD R2, R3, #10 CMP R2, #30 Assume that LDR...
-
Convert each character in the input string to its opposite case, please use memory addresses to get each character of the input string. Q2: (20 points) logic XOR operation has an interesting...
-
19. Construct the flowchart and algorithm of the following problem: A fishing fleet fishes in 10 different regions each consisting of 8 different areas. The data about the fish caught in kilograms...
-
Using Mesh Analysis, find the currents I, I2 and Is in the network shown in Figure 2.b. 10V 4A 12.2 ww1 122 22 8V Figure 2.b Circuit for question no. 2(b)
-
Please use given Income Statement and Balance Sheet to develop Statement of Cash Flow. Balance Sheet As of Dec. 31, 2020 Assets Cash and Equivalents Accounts Receivable Inventory Total Current Assets...
-
Compute the total job cost for each of the following scenarios: a. If the direct labor cost method is used in applying factory overhead and the predetermined rate is 100%, what amount should be...
-
a. Determine the domain and range of the following functions.b. Graph each function using a graphing utility. Be sure to experiment with the window and orientation to give the best perspective of the...
-
A firm is considering three mutually exclusive alternatives as part of a production improvement program. The alternatives are as follows: For each alternative, the salvage value at the end of-...
-
A series of monthly cash flows is deposited into an account that earns 12% nominal interest compounded monthly. Each monthly deposit is equal to $2100. The first monthly deposit occurred on June 1,...
-
A million-dollar oil drilling rig has a 6-year depreciable life and a $75,000 salvage value at the end of that time. Determine which one of the following methods provides the preferred depreciation...
-
The \(x\) component of a car's velocity increases from 0 to \(+5.0 \mathrm{~m} / \mathrm{s}\) in \(1.0 \mathrm{~s}\), and then from \(+5.0 \mathrm{~m} / \mathrm{s}\) to \(+10 \mathrm{~m} /...
-
Describe how to determine the \(x\) component of the position of an object at a specific instant, given (a) a graph of position \(x\) as a function of time \(t\) and (b) an equation for \(x(t)\).
-
In an \(x(t)\) curve, what is the significance of a steep slope as opposed to a gentle slope? What is the significance of a curve that slopes downward as you move from left to right along the time...
Study smarter with the SolutionInn App