0% found this document useful (0 votes)
4 views7 pages

Understanding Data Arrays in Programming

This document presents an analysis of data arrays. First, it includes a diagram that relates data structures and data types. Then, it analyzes questions about one-dimensional, two-dimensional, and multidimensional arrays, including their definitions, components, and how to declare array type variables in Java. Finally, it provides code examples to create an integer array and read values to store them.

Translated by

ScribdTranslations
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)
4 views7 pages

Understanding Data Arrays in Programming

This document presents an analysis of data arrays. First, it includes a diagram that relates data structures and data types. Then, it analyzes questions about one-dimensional, two-dimensional, and multidimensional arrays, including their definitions, components, and how to declare array type variables in Java. Finally, it provides code examples to create an integer array and read values to store them.

Translated by

ScribdTranslations
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

ACTIVITY 2 Data Arrays

Hanne Jose Bayeh Villarreal


July 2019.

Manuela Beltrán University.


Software Engineering.
Data Structures
INTRODUCTION
In the following writing, we will create a graphic diagram to establish a relationship between two of the
most important points in programming, such as; Data structures and data types,
followed by the analysis and response to a series of questions about the arrangements, types of arrangements and
your statement.

A) A graphic diagram that relates the basic aspects of data structures and the
Types of data (On one page).
B) The analysis of the following questions and answering them:

According to the reading of arrays, write what an array is for you.


An array is a space in memory that can be segmented into several parts, which allows us
allow to store information of type text, number, etc. Unlike the variable, the
We can divide the arrangements into several parts.
Example: if we want to reserve 10 spaces in memory, with the help of the variables we would have
to declare 10 of them, but with the arrays it is enough to declare a single array and
segment it into 10 parts.

2) How many types of arrangements are described in the readings?


There are three types of arrangements which are as follows:
a) One-dimensional arrays or vectors.
b) Two-dimensional arrays or matrices.
c) Multidimensional arrays

3) What is known as a one-dimensional array?


It is a one-dimensional array and is made up of structured data types.
for a finite and ordered collection of the same type

4) Describe the components of a one-dimensional array:


a) Type: declares the base type of the array, which is the type of each element in it
b) Name: name assigned to the array
c) Size: it is the number of elements in the array

5) How is an array variable defined in Java?


a) First, the type of variable is defined (integer, character, boolean, etc.) followed by
an opening and closing bracket: Variable_type [ ]
b) Then the name of the array followed by the sign (=) and the reserved word (new):
Array_name = new

a) Finally, we again put the type of variable and in brackets the dimension.
(how many values will the array have)
Tipo_de_variable [ dimensión]
It would look like this:
Variable_type [] array_name = new Variable_type
dimension

6)Escribe la definición de un arreglo llamado Calificaciones que almacena 50 números


integers. Write the instruction in Java to create the array Grades.
The grades array is declared as follows:
Int[ ] calificaciones = new int [50]
Where it will be of integer type, it will have a name (grades) and its size will be 50
elements.

7) Write the instructions to read 50 integers from the keyboard and store them in
the arrangement in the order in which they have been read.

A) We create an integer type variable where we will store the number of elements
what the array will contain
int nElements;
B) Then we write the code where it will ask for the size of the array (JOptionPane)
nElementos = [Link]([Link]("Enter the
number of elements
C) We create the integer array
int[] numbers = new int[nElements];
D) We request the elements that will be stored in the array using the for loop.
Print the elements of the array
for (int i=0; i<nElements; i++){
[Link]((i+1) + " number to be entered");
numbers[i] = [Link]().charAt(0);
}
Note: before these demos, import the Scanner library
E) Finally, we read or display the data that we entered.
The numbers in the array are:
for(int i=0; i<nElements; i++){
[Link](numbers[i]);
}

The complete code would be as follows:

8) What is the difference between a one-dimensional array and a two-dimensional array?


In one-dimensional arrays, there is only one dimension, so we can only
move from front to back, and we will only use one pointer and the
bidimensional are two-dimensional and can be moved from right to left and from
upwards downwards. In the two-dimensional arrays we will use two pointers, one of
They will be responsible for making movements from top to bottom, and the other from right to left.
left.
Conclusion
As we could analyze earlier, the data structure is one of the foundations for
organize the information, since without it we would not be able to conduct a search, manipulation or a

efficient insertion, likewise arrays are very important in the


programming because we will be able to make a shorter and much more organized code.
References
1. PDF Module 1: Data Arrays

You might also like