CONFIDENTIAL 1 CS/FEB 2022/CSC508
UNIVERSITI TEKNOLOGI MARA
FINAL ASSESSMENT
COURSE : DATA STRUCTURES
COURSE CODE : CSC508
EXAMINATION : FEBRUARY 2022
TIME : 3 HOURS
INSTRUCTIONS TO CANDIDATES
1. This question paper consists of five (5) questions.
2. Answer ALL questions in your answer sheet. Start each answer on a new page. Write your
name, id and group on the answer sheet.
3. Please scan and save your answers as pdf file.
4. No discussion and do not share your answers with other students. Any copying of or
plagiarized answers will be awarded 0 mark.
5. Answer ALL questions in English.
DecogOP
DO NOT TURN THIS PAGE UNTIL YOU ARE TOLD TO DO SO
This examination paper consists of 7 printed pages
© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL
, CONFIDENTIAL 2 CS/FEB 2022/CSC508
QUESTION 1 (20 MARKS)
Given the following ADT‟s:
public class ArrayList
{
// declaration of other methods and data
public ArrayList()
// method definition
public void addFirst(Object elem)
// method definition
public Object get(int index)
// method definition
public Object set(int index, Object elem)
// method definition
public Object remove(int index)
// method definition
public int indexOf(Object elem)
// method definition
public int size()
// method definition
}
public class LinkedList
{
// declaration of other methods and data
public void insertAtFront(Object elem)
// method definition
public void insertAtBack(Object elem)
// method definition
public Object getFirst()
// method definition
public Object getLast()
// method definition
public Object removeFirst()
// method definition
public Object removeLast()
// method definition
public Object getNext()
// method definition
}
© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL
UNIVERSITI TEKNOLOGI MARA
FINAL ASSESSMENT
COURSE : DATA STRUCTURES
COURSE CODE : CSC508
EXAMINATION : FEBRUARY 2022
TIME : 3 HOURS
INSTRUCTIONS TO CANDIDATES
1. This question paper consists of five (5) questions.
2. Answer ALL questions in your answer sheet. Start each answer on a new page. Write your
name, id and group on the answer sheet.
3. Please scan and save your answers as pdf file.
4. No discussion and do not share your answers with other students. Any copying of or
plagiarized answers will be awarded 0 mark.
5. Answer ALL questions in English.
DecogOP
DO NOT TURN THIS PAGE UNTIL YOU ARE TOLD TO DO SO
This examination paper consists of 7 printed pages
© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL
, CONFIDENTIAL 2 CS/FEB 2022/CSC508
QUESTION 1 (20 MARKS)
Given the following ADT‟s:
public class ArrayList
{
// declaration of other methods and data
public ArrayList()
// method definition
public void addFirst(Object elem)
// method definition
public Object get(int index)
// method definition
public Object set(int index, Object elem)
// method definition
public Object remove(int index)
// method definition
public int indexOf(Object elem)
// method definition
public int size()
// method definition
}
public class LinkedList
{
// declaration of other methods and data
public void insertAtFront(Object elem)
// method definition
public void insertAtBack(Object elem)
// method definition
public Object getFirst()
// method definition
public Object getLast()
// method definition
public Object removeFirst()
// method definition
public Object removeLast()
// method definition
public Object getNext()
// method definition
}
© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL