Question: Question 2: (40 marks) Use the linked list pictured below to annser the followieg quentions: is roquired here). returs nul 1. ptrinentocrtelenest ii. per2element next



Question 2: (40 marks) Use the linked list pictured below to annser the followieg quentions: is roquired here). returs nul 1. ptrinentocrtelenest ii. per2element next =3 3. iii. peri.nextelcment= Invalid Syntax erron elei iv. p2ncutnetm 1. deleieltem (64) ii. listadditen (42)/4 iii. p tr2 neatinext - neN Node (77, nalili d. (4 marks) After execuing the code in part cabove: ls ptrt a dangline pointer ( Y/N) ? Ls ptrz a dangling pointer (Y/N) ? looks like (one number in each box). 156 Quostlon 2: (40 marks) Use the liaked list pictured below to anwwer the followinn atseninaw. a. (4 marks) Write just the Java condition expresico to chyek if the above liat is cmpty wibhout uing the alze clas variable or aay ocher clas methad (only the condition ia me ie is required here). retum b. (8 marks) Give the value of the following saicmens: If the ytaieninen is invalid write invalid oherwise write the value of the ckenent of the aode. i. ptrl.nest.noxt.element = ii. ptr2element sent = iii. ptri.next. element- iv. per2 next next = (8 marks) Give the value of the following statements: If the statement is invalid write invalid otherwise write the value of the element of the node. i. ptrinext.nextelement = ii. ptr2.element next = iii. ptrl.nextelement= iv. ptr2 next next = c. (18 marks) Consider the linked list above. Write the order of nodes after each statenecet belon by peting only ane number in exeh empey answer bex. i. deleteltem(64); ii. listadditem(42); ii. ptr2 next neat = new Node (77, null); d. (4 marks) After exceuting the code in part cabove: Is perl a dangling pointer (YNN)? Is ptr? a dangling pointer (YN)? d. (4 marks) After executing the code in part cabove: Is perl a dangling pointer (Y/N)? Is perz a dengline pointer (Y/N)? fooks like (one number is each box). 156
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
