0% found this document useful (0 votes)
283 views4 pages

Arrays Important Questions

The document discusses arrays in Java, including when to use arrays, the different types of arrays, and default values. It provides examples of how to design multi-dimensional arrays to store student marks for different class/school configurations. The document also asks the reader to research and write programs to: search for an element in a character array using linear search; search for an element in a float array using binary search; copy contents between 2D and 3D arrays; and create an array of custom Student objects.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
283 views4 pages

Arrays Important Questions

The document discusses arrays in Java, including when to use arrays, the different types of arrays, and default values. It provides examples of how to design multi-dimensional arrays to store student marks for different class/school configurations. The document also asks the reader to research and write programs to: search for an element in a character array using linear search; search for an element in a float array using binary search; copy contents between 2D and 3D arrays; and create an array of custom Student objects.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

KODNEST

ARRAYS IMPORTANT QUESTIONS AND ANSWERS

R.PUNITH KUMAR
kodnest
KODNEST WWW.KODNEST.COM PH: 7411615623

1. When should an array data structure be used?

(Array data structure should be used when numerous data of

the same type has to be stored.)

2. What is an advantage of an array data structure?

(Creation of an array is simple, inserting data into an array

is simple by making use of loops. Extracting data from the

array is also simple by making use of loops)

3. What are the different types of arrays in Java?

(1-dimensional, 2-dimensional, 3-dimensional, …… n-

dimensional regular and jagged array)

4. Design an array data structure to collect marks of 100

students of a class?

(int a[] = new int[100];)

5. Design an array data structure to collect marks of students in

5 classes each with 100 students?

(int a[][] = new int[5][100];)

6. Design an array data structure to collect marks of students in

3 schools each with 5 classes each with 100 students?

(int a[][][] = new int[3][5][100];)


KODNEST WWW.KODNEST.COM PH: 7411615623

7. What is the advantage of jagged array data structure?

(In real life, the data is not regular rather in most of the time,

data is irregular or jagged. Hence, to provide a solution for the

jagged data, java supports jagged array data structure.)

8. Are arrays objects in Java?

(Yes)

9. What are the default values associated with an array?

(The default value of an array depends upon the data type of

an array.

Eg: int-0, float-0.0, char-blank character, boolean -false)

10. What is the default value present in objects array?

(null)

----------------------------------------------------

Research on the following:

i) Write a java program to search an element in an character

array using liner search algorithm.

ii) Write a java program to search an element in an float array

using binary search algorithm.


KODNEST WWW.KODNEST.COM PH: 7411615623

iii) Can we copy the contents of 2-d array into another 2-d

array and a 3-d array into another 3-d array ? if yes ! then go

give a try by writing the code.

iv) You can create an integer array , float array , boolean array
etc.. but can you create a Student array ?
I mean ….
Can we write a code like this ?

class Student
{
int id;
int age;
}
class StudentApp
{
public static void main(String args[])
{
Student arr[]=new Student[5];
}
}

You might also like