Answer Q2(a) and Q2(b)(i)−Q2(b)(v) based on the information given in Figure Figure Q2 (a) Write the output for the progr
Posted: Tue Jul 12, 2022 8:28 am
Figure Q2
(a) Write the output for the program. (12 marks) (b) Determine whether each of the following statements is TRUE or FALSE. (i) The myFunction2 () and MyFunction5 () functions demonstrate insertion of a new node in the middle of a linked list. (2 marks) (ii) The myFunction5 () function demonstrates similar task in stack operation that is to remove a node from the top of the stack. (2 marks) (iii) Given a new node, we can use myFunction5 () function to insert the new node at the beginning of a linked list or at the top of a stack. (2 marks) (iv) The myFunction1() and myFunction2() functions are meant to perform removal and insertion process respectively for a queue. (2 marks) (v) The myFunction 4 () function is used to check whether a linked list contains nodes (s) or otherwise. ( 2 marks) (vi) The myFunction2 () function performs the same task as the push operation in a stack. (2 marks) (vii) The myFunction1() and myFunction6() functions demonstrate implementation of node removal. (2 marks) (viii) The myFunction6 () function demonstrates implementation of insertion in a linked list, that is similar to enqueue operation in a queue. (2 marks) (ix) The myFunction4 () function demonstrates implementation of non-recursive function to check the existence of node(s) in a linked list. (2 marks) (x) The myFunction3() function is used to display content of a node at the beginning of a linked list only. ( 2 marks)