What is the primary benefit of using one-dimensional arrays?
They allow for efficient storage and access of multiple items of the same type.
What does Java do with the initial values of a 2D array?
Counts the initial values to determine the number of rows and columns.
1/93
p.2
One-Dimensional Arrays

What is the primary benefit of using one-dimensional arrays?

They allow for efficient storage and access of multiple items of the same type.

p.14
Array Initialization

What does Java do with the initial values of a 2D array?

Counts the initial values to determine the number of rows and columns.

p.8
Processing Arrays with Loops

What will be the output when the ArrayLoop program is executed?

13, 6, 2, 90, 78.

p.10
Dynamic Arrays

What does the statement 'new double[size]' do in the program?

It allocates a new array of doubles with the specified size.

p.17
Using .length with Arrays

What is the purpose of the Array2DLength class?

To demonstrate the use of .length with a 2D array in Java.

p.5
Array Initialization

What is the data type of the variable 'mark'?

int[].

p.13
Creating and Initializing 2D Arrays

What is the syntax to create a 1D int array?

int [ ] list = new int [10];

p.10
Dynamic Arrays

What is the purpose of the Scanner class in the DynamicArray program?

To read user input for the size of the array.

p.12
Two-Dimensional Arrays

What does a 2D array resemble?

A table.

p.15
Creating and Initializing 2D Arrays

How are elements organized in a 2D array?

Elements are organized in rows and columns, where each row is a 1D array.

p.3
Introduction to Arrays

What is the issue with handling more than four students in the Naive program?

It would require declaring multiple variables, which is impractical.

p.10
Dynamic Arrays

What does 'array.length' return in the context of the program?

The size of the dynamically allocated array.

p.4
Processing Arrays with Loops

What is the output of 'System.out.print(mark[4]);' if mark[4] is 89?

It prints the value 89.

p.11
Two-Dimensional Arrays

What is a two-dimensional array?

An array that consists of rows and columns, allowing for the storage of data in a grid format.

p.15
Creating and Initializing 2D Arrays

What is the internal structure of a 2D array?

A 2D array is a composition of multiple 1D arrays.

p.11
Two-Dimensional Arrays

What is an example of a real-world application of two-dimensional arrays?

Storing pixel data for images.

p.13
Creating and Initializing 2D Arrays

What must be done before using a 2D array?

It must be created.

p.3
Introduction to Arrays

What data type is used to store the average in the Naive program?

double.

p.4
Processing Arrays with Loops

What does 'mark[8] = 88;' do?

It assigns the value 88 to the ninth element of the array 'mark'.

p.9
Accessing Elements in 2D Arrays

What is the first element of myArray?

13 (myArray[0]).

p.8
Processing Arrays with Loops

What is the purpose of the loop in the ArrayLoop class?

To print each element of the array myArray.

p.1
Introduction to Arrays

What is the primary focus of ITP3914?

Concepts of Data Types and Operations.

p.15
Accessing Elements in 2D Arrays

What does 'myTable[0]' represent in a 2D array?

It represents the first 1D array in the 2D array.

p.4
Introduction to Arrays

What is an array?

An array is a collection of related data put together.

p.13
Creating and Initializing 2D Arrays

What is the syntax to create a 2D array in C?

int [ ][ ] myTable = new int [4][5];

p.6
Array Initialization

What is the value at myArray[1] in the initialized array?

6

p.13
Creating and Initializing 2D Arrays

What does the variable 'mark' represent in the context?

It is a declaration for a 1D int array.

p.2
One-Dimensional Arrays

What is a one-dimensional array?

A data structure that stores a fixed-size sequence of elements of the same type.

p.8
Processing Arrays with Loops

How are the elements of myArray accessed in the loop?

One by one using their indices.

p.10
Dynamic Arrays

What type of array is created in the DynamicArray program?

A double array.

p.17
Accessing Elements in 2D Arrays

How many columns does each of the first three rows in myTable have?

Each of the first three rows has 5 columns.

p.6
Array Initialization

What happens to the initial values when an array is created in Java?

The initial values are automatically placed inside the array.

p.4
Processing Arrays with Loops

What is the purpose of the command 'System.out.print(mark[0]);'?

It prints the value of the first element in the array 'mark'.

p.6
Array Initialization

What is the value at myArray[3] in the initialized array?

90

p.2
One-Dimensional Arrays

How are elements accessed in a one-dimensional array?

Using an index that starts from zero.

p.17
Accessing Elements in 2D Arrays

What does myTable.length return in the given 2D array?

It returns 4, which is the number of rows in the array.

p.5
Array Initialization

What must be done before using an array?

An array must be created.

p.1
Introduction to Arrays

What institution offers the ITP3914 course?

VTC, IVE.

p.12
Accessing Elements in 2D Arrays

What does the second index in a 2D array refer to?

The column number.

p.3
Introduction to Arrays

How is the average calculated in the Naive program?

By summing the grades and dividing by 4.0.

p.9
Using .length with Arrays

What does myArray.length return?

The number of elements in the array.

p.16
Using .length with Arrays

What does myTable[3].length return?

The number of elements in the row myTable[3], which is 5.

p.17
Accessing Elements in 2D Arrays

What does myTable[0].length return?

It returns 5, which is the number of columns in the first row.

p.6
Array Initialization

How is an array initialized in Java without using the 'new' operator?

By directly assigning values within curly braces, e.g., int[] myArray = {13, 6, 2, 90, 78};

p.7
Array Bounds and Exceptions

What is the output of myArray[1]?

