What line of code will create the following: mySwitches LightSwitch[] Ref null O LightSwitch [5] mySwitches...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
What line of code will create the following: mySwitches LightSwitch[] Ref null O LightSwitch [5] mySwitches = new LightSwitch[]; O LightSwitch] mySwitches = new LightSwitch[5]: O LightSwitch[5] mySwitches = new LightSwitch[5]; LightSwitchll mySwitches: null null null null O LightSwitch[] mySwitches; Question 7 Assume there are n elements in list. Execution of the following code fragment is int i = list.size() - 1; while (!list.isEmpty()){ list.remove(i); } i--; System.out.println(list.tostring()); □ O(log n) - O(n*n) ☐ 0(1) □ O(n) h version 2 pts O(n) Question 8 Assume that n is an integer variable with a positive value, and any other declarations necessary to make fragmen syntactically and logically correct. int k = 0; while (k <n) { int x = 0; for (int j = 0; j<n; j++) { x = x*(j+1); } k++; Execution of this code fragment is: O O(n*n) O 0(1) O O(n) O O(log n) 2 F D D Question 32 Consider the following test case: public void testContains () { } 3 Employee employeel = new Employee ("John Lopez", "marketing", 4, 16.5f); Employee employee2 = new Employee("Darius Smith", "software", 6, 22.5f); EmployeeList instance new EmployeeList(); instance.add(employee2); assertFalse (instance.contains (employee1)); Assuming that the contains() method is correct, what would the output of this test be? O True O False 2 pts → X If given the following: 25 26 27 28 29 30 31 33 34 35 O null O a What would a.next.next reference? O C C Od Ob public static void main(String[] args) { ListNode a = new ListNode (d: 2, next: null); ListNode b = new ListNode(d: 1, a); ListNode c = new ListNode(d: 4, a); ListNode d = new ListNode (d: 3, b); c.next = null; d.next = C; b.next = d; a.next = b; d.next.next = null; What line of code will create the following: mySwitches LightSwitch[] Ref null O LightSwitch [5] mySwitches = new LightSwitch[]; O LightSwitch] mySwitches = new LightSwitch[5]: O LightSwitch[5] mySwitches = new LightSwitch[5]; LightSwitchll mySwitches: null null null null O LightSwitch[] mySwitches; Question 7 Assume there are n elements in list. Execution of the following code fragment is int i = list.size() - 1; while (!list.isEmpty()){ list.remove(i); } i--; System.out.println(list.tostring()); □ O(log n) - O(n*n) ☐ 0(1) □ O(n) h version 2 pts O(n) Question 8 Assume that n is an integer variable with a positive value, and any other declarations necessary to make fragmen syntactically and logically correct. int k = 0; while (k <n) { int x = 0; for (int j = 0; j<n; j++) { x = x*(j+1); } k++; Execution of this code fragment is: O O(n*n) O 0(1) O O(n) O O(log n) 2 F D D Question 32 Consider the following test case: public void testContains () { } 3 Employee employeel = new Employee ("John Lopez", "marketing", 4, 16.5f); Employee employee2 = new Employee("Darius Smith", "software", 6, 22.5f); EmployeeList instance new EmployeeList(); instance.add(employee2); assertFalse (instance.contains (employee1)); Assuming that the contains() method is correct, what would the output of this test be? O True O False 2 pts → X If given the following: 25 26 27 28 29 30 31 33 34 35 O null O a What would a.next.next reference? O C C Od Ob public static void main(String[] args) { ListNode a = new ListNode (d: 2, next: null); ListNode b = new ListNode(d: 1, a); ListNode c = new ListNode(d: 4, a); ListNode d = new ListNode (d: 3, b); c.next = null; d.next = C; b.next = d; a.next = b; d.next.next = null;
Expert Answer:
Answer rating: 100% (QA)
The image shows a question about Java code to create an array of LightSwitch objects T... View the full answer
Related Book For
Statistics For Business & Economics
ISBN: 9781337901062
14th Edition
Authors: David R. Anderson, Dennis J. Sweeney, Thomas A. Williams, Jeffrey D. Camm, James J. Cochran
Posted Date:
Students also viewed these programming questions
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
In Week 4, you will complete the analysis and design for the project. You will use the guidelines described above and the grading rubric below to complete this document. You will create the following...
-
The electron in a hydrogen atom is typically found at a distance of about 5.3 10-11 m from the nucleus, which has a diameter of about 1.0 10-15 m. If you assume the hydrogen atom to be a sphere of...
-
Suppose a firm produces charcoal in a perfectly competitive charcoal industry where the price of charcoal is $20 per ton. This particular firm, however, enjoys a competitive advantage over other...
-
Design a deterministic single-tape Turing machine that decides (i.e. recognises and halts on every input) the language {w (a, b)w contains equally many a's and b's}. Show the accepting computation...
-
Dirk Coles checkbook lists the following: Dirk Coles September bank statement shows the following: Requirements 1. Prepare Dirk Coles bank reconciliation on September 30, 2010. How much cash does...
-
Please discuss the video "Fog of War" and proportionality in war. What was McNamara saying about proportionality during World War II? How do you think this impacted the decision making processes...
-
Example of E-Businesses is coles, use following link for analysis: https://www.coles.com.au/ 1.Insert brief introduction about the business here... ... 2.Environmental Analysis - Current business...
-
Zek Ltd assembles heavy industrial switchboxes. Hitherto, Zek Ltd has assembled only one type, but recently a decision was made to expand the product range into two types. The following data pertains...
-
Glico Wings uses FIFO actual costing system. The value of fixed manufacturing cost rate calculated at the end of the year through dividing the actual fixed manufacturing cost by the actual production...
-
Integrating Burt's Bees into Clorox's hybrid distribution approach offers synergies in shared values and cross-promotion. Strategically placing them together in specialty stores and select larger...
-
In Problems 43. f(x) = 45. f(x) = 47. f(x) = 49. f(x) = x + 3 2-x evaluate lim for the function. X0 x-5 5+2x x + 4 x + 3 x + 3x x4 + 2x5 44. f(x) = 46. f(x) = 48. f(x) = 50. f(x) = + 3x IX 3 x + 2x -...
-
Ann Parsons deposits $10,000 in a savings account each year earning 6% interest annually (EOY). (i) How much will be in the account at the end of the 15th year? (ii) How much would you have if Ann...
-
Please assist with breaking down this discussion including the principles of professional conduct to examine in the AICPA Code of Professional Conduct document: Selected: Public interest (is prime...
-
QBE Insurance has outstanding bonds that will mature in 6 years and pay an 8 per cent coupon, interest being paid semiannually. Assume the face value is $1,000 and your required rate of return was...
-
Part 1: Static Friction Wik 1. Fint fd the coff of static b the incle of the ramp at the Mack the angle the rp me with the trial T Ariel 2 trial 4 (degrees) 31" 38 26" 30* 24 (average # 28.2 2. Next...
-
Solve for the equilibria of the following discrete-time dynamical systems Pr pt+1 = Pr+2.0(I-Pr)
-
According to the IRS, taxpayers calling the IRS in 2017 waited 13 minutes on average for an IRS telephone assister to answer. Do callers who use the IRS help line early in the day have a shorter...
-
Rocky Mountain National Park is a popular park for outdoor recreation activities in Colorado. According to U.S. National Park Service statistics, 46.7% of visitors to Rocky Mountain National Park in...
-
According to Ericssons 2016 ConsumerLab TV & Media report, the average person in the United States spends 23 minutes per day channel surfing. The file ChannelSurfing provides the number of minutes...
-
Refer to Problem P3-46 Problem P3-46 The accounts of Marciano Services Ltd. at March 31, 2020, are listed in alphabetical order. 1. Use the Marciano Lid. data in problem P3-46A to prepare the...
-
The accounts of Marciano Services Ltd. at March 31, 2020, are listed in alphabetical order. Requirements 1. All adjustments have been journalized and posted, but the closing entries have not been...
-
Sundance Apartments Inc.'s unadjusted and adjusted trial balance at April 30, 2020, follow: Requirements 1. Make the adjusting entries that account for the differences between the two trial balances....
Study smarter with the SolutionInn App