Question: What line of code will create the following: mySwitches LightSwitch[] Ref null O LightSwitch [5] mySwitches = new LightSwitch[]; O LightSwitch] mySwitches = new

What line of code will create the following: mySwitches LightSwitch[] Ref null

 O LightSwitch [5] mySwitches = new LightSwitch[]; O LightSwitch] mySwitches = newLightSwitch[5]: O LightSwitch[5] mySwitches = new LightSwitch[5]; LightSwitchll mySwitches: null null nullnull O LightSwitch[] mySwitches; Question 7 Assume there are n elements inlist. Execution of the following code fragment is int i = list.size()

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 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;

Step by Step Solution

3.37 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The image shows a question about Java code to create an array of LightSwitch objects T... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!