Domain.com wants you to develop an application that handles passes for Domain.com’s parking lot.
The application has to store and retrieve vehicle information in a contiguous list that allows for advanced navigation techniques.
You have already written and executed the following code:
Vehicle v1, v2, v3, v4, v5;
v1 = new Vehicle (“1M2567871Y91234574”, “Nissan Silvia”, 1996);
v2 = new Vehicle (“1H2569122493456960”, “Honda Civic”, 1999);
v3 = new Vehicle (“1F2569106891234589”, “Mitsubishi Lancer”, 2001);
v4 = new Vehicle (“1F7969122491234589”, “Mazda MX7”, 1998);
v5 = new Vehicle (“1T2569122493456123”, “Toyota Supra”, 2000);
A = Nissan, Honda, Mitsubishi, Mazda, Toyota
B = Nissan, Mazda, Mitsubishi, Honda, Toyota
C = Nissan, Mazda, Mitsubishi, Toyota, Honda
D = Nissan, Mitsubishi, Mazda, Honda, Toyota
What is the right output?
A.
Nissan Silvia 1996 (1M2567871Y91234574)
Honda Civic 1999 (1H2569122493456960)
Mitsubishi Lancer 2001 (1F2569106891234589)
Mazda MX7 1998 (1F7969122491234589)
Toyota Supra 2000 (1T2569122493456123)
B.
Nissan Silvia 1996 (1M2567871Y91234574)
Mazda MX7 1998 (1F7969122491234589)
Mitsubishi Lancer 2001 (1F2569106891234589)
Honda Civic 1999 (1H2569122493456960)
Toyota Supra 2000 (1T2569122493456123)
C.
Nissan Silvia 1996 (1M2567871Y91234574)
Mazda MX7 1998 (1F7969122491234589)
Mitsubishi Lancer 2001 (1F2569106891234589)
Toyota Corolla 2002 (1T2569122493456123)
Honda Civic 1999 (1H2569122493456960)
D.
Nissan Silvia 1996 (1M2567871Y91234574)
Mitsubishi Lancer 2001 (1F2569106891234589)
Mazda MX7 1998 (1F7969122491234589)
Honda Civic 1999 (1H2569122493456960)
Toyota Supra 2000 (1T2569122493456123)
Explanation:
The LinkedList collection class is a doubly-linked list that allows advanced navigation techniques when accessing its elements.
An element pointer is provided by the LinkedListNode class with the Previous and Next properties.
The LinkedList collection class has a few methods of insertion, including AddFirst, AddLast, AddBefore, and AddAfter methods.
The AddFirst and AddLast methods accept an element argument and return a LinkedListNode object as a pointer reference.
The AddBefore and AddAfter methods also return a LinkedListNode object, but they accept another LinkedListNode
indicating which node before or after to insert the element. In this scenario, there are five Vehicle objects added to the LinkedList collection named vList. The v1 object is added to the beginning of vList collection by invoking the AddFirst method. The v2 object is added to the end of the vList collection by invoking the AddLast method. The v3 object is added by invoking the AddAfter method. The v4 object is added before the v3 object by invoking the AddBefore method. Finally, the v5 object is added at the end of the vList collection by invoking the AddLast method.
Incorrect Answers:
A, C, D: These options do not represent the output that will be produced by the code you wrote.
There is nothing in the question that tells which methods are invoked!
I have the same idea. B