Array Q's

3
1. What is an Arra y? Wh at is the other name given to i t? 2. Defi ne Su bscri pt. What i s the other name given to i t? 3. Name t he typ es of Array based on their st orage patter n. 4. What i s th e Ba se t ype of an ar ray ? 5. What is an Initi ali zer List? Show an example t oo. 6. Def ine - Ar rayIndexOutOfBoundsExce pti on. 7. What is the 2 step proc ess before we can use a n arr ay? 8. What is w rong in th e foll owing i nitia liza tion in t a={2, 5,-7, 9,11} ; ? 9. What is w rong in th e foll owing i nitia liza tion in t c[]= {a,b,c ,d,e} ; ? 10. hat will System.out.pri ntln(arr) display if arr hol ds {5,7,8,4,6}? 11. What will System.o ut.println(arr[1][ 1]) display if arr holds {{5,7,8} ,{4,6,1},{2,3,9}} ? 12. Write a statement to initialize a n array with the 5 uppercase vowels. 13. What is the difference betw een a matr ix and a vector ? 14. What do you understand by "A n array occupies contiguous memory locations"? 15. What does the instance variable length of t he array object hold? 16. Give a difference betwe en a 2D and a 1D array. 17. How many bytes w ill be allocated on e xecuting double a[][]=n ew double[5]2]; 18. What is the other name given to sequen tial sear ch? 19. What is th e prerequisite t o perform bi nary search over an array? 20. Give 2 differences b etween linear and binary search?

Transcript of Array Q's

8/8/2019 Array Q's

http://slidepdf.com/reader/full/array-qs 1/3

1. What is an Array? What is the other name given to it?

2. Define Subscript. What is the other name given to it?

3. Name the types of Array based on their storage pattern.

4. What is the Base type of an array?

5. What is an Initializer List? Show an example too.

6. Define - ArrayIndexOutOfBoundsException.

7. What is the 2 step process before we can use an array?

8. What is wrong in the following initialization int a={2,5,-7,9,11}; ?

9. What is wrong in the following initialization int c[]={a,b,c,d,e}; ?

10. hat will System.out.println(arr) display if arr holds {5,7,8,4,6}?

11. What will System.out.println(arr[1][1]) display if arr holds {{5,7,8},{4,6,1},{2,3,9}}?

12. Write a statement to initialize an array with the 5 uppercase vowels.

13. What is the difference between a matrix and a vector?

14. What do you understand by "An array occupies contiguous memory locations"?

15. What does the instance variable length of the array object hold?

16. Give a difference between a 2D and a 1D array.

17. How many bytes will be allocated on executing double a[][]=new double[5]2];

18. What is the other name given to sequential search?

19. What is the prerequisite to perform binary search over an array?

20. Give 2 differences between linear and binary search?

8/8/2019 Array Q's

http://slidepdf.com/reader/full/array-qs 2/3

21. Give 2 differences between selection and bubble sort?

22. Write the contents of the array {6,3,2,9,1,5,4 }after 2 passes of selection sort?

23. Write the contents of the array {6,3,2,9,1,5,4 }after 2 passes of bubble sort?

24. Give 2 limitations of arrays.

25. Give 2 advantages of arrays.

26. What will a.length give in case of (a) 1D array. (b) 2D array ?

27. What will a[i].length give in case of (a) 1D array. (b) 2D array ?

28. When do we need to nest an initializer list?

29. How do we allocate an array dynamically in java?

30. Explain with example how to initialize an array of objects.

31. What is the difference between a Vector and an Array. Discuss the advantages and

disadvantages of both?

32. Differences between Vector and Array

33. Is array aggregate assignment possible in java?

34. is Aggregate comparison of arrays possible in Java?

35. Can java array be created with zero size?

36.Is the array size is fixed after it is created?

37.How can an array of objects be created in Java?

38.An array of array can be created in java?

39. How can I convert a java array to a java.sql.Array?

40. How do you sort an array without using API

41. How do you define a Java array whose entries are also Java arrays?

8/8/2019 Array Q's

http://slidepdf.com/reader/full/array-qs 3/3

42. What are the considerations when using an array of arrays?

43. How To Sum The Elements Of An Array In Java Programming

44. How do I convert a character array to a String?