6.

p.6
Array Initialization

What is the value at myArray[0] in the initialized array?

13

p.3
Introduction to Arrays

What would be a better approach to handle grades for 100 students?

Using an array to store the grades.

p.9
Accessing Elements in 2D Arrays

What is the last element of myArray?

78 (myArray[4]).

p.8
Processing Arrays with Loops

What is the range of the variable i in the for loop?

From 0 to 4.

p.1
Introduction to Arrays

In which programming part is ITP3914 categorized?

Part 2.

p.7
Array Bounds and Exceptions

What is the error encountered when accessing myArray[5]?

java.lang.ArrayIndexOutOfBoundsException.

p.5
Array Initialization

How do you create an integer array with 10 elements?

int[] mark = new int[10];

p.12
Accessing Elements in 2D Arrays

How would you access the element in the first row and second column of a 2D array named myTable?

System.out.print(myTable[0][1]);

p.12
Accessing Elements in 2D Arrays

What is the output of System.out.print(myTable[2][4]); after assigning 88 to it?

88.

p.11
Accessing Elements in 2D Arrays

How do you access an element in a two-dimensional array?

By specifying the row and column indices.

p.11
Creating and Initializing 2D Arrays

How can you initialize a two-dimensional array?

By using nested braces to define rows and columns.

p.5
Array Initialization

How do you declare an integer array in Java?

int[] mark;

p.4
Introduction to Arrays

What must all elements in an array have in common?

They must be of the same data type.

p.7
Array Bounds and Exceptions

What is the output of myArray[3]?

90.

p.7
Array Bounds and Exceptions

What is the correct size of myArray in the provided code?

5 elements (indices 0 to 4).

p.8
One-Dimensional Arrays

What are the elements of the array myArray?

13, 6, 2, 90, 78.

p.14
Array Initialization

What happens to the initial values in the 2D array?

They are automatically placed inside the array.

p.1
Introduction to Arrays

What programming language is associated with ITP3914?

C.

p.3
Introduction to Arrays

How many grades does the Naive program currently handle?

Four grades.

p.7
Array Bounds and Exceptions

What is the output of myArray[2]?

2.

p.13
Creating and Initializing 2D Arrays

What is the data type of the array 'myTable'?

int [ ][ ].

p.6
Array Initialization

What is the value at myArray[4] in the initialized array?

78

p.14
Array Initialization

How is a 2D array created in the provided Java example?

Through initialization without using the 'new' operator.

p.10
Dynamic Arrays

How is the size of the dynamically allocated array determined in the program?

By user input using kb.nextInt().

p.3
Introduction to Arrays

What is the purpose of the Naive program?

To calculate the average of four student grades.

p.12
Accessing Elements in 2D Arrays

What does the first index in a 2D array refer to?

The row number.

p.4
Introduction to Arrays

How are elements in an array indexed?

Elements are indexed with an integer.

p.7
Array Bounds and Exceptions

What is the output of myArray[4]?

78.

p.16
Using .length with Arrays

What does myTable.length return in a 2D array?

The number of rows in the 2D array, which is 4.

p.18
Introduction to Arrays

What is the primary role of a programmer?

To write a complete and precise set of instructions for a computer to solve a particular problem.

p.17
Array Bounds and Exceptions

What happens when you try to access myTable[4].length?

It throws an ArrayIndexOutOfBoundsException because there is no fifth row.

p.18
Introduction to Arrays

What is a problem-solving task in programming?

A specific challenge or issue that requires a solution through coding.

p.5
Array Initialization

What is the default value of elements in a numerical array?

Elements will be initialized to 0.

p.12
Creating and Initializing 2D Arrays

What is the syntax to assign the value 88 to the element in the third row and fifth column of myTable?

myTable[2][4] = 88;

p.7
Array Bounds and Exceptions

What happens when you try to access an index outside the bounds of an array?

An ArrayIndexOutOfBoundsException is thrown.

p.2
One-Dimensional Arrays

Can the size of a one-dimensional array be changed after it is created?

No, the size is fixed upon creation.

p.18
Introduction to Arrays

What does a complete set of instructions for a computer entail?

It includes detailed steps that guide the computer in carrying out a specific task.

p.12
Two-Dimensional Arrays

How many indices are needed to identify an element in a 2D array?

Two indices.

p.10
Dynamic Arrays

What output is produced when the user inputs '5' for the array size?

'Size of array=5'.

p.13
Creating and Initializing 2D Arrays

How many rows and columns does the array 'myTable' have?

4 rows and 5 columns.

p.6
Array Initialization

What is the value at myArray[2] in the initialized array?

2

p.9
Using .length with Arrays

How many elements are in myArray?

5 elements.

p.11
Creating and Initializing 2D Arrays

What is the primary use of two-dimensional arrays?

To represent matrices or tables of data.

p.18
Introduction to Arrays

Why is precision important in programming instructions?

Precision ensures that the computer executes the task correctly without errors.

p.6
Array Initialization

What does Java do when an array is initialized with values?

Java counts the number of initial values and determines the size of the array.

p.10
Dynamic Arrays

What output is produced when the user inputs '10' for the array size?

'Size of array=10'.

p.5
Array Initialization

What does 'int num = 10;' represent?

Creating an int variable named 'num' with a value of 10.

p.9
Processing Arrays with Loops

What is the output of the loop in the ArrayLoop class?

It prints the elements of myArray: 13, 6, 2, 90, 78.

Study Smarter, Not Harder
Study Smarter, Not Harder