O GoConqr está de visual novo! Conte para nós o que você achou.

Flashcards

Arrays

nhunsdale02 Programming I Masters Inglês 35 flashcards

Flashcards do conjunto (35)

  1. 1What is an array?A collection of related data items
  2. 2Arrays remain the same _____ once they're createdlength
  3. 3An array is a group of variables called _____ containing values that all have the same _____elements
    type
  4. 4Arrays are _____ so they're considered reference typesobjects
  5. 5Elements of an array What can they consist of?- Primitive
    - Reference
  6. 6What is an Array Access Expression?The name of the array followed by the index you wish to reach
  7. 7Arrays What is the zeroth element?The first element as it is of index "0"
  8. 8Say you wanted to refer to the 5th element of an array called numbers...how would you do it?numbers[4];
  9. 9Arrays Can an index be negative?No
  10. 10Arrays Can an expression (e.g. a;) be used as an index?Yes
  11. 11Arrays What is a length instance variable?It's the length of an array and this length is stored as the length instance variable
  12. 12Arrays What is the subscript of an array?Same as the index
  13. 13Arrays Add the first 3 elements of array "nums" and assign the answer to variable "x":x = nums[0] + nums[1] + nums[2];
  14. 14Arrays create an int array called nums with 11 elements:int[] nums = new int[11];
  15. 15Arrays What do the square brackets after the initial type indicate? e.g. int[] myArray;It indicates that "myArray" will refer to an array of elements
  16. 16Arrays What is the default value for an int?0
  17. 17Arrays What is the default value for a boolean?false
  18. 18Arrays What is the default value for references?NULL
  19. 19If you are declaring 2 arrays, should you create them on 1 line or 2?2
  20. 20Arrays What types are allowed in an array?All of them
  21. 21Arrays What is the best method to iterate through an array? e.g.for loop
    for(int i = 0; i
  22. 22Arrays When iterating through an array, what is zero based counting?initializing the for value to zero
  23. 23Arrays What is an array initializer? e.g.???A function that allows one to quickly assign values to the respective indexes
    int[] dates = {1,2,3,4,5,6,7,8,9};
  24. 24Arrays Array Initializer What is the array length determined by?The number of elements
  25. 25An aside What will the "final" modifier do? When should constant values be initialized?It will declare a constant value and these should be initialized before they're used and can't be modified thereafter
  26. 26Constant Values Also called...constants
  27. 27Constants Why use them? e.g.They make code more readable than using literal values.
    final int ARRAY_LENGTH shows clear intentions and leaves no ambiguity
  28. 28Constant Values Assigning a value to a constant variable after it has been initialized is a _____ errorcompilation
  29. 29Constant Values Attempting to use a constant before it has been initialized is a _____ errorcompilation
  30. 30Arrays What does it mean to dynamically populate an array?Use a for loop
  31. 31Arrays Summing the elements How? e.g.use a for loop
    for(int i = 0;i
  32. 32Arrays How do you pass an array to a method?First, assign values to the array and then pass the name of that array into a method's parameters
  33. 33Array Parameter Declaration write the method head for a method called calculate with an int array as its parameterspublic static void calculate(int[] nums){
    }
  34. 34Passing the Array vs Array Element What is a Scalar Quantity?When an argument for a method is an individual array element of a primitive type, the called method receives a COPY of the element's VALUE
    The primitive values are Scalar's
  35. 35Passing the Array vs Array Element What is the parameter type used in a Scalar Method? does it use "[ ]"?int
    no

Informações

Descrição
Masters Programming I FlashCards sobre Arrays, criado por nhunsdale02 em 05-06-2014.
Criado por
nhunsdale02
Visualizações
14
Avaliação

Fale Conosco

Sobre o que é sua mensagem?

O que você acha do novo visual?

Você gostou?