Name:     ID: 
 
    Email: 

Digital Game Programming Test 2

True/False
Indicate whether the sentence or statement is true or false.
 

 1. 

Dynamically instantiated movie clips are the basis for deciding at run-time if we need to add new clips to the stage.
 

 2. 

By default, when you publish a Flash movie, only symbols that have been instantiated on the stage will be exported into the final..swf file.
 

 3. 

You are given the option to force Flash to export a symbol into the final .fla, even if it’s not on the stage.
 

 4. 

In the following code...

_root.attachMovie(“ball”, “ball1”, 1);

...the function is called on the _root reference, indicating that the instance should be attached to the main timeline.
 

 5. 

There are two different types of  depth: depth determined at author-time, and depth determined at run-time.
 

 6. 

Clips that are dragged into the same layer appear in the order they are instantiatied.  Therefore, a newly instantiated clip will appear on bottom of an older one.
 

 7. 

You can duplicate an existing movieClip by using the duplicateMovieClip function.
 

 8. 

You can use function reference properties to assign event handler scripts to dynamically attached clips.  These are commonly referred to as Dynamic Event Handlers.
 

 9. 

The clip to which the function is attached defines the scope of a function.
 

 10. 

Buttons have three states: _up, _over, and _down.
 

 11. 

An array is simply a block of variables.
 

 12. 

The use of arrays in ActionScript is optional; there is nothing you can do with an array that you can’t do in some other fashion.
 

 13. 

The following syntax creates an array called myArray.

myArray = new Array();
 

 14. 

It’s not common to use arrays in for loops, with the loop index used as the array index.
 

 15. 

The length property of an array is read only.
 

 16. 

Creating an array and then populating each of its elements with other arrays is called nesting an array.
 

 17. 

A nested array is actually a multidiminsional array.
 

 18. 

Arrays can have any number of dimensions you like.  Below is an example of a 3 x 3 x 5 multidimensional array.

myArray = new Array();
for(i=0; i<3; ++i){
      myArray[i] =  new Array();
      for(j=0; j<3; ++j){
            myArray[i][j] = new Array();
            for(k=0; k<5; ++k)
                  myArray[i][j][k] = "("+i+", "+j+", "+k+")";
      }
}
for(i=0; i<3; ++i){
      for(j=0; j<3; ++j){
            myOutputString = " ";
            for(k=0; k<5; ++k)
                  myOutputString += myArray[i][j][k] + " ";
            trace(myOutputString);
      }
      trace(" "); //blank line
      }
 

 19. 

You can’t access a movie clip properties as an array.
 

 20. 

The eval function gives an absolute path, whereas array notation gives a relative one.
 

Multiple Choice
Identify the letter of the choice that best completes the statement or answers the question.
 

 21. 

If there is art in your final .swf that is never used in your movie...
a.
Flash maintains all symbols in the library when you publish the move into a .swf file.
d.
both b and c
b.
it will do nothing but increase your file size.
e.
none of the above
c.
by default, Flash only exports symbols that it knows are going to be used in the final movie
 

 22. 

The built-in function attachMovie will allow us to
a.
attach a new movie object to the library
c.
attach a new instance.
b.
attach a new symbol object to the library
d.
none of the above
 

 23. 

Considering the following syntax...

MovieClip myMovieclip.attachMovie(idName, NewName, depth [, initObject]);

The first argument, idName,
a.
is the name you use when  you export the clip.
c.
is optional
b.
is always identical to the symbol name in the library
d.
none of the above
 

 24. 

Consider the following code...

_root.attachMovie(“ball”, “ball1”, 1);
attachMovie(“ball”, “ball2”, 2);
attachMovie(“ball”, “ball3”, 3);
ball1._x += 100; ball3._y +=100;
ball2._x += 160; ball3._y +=100;
ball3._x += 220; ball3._y +=100;

...the root reference is left off because...
a.
the locally scoped timeline is used which in this case is _root, the main timeline.
c.
both a and b
b.
this script is attached to a frame in the main timeline.
d.
none of the above
 

 25. 

When clips are dragged from the library to the stage, they are said to be instantiated at ...
a.
run-time
c.
real-time
b.
author-time
d.
compile time.
 

 26. 

Using empty clips to group other clips...
a.
reduces the amount of effort necessary to maintain the depth settings of all your clips.
d.
both a and b
b.
helps to organize your clips.
e.
none of the above
c.
serves no purpose at all.
 

 27. 

Consider the following code and indicate the most correct answer.

createEmptyMovieClip("myBalls",1);
for(i=1; i<6; ++i){
      myBalls.attachMovie("ball", "ball" + i, i);
      eval("myBalls.ball"+i)._x += i*100;
}
myBalls._alpha = 50;
a.
This code creates an empty movieClip called myBalls at a depth of 1. Because there is no reference before the call, Flash uses the local timeline-in this case the _root timeline.
c.
This code creates an empty movieClip called myBalls at a depth of 1. The depth is then incremented 5 times. Because there is no reference before the call, Flash uses the local timeline-in this case the _root timeline.
b.
This code creates an empty movieClip called myBalls at a depth of i. Because there is no reference before the call, Flash uses the local timeline-in this case the _root timeline.
d.
The above code will not work.
 

 28. 

The eval function’s purpose is to...
a.
allow you to  create a variable name at author-time.
c.
allow you to  evaluate a variable name at run-time.
b.
allow you to  create a variable name at run-time.
d.
allow you to  evaluate a variable name at author-time.
 

 29. 

The scope of a function is defined to be ...
a.
the parentheses around the defined function.
c.
the timeline that the function is defined in.
b.
is always on the main timeline (_root).
d.
both a and b
 

 30. 

