Answered step by step
Verified Expert Solution
Question
1 Approved Answer
D Question 1 5 pts How many constructors does this class have? Refer to the following UML Class Diagram when answering this question. Pet name
D Question 1 5 pts How many constructors does this class have? Refer to the following UML Class Diagram when answering this question. Pet name : int + age : String + hasFleas : Boolean - licenseNumber : String + weight : float color : String Pet ( ) + Pet(name : String, age : int) + getName( ) : String + setName (name : String) : void getAge ( ) : int setAge (age : int) : void + speak() : void + scratch(itches : int) : void + toString() : StringD Question 2 5 pts How many public members does this class have (not including constructors)? Refer to the following UML Class Diagram when answering this question. Pet name : int age : String - hasFleas : Boolean + licenseNumber : String + weight : float + Pet ( ) + Pet(name : String, age : int) + getName() : String - setName (name : String) : void + getAge () : int setAge (age : int) : void + speak() : void - scratch(itches : int) : void + toString() : StringD Question 9 5 pts Evaluate the following code to determine the output. MyStack s = new MyStack (); s. push(38); s. push(51); s. push(96); 5 . pop ( ); 5. Pop ( ) ; System. out . printIn(s . pop ( ) ) ; D Question 10 5 pts Evaluate the following code to determine the output. MyStack s = new MyStack( ); s. push(28); s. push(68); s. push(86); System. out . printIn(s . pop ( ) ) ; D Question 11 5 pts Evaluate the following code to determine the output. MyQueue q = new MyQueue( ); q . add(20); q. add(43) ; q. add(74); System. out . printIn(q. remove ( ) ) ;U Question 12 5 pts Evaluate the following code to determine what value will be at the back of the queue after the code completes. MyQueue q = new MyQueuej5 q.add(31); q.add(61}; q.add(81); Question 13 5 pts Given the following partial code, ll in the blank to complete the code necessary to remove last node. (don't forget the semicolon) class Node { public Object data = null; public Node next = null; } Node head = new Node()} If first Node head.next = new Node()} If second Node head.next.next = new Node()i ff third node head.next.next.next = new NodE(}; fl tourth node fl D Question 14 5 pts Given the following partial code, fill in the blank to complete the code necessary to insert node x before the first node. (don't forget the semicolon) class Node { public Object data = null; public Node next = null; . . . Node head = new Node(); // first Node head. next = new Node(); // second Node head . next. next = new Node(); // third node Node x = new Node(); // node to insert 11 head = x; head.next.next. next = x
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started