Docsity

Array Fundamentals: Understanding Data Structures and Manipulation in Java, Assignments of Data Structures and Algorithms

Toggle sidebar
bg1
ARRAY
1. Index of array can be negative as well?
a. FALSE
2. Array are object but does not occupy memory?
a. FALSE
3. Arrays are
a. Data structures;
b. Related data items of same type;
c. Remain same size once created
4. Following code is correct or not?
a. int n[] = { 10, 20, 30, 40, 50 };
i. TRUE
5. What is the result of next code?
a. int array[]=[1,2,3];
int total=0;
for(int c=0;c<3;c++){
total+=array[c];
}
i. 6
6. Next syntax is true or not for java 1.5?
for ( parameter : arrayName )
statement
TRUE
7. The next code is correct or not?
int b[][] = { { 1, 2 }, { 3, 4 } };
TRUE
8. In Java we can not pass arguments from the command line ...
a. FALSE
9. The next code is correct or not?
a. Rows can have different
number of columns
int b[][];
b[ 0 ] = new int[ 5 ];
i. TRUE

Partial preview of the text

Download Array Fundamentals: Understanding Data Structures and Manipulation in Java and more Assignments Data Structures and Algorithms in PDF only on Docsity!

ARRAY

  1. Index of array can be negative as well? a. FALSE
  2. Array are object but does not occupy memory? a. FALSE
  3. Arrays are a. Data structures; b. Related data items of same type; c. Remain same size once created
  4. Following code is correct or not? a. int n[] = { 10, 20, 30, 40, 50 }; i. TRUE
  5. What is the result of next code? a. int array[]=[1,2,3]; int total=0; for(int c=0;c<3;c++){ total+=array[c]; } i. 6
  6. Next syntax is true or not for java 1.5? for ( parameter : arrayName ) statement TRUE
  7. The next code is correct or not? int b[][] = { { 1, 2 }, { 3, 4 } }; TRUE
  8. In Java we can not pass arguments from the command line ... a. FALSE
  9. The next code is correct or not? a. Rows can have different number of columns int b[][]; b[ 0 ] = new int[ 5 ]; i. TRUE