The stop() function...
a.
causes the loop algorithm to exit one scope above the existing level of  scope.
c.
stops the function and exists to the code following the function.
b.
causes the playead to  freeze at its current frame until it’s told to move again.
d.
none of the above.
 

 31. 

After you have a new array ready, you can add, remove, and access elements in it.  Which of the following code serves as an example of this?
a.
myArray = new Array();
new Array[0] = 100;
trace( myArray[0] + 15);
c.
myArray = new Array();
myArray[0] = 100;
trace( myArray[0] + 15);
b.
myArray = new Array();
myArray[i] = 100;
trace( myArray[0] + 15);
d.
none of the above
 

 32. 

Select the best choice for the following code...

myArray = new Array(“apple”, “bannana”, “cabbage”);
trace(myArray.toString());

a.
This array is being initialized with 3 strings.
c.
This code will not work.
b.
Three elements are given as arguments to the  constructor for the Array object.
d.
both a and b
 

 33. 

Given the following code...

myArray = new Array();
for(i = 0; i<5; ++i){
      myArray[i] = new Array();
      for(j=0; j<5; ++j)
            myArray[i][j] = "["+i+", "+j+"]";
}
for(i=0; i<5; ++i){
      myOutputString = " ";
      for(j=0; j<5; ++j)
            myOutputString += myArray[i][j] + " ";
      trace(myOutputString);
}

The above code is designed to ....
a.
create a three-dimensional array of strings where each string is an (x,y) pair indicating the indexes of that element.
d.
both b and c
b.
create a nested array.
e.
none of the above
c.
create a two-dimensional array of strings where each string is an (x,y) pair indicating the indexes of that element.
 

 34. 

Which of the following statements is true.
a.
The splice method changes the array it’s called on.
c.
Slice and splice do vastly different things.
b.
Slice makes a copy of the array it’s called on.
d.
all statements are true.
 

 35. 

Indicate the most correct statement.
a.
Sort leaves the original array intact and creates a new sorted array.
c.
Sort returns an alphabetically ordered list of values.
b.
Sort does not leave the original array intact; instead, it alters it.
d.
both b and c
 

 36. 

Lexicographic order has to do with ....
a.
the ASCII values of the characters in the string.
c.
the UNICODE values of the characters in the string.
b.
the ANSI values of the characters in the string.
d.
the alphanumeric sort order of variables.
 

 37. 

The following code...

myArray = new Array();
myArray.push("cabbage");
myArray.push("apple");
myArray.push("Billy");
myArray.push("dog-bone");
myArray.push("banana");
trace(myArray.toString());
myArray.sort(Array.CASEINSENSITIVE);
trace(myArray.toString());
a.
will be sorted lexicographically
c.
will be sorted alphanumerically
b.
will be sorted aphabetically
d.
the case of the sorted elements will affect the sort.
 

 38. 

The complement to the pop method is
a.
the shift method
c.
the reverse method
b.
the unshift method
d.
the push method
 

 39. 

Consider the following code and indicate the most correct choice.

myArray = new Array();

a.
the ‘new’ keyword is used to create a new object called ‘myArray’
c.
a new array object is being constructed through the use of the keyword ‘new’
b.
the ‘new’ keyword is used to create a new object called ‘Array’
d.
both a and c
 

 40. 

Indicate the output for the following code...
myArray = new Array();
myArray[0] = 100;
myArray[3] = 100;
myArray[5] = 100;
trace(myArray);
a.
100,100,100
c.
undefined
b.
100,undefined,undefined,100,undefined,
100
d.
this code will not work.  It will produce and error message.
 

Matching
 
 
Match the following event handlers to their respective definition.
a.
MovieClip.onEnterFrame
e.
MovieClip.onMouseUp
b.
MovieClip.onUnload
f.
MovieClip.onMouseMove
c.
MovieClip.onData
g.
MovieClip.onReleaseOutside
d.
MovieClip.onMouseDown
h.
MovieClip.onKillFocus
 

 41. 

Called when the mouse button is pressed anywhere on the stage
 

 42. 

Called when the mouse was moved since the last frame
 

 43. 

Called when the mouse button is pressed over the clip and then released outside the clip
 

 44. 

Called when the clip is unloaded from the stage
 

 45. 

Called when focus is removed from the clip
 

 46. 

Called once each frame that the clip exists on the stage
 

 47. 

Called when you load data into a clip and it finishes loading
 

 48. 

Called when the mouse button is released anywhere on the stage
 
 
Each array object comes with several predefined methods. Match the correct method definition with each array method.
a.
Array.toString
g.
Array.shift
b.
Array.join
h.
Array.unshift
c.
Array.concat
i.
Array.sort
d.
Array.reverse
j.
Array.sortOn
e.
Array.pop
k.
Array.slice
f.
Array.push
l.
Array.splice
 

 49. 

Reverses the order of all elements in an array.
 

 50. 

Returns a string that represents the elements in an array.
 

 51. 

Joins all the elements of an array into a string
 

 52. 

Adds and removes elements from an array
 

 53. 

Joins two strings and returns the conglomeration.
 

 54. 

Removes the last elements from an array and returns its value
 

 55. 

Removes a section of an array and returns it as a new array.
 

 56. 

Removes the first element from an array and returns its value
 

 57. 

Sorts an array based on one element of the array
 

 58. 

Adds a new element to the end of an array and returns the array’s length
 

 59. 

Sorts an Array
 

 60. 

Adds a new element to the beginnning of an array and returns the array’s length
 



 
Submit          Reset Help