DEV Community

Pramod Bablad
Pramod Bablad

Posted on

Most Likely Java Array Interview Questions And Answers

1) What is an array?
2) What are the different ways to create arrays in Java?
3) What is ArrayStoreException in Java? When you will get this exception?
4) Can you pass the negative number as an array size?
5) Can you change the size of an array once you define it?
6) What is an anonymous array? Give example?
7) What is the difference between int[] a and int a[] ?
8) There are two array objects of int type. One is containing 100 elements and another one is containing 10 elements. Can you assign an array of 100 elements to an array of 10 elements?
9) “int a[] = new int[3] {1, 2, 3}” – is it a legal way of defining the arrays in Java?
10) What are the differences between Array and ArrayList in Java?
11) Where the arrays are stored in the memory?
12) What are the different ways of copying an array into another array?
13) What are jagged arrays in Java? Give example?
14) How do you check the equality of two arrays in Java?
15) What is ArrayIndexOutOfBoundsException in Java? When it occurs?
16) How do you sort the array elements?
17) How do you find the intersection of two arrays in Java?
18) What are the different ways of declaring multidimensional arrays in Java?
19) While creating the multidimensional arrays, can you specify an array dimension after an empty dimension?
20) How do you search an array for a specific element?
21) What value does array elements get, if they are not initialized?
22) What are the different ways to iterate over an array in java?
23) How do you convert a List or Set to an array?
24) What is the time complexity of different operations on arrays?
25) What are the main drawbacks of the arrays in Java?
26) How do you find duplicate elements in an array?
27) How do you find a missing number in an array of integers if it contains elements from 1 to n where n is the number of elements?
28) How do you remove duplicate elements from an array?
29)How do you find the most frequent element in an array?
30) How do you merge two unsorted arrays into single sorted array?
31) How do you merge two sorted or unsorted arrays into single sorted array without duplicates?
32) How do you find smallest and second smallest element in an integer array?

See the answers at https://javaconceptoftheday.com/java-array-interview-questions-and-answers/

Top comments (0)