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
-
D-4 Networking Solutions began operations on January 1, 2010, and immediately issued its stock, receiving cash. D-4s balance sheet at December 31, 2010, reported the following stockholders equity:...
-
Figure P.4.8 shows whats called a corner mirror. Determine the direction of the exiting ray with respect to the incident ray. Figure P.4.8
-
Claims against governmental bodies generally cannot be brought into court unless administrative procedures are followed first. Often, a notice of claim must be filed first. Assume someone is injured...
-
Near the end of 2015, the management of Isle Corp., a merchandising company, prepared the following estimated balance sheet for December 31, 2015. To prepare a master budget for January, February,...
-
The following information applies to the questions displayed below. On January 1 , 2 0 2 4 , ?the Allegheny Corporation purchased equipment for $ 1 5 0 , 0 0 0 . ?The estimated service life of the...
-
On April 1, Debbie Hall created a new travel agency, Hall Travel. The following transactions occurred during the company's first month. April 2 Hall invested $44,000 cash, and computer equipment...
-
A firm has invested Rs.10000 in its assets, it has used debt to the extent of 40%, the cost of debt is 10%, the cost of equity is 15%, the beta of equity is 1.2 and tax rate is 30%. Given this, what...
-
When attempting to gain commitment, Rachelle tells the story of another customer who agreed to something similar and has benefited from the decision. Which commitment-gaining technique is Rachelle...
-
You have recently accepted a position with Dynamadics Inc. as a business analyst. As a recent graduate from Saskatchewan Polytechnic and based on your understanding of management accounting and...
-
what ways do technology cycle theorists draw upon insights from evolutionary economics, complexity theory, and systems thinking to model the non-linear dynamics, emergent properties, and...
-
What kind of property qualifies for like kind exchange treatment? What kind of property does not qualify for like kind exchange treatment? What is boot? Jack exchanged a forklift used in his business...
-
On December 31, 2020, Stone County Manufacturing determined that a piece of manufacturing equipment needed to be tested for impairment due to changing market conditions. The equipment was originally...
-
1. The marginal benefit is the (total, incremental increase in) benefit associated with an increase in the activity. (1 point) 2. Professor Smith researches whether providing government subsidies for...
-
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...
-
Clausius-Clayperon equation is applicable to (a) Solid-vapour (b) Solid-liquid (c) Liquid-vapour (d) All of these.
-
The reaction \(A(\mathrm{l}) ightarrow R(\mathrm{~g})\) is allowed to reach equilibrium condition in an autoclave. At equilibrium there are two phases - one a pure liquid phase of \(A\) and the other...
-
The equilibrium constant for the reaction \(\mathrm{N}_{2}(\mathrm{~g})+3 \mathrm{H}_{2}(\mathrm{~g}) ightarrow 2 \mathrm{NH}_{3}\) is 0.1084 . Under the same conditions, the equilibrium constant for...
Study smarter with the SolutionInn App