• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Summary

Arrays are an important type of complex data. They allow you to group and order data and perform easy calculations on data sets. Arrays are useful for embedding other arrays and complex data. Special attention must be given to resizing arrays and empty values within them.

Sample Questions

1:What function do you use to create an array? (select two)
  1. ArrayNew()

  2. ListToArray()

  3. ArrayCopy()

  4. NewArray()

2:Why will the following code fail?
<cfset items=ArrayNew(1)>
<cfset items[1]=100>
<cfset items[2]=150>
<cfset items[4]=75>
<cfset total=ArraySum(items)>

  1. Items is not an array.

  2. Items is missing index 3.

  3. ArraySum() can't sum one-dimensional arrays.

  4. ArraySum() is not a valid function.

3:Why will the following code fail? (select two)
<cfset a = ArrayNew(1)>
<cfset ArrayResize(a, 400)>
<cfset LoopUntil = ArrayLen(a)>
<cfloop from="1" to="#LoopUntil#" index="i">
 <cfset ArrayDelete(a, i)>
</cfloop>

  1. <cfset> requires an equals sign.

  2. An array must be resized to a size greater than 500.

  3. The index passed to ArrayDelete() will be invalid.

  4. The loop will go past the array's length.

4:Which of the following statements are false? (select two)
  1. An associative array is a form of array.

  2. Multidimensional arrays are “arrays in arrays.”

  3. Arrays can have a maximum of three dimensions.

  4. One-dimensional arrays can contain simple values.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint