1. What does the following statement do? String[] widget; A. It declares an array of references...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. What does the following statement do? String[] widget; A. It declares an array of references to widget objects named String. B. It creates a String object named widget. C. It creates an array of length zero named widget. D. It declares a variable widget which may in the future hold a reference to an array of references to String objects but is initialized to null, Say that names has been declared String[] names = new String[10]; and that further statements (not shown) have put String references into some of the cells. Which of the following fragments prints out the cells of the array from last to first, skipping cells that contain null? A. for (int j = 0; j<names.length; j++) ( if (names[j] != null) System.out.println(names[j]); } 11. for (int j = names.length; j<names.length; j++) ( if (names[j] != null) System.out.println( names[i]); } for (int j = names.length-1; j >= 0; j--) ( if (names[j] != null) System.out.println( names[i]); D. for (int j = names.length; j >= 0; j++) ( if (names[i] != null) System.out.println( names[j]); } > Java uses call by value. What is the value that is being passed into routine by the method call in the following? double] rats= (1.2, 3.4, 5.6); routine ( rats): A. A copy of the array rats. 3. Java uses call by value. What is the value that is being passed into routine by the method call in the following? double[] rats= (1.2, 3.4, 5.6); routine( rats): A. A copy of the array rats. B. The value of the elements of rats. C. A reference to the array object rats. D. 1.2 What does the following method do? public void spread (int[] values) for (int index=1: index < values.length; index++) values[index] = values[0]; } A. It changes an array by copying the element in cell 0 to all other cells. B. It changes an array by making every element the same as the value of its index. C. It changes an array by making every element zero. E It makes a change to the formal parameter but does not make a change to the caller's array. What does the following method do? public void blur (char[] z. String st) { if (z.length == st.length()) { for (int i=0; j <st.length(); j++) 20]=st.charAt(i): A. It determines if the array contains the same characters as the String. B. It copies characters from the array to the String. C. It creates a new array that contains the same characters as the String. D. If the array size( referencedby z) matches the size of the String reference by st, it copies characters one by one from the String to the array. 1. What does the following statement do? String[] widget; A. It declares an array of references to widget objects named String. B. It creates a String object named widget. C. It creates an array of length zero named widget. D. It declares a variable widget which may in the future hold a reference to an array of references to String objects but is initialized to null, Say that names has been declared String[] names = new String[10]; and that further statements (not shown) have put String references into some of the cells. Which of the following fragments prints out the cells of the array from last to first, skipping cells that contain null? A. for (int j = 0; j<names.length; j++) ( if (names[j] != null) System.out.println(names[j]); } 11. for (int j = names.length; j<names.length; j++) ( if (names[j] != null) System.out.println( names[i]); } for (int j = names.length-1; j >= 0; j--) ( if (names[j] != null) System.out.println( names[i]); D. for (int j = names.length; j >= 0; j++) ( if (names[i] != null) System.out.println( names[j]); } > Java uses call by value. What is the value that is being passed into routine by the method call in the following? double] rats= (1.2, 3.4, 5.6); routine ( rats): A. A copy of the array rats. 3. Java uses call by value. What is the value that is being passed into routine by the method call in the following? double[] rats= (1.2, 3.4, 5.6); routine( rats): A. A copy of the array rats. B. The value of the elements of rats. C. A reference to the array object rats. D. 1.2 What does the following method do? public void spread (int[] values) for (int index=1: index < values.length; index++) values[index] = values[0]; } A. It changes an array by copying the element in cell 0 to all other cells. B. It changes an array by making every element the same as the value of its index. C. It changes an array by making every element zero. E It makes a change to the formal parameter but does not make a change to the caller's array. What does the following method do? public void blur (char[] z. String st) { if (z.length == st.length()) { for (int i=0; j <st.length(); j++) 20]=st.charAt(i): A. It determines if the array contains the same characters as the String. B. It copies characters from the array to the String. C. It creates a new array that contains the same characters as the String. D. If the array size( referencedby z) matches the size of the String reference by st, it copies characters one by one from the String to the array.
Expert Answer:
Related Book For
Posted Date:
Students also viewed these electrical engineering questions
-
What does the following statement mean? Indeed, every decision we make involves some kind of trade-off. Under what condition would the statement not be true?
-
What does the following statement mean? Indeed, every decision we make involves some kind of trade-off. Under what condition would the statement not be true? Does the entrepreneur face a tradeoff...
-
What does the following app display? // Ex. 5.16: Mystery.cs 2 using System; 3 4 class Mystery { static void Main() { int x = 1; int total 0; 10 while (x
-
Write each number in scientific notation. 0.875
-
1. Describe the fraud that allegedly occurred through Sino-Forest Corporation Inc.? Who benefited and how? 2. Why didnt regulators prevent this fraud from occurring? What were they relying on? 3. Why...
-
Sketch the PM and FM waves produced by the saw tooth wave shown inFigure. m(4) 270 37. To To
-
Design Data sold a piece of machinery to HHB Drafting Company. However, after HHB had taken possession of the machine, it discovered damage and revoked the contract. The court found that the...
-
Recording General Fund Operating Budget and Operating Transactions. The Town of Bedford Falls approved a General Fund operating budget for the fiscal year ending June 30, 2011. The budget provides...
-
Simplify the given expression and write the answer with only positive exponents. -113 P 3/7 7 3 54x y z 2 w) 3) (w + 2) (3w + w 4 2 (-3x +7x+8)= (x * + 7x *-12x-1) - 5 27-7-28 20-x-22 712-24-8...
-
You want to purchase a home based upon your current salary you decide that you can afford $2000.00 per month. Your bank has approved you for a (30 year) loan at an interest rate of 5%. 1) Based upon...
-
Rios Co. makes drones and uses the variable cost approach in setting product prices. Its costs for producing 37,000 units follow. The company targets a profit of $317,000 on this product. Variable...
-
An analyst obtained predictions using exponential smoothing, see the table below. Year Month Sales ES forecast 2020 10 $1,450.00 $1,450.00 2020 11 $2,390.00 2020 12 $1,980.00 2021 1 $2,077.00 A 2021...
-
What laws and regulations were broken during the love canal and Hooker chemical incident in New York?
-
Last month McAlister Company had a $60,000 loss on sales of $300,000. Fixed costs are $120,000 a month. Answer the following questions: a. What was the contribution margin percentage? b. What monthly...
-
Why is receptor tyrosine kinase EGFR important for regulation of cell proliferation and cell survival?
-
In class we saw that Karatsuba multiplication allowed one to multiply two n-bit numbers in O(nlog(3)) time. It turns out that using the Fast Fourier Transform, one can multiply numbers in nearly...
-
Robin Company payroll records for the month ended October 31, 2021 show the following details: Salaries earned by employees Federal income taxes withheld $ 400,000 84,000 The salaries are subject to...
-
What is an insurable interest? Why is it important?
-
a. Design an application in which the number of days for each month in the year is stored in an array. (For example, January has 31 days, February has 28, and so on. Assume that the year is not a...
-
Trainers at Toms Athletic Club are encouraged to enroll new members. Write an application that allows Tom to enter the names of each of his 25 trainers and the number of new members the trainer has...
-
When a method receives a copy of the value stored in an argument used in the method call, it means the variable was _____. a. Unnamed b. Passed by value c. Passed by reference d. Assigned its...
-
Why has subordinate legislation come to prominence?
-
What are the advantages of a settlement over a court trial?
-
Define appellant ; respondent ; counterclaim ; counsel ; bench ; writ ; settlement ; pleadings ; party and party costs ; res judicata .
Study smarter with the SolutionInn App