APCS Chapter 11

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

What is a data structure?

A data type whose components are smaller data structures and/or simple data types.

Records first became popular with what programming language?

COBOL

What is the Improved Data Structure Definition?

A data type whose components are smaller data structures and/or simple data types

What is a record?

A data structure with one, or more, elements, called fields, of the same or different data types.

. If the individual elements of an int array are not initialized, what is stored in them by default

0

What is the Improved Array Definition?

A data structure with a fixed number of elements of the same type. Every element can be accessed directly.

What is a stack?

A data structure with elements of the same type.

What is an array?

A data structure with one, or more, elements of the same type.

What is meant by a contiguous block of memory?

All of these values are put next to each other in order. Each array element is adjacent to the next element in the memory.

What is a file?

An internal data structure, with an unspecified number of elements of the same type, assigned to an external file name.

Arrays first became popular with what programming language?

FORTRAN

Can the length field be changed?

It cannot be changed.

What does length do when used with a Java Static Array?

It determines the number of elements in an array

Does the enhanced for loop replace the older for loop? Explain why.

It does not replace the older for loop because it is not possible to access any specific array elements.

Is length a method?

It is not a method.

What does LIFO stand for?

Last in, first out

Does the new enhanced for loop only work with primitive data types?

No an object is required.

Does the new enhanced for loop only work with String objects?

No it works with many data structures.

Refer to the previous question. In this situation, does the size of the array need to be specified?

No, because it can already tell the size.

How many values can be stored by a simple data type?

Only one value can be stored in a simple data type.

If you need to store several pieces of data for many people, and you create one array for their names, another array for their addresses, another for their birthdates, another for their social security numbers, etc. What kind of arrays have you created?

Parallel arrays

If they have this in common, why are they considered different data structures?

Stacks = accessed by LIFO. Array = accessed directly

Write the Java code that will both declare and allocate memory for an array of 40 Strings called names in one single programming statement.

String[] names = new String[40];

What is another word for an array?

Subscripted variable

What does the file data structure allow?

The file data structure allows transfer of data between internal and external storage.

What is the first array index?

The first array index is the loop counter which is used to specify each array element in an efficient manner. 0... it's 0.

What data type will the array index always be?

The index will always be an int.

What is the difference between the old for loop and the new enhanced for loop?

The new enhanced for loop can manage access to array elements without using an index. The old can't.

Look at program Java1109.java. This program displays random sentences. How is that possible?

The random class randomly combines each given sentence fragment to make a random sentence.

What do an array and a stack have in common?

They are both data structures with elements of the same type.

What is the difference between a static array and a dynamic array?

You cannot change the size of a static array, but you can change the size of a dynamic array

Refer to the previous question. Write the Java code that will allocate memory for 30 ages?

ages = new int[30];

Any data type that can store more than one value is a

data structure.

Write the Java code that will both declare and allocate memory for an initialized array of double values called bob. The initialized values will be 1.1, 2.2, 3.3, 4.4, and 5.5.

double bob[] = {1.1,2.2,3.3,4.4,5.5};

The enhanced for loop is called the ____ loop.

for...each

Java arrays indicate individual elements with an ____ inside two brackets.

index

Whether you have an array of integers, an array of real numbers, or an array of strings, what data type will the index always be?

int

Write the Java code to declare an int array called ages?

int[] ages;

A two-dimensional array is frequently also called a

matrix.

A one-dimensional array is frequently also called a

vector.


Ensembles d'études connexes

Ch. 19 leadership and management

View Set

Chapter 10: Instrumentation, Equipment, and Supplies; Short Answer: Equipment

View Set

Lessons 6-8 & 6-9 Angles, Lines, Transversals & Interior/Exterior Angles of Triangles

View Set

Chapter 18 Iggy Practice Questions

View Set