1.

What data structure should be used when number of elements is fixed?(a) Array(b) Array list(c) Vector(d) SetThis question was posed to me during an online interview.This interesting question is from Coding best practices topic in portion Autoboxing & Miscellaneous of Java

Answer»

Right CHOICE is (a) Array

For EXPLANATION I would say: Array list has VARIABLE size. Array is stored in contiguous memory. Hence, reading is faster. ALSO, array is memory efficient.



Discussion

No Comment Found

Related InterviewSolutions