Name:     ID: 
 
    Email: 

Game Programming Final Exam (Semester 1)

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

 1. 

Built-in functions are defined by Flash and because they are local, they cannot be called by the programmer anywhere in the script.
 

 2. 

It is not possible to use arguments with your own user-defined functions.
 

 3. 

User-defined functions can have a return value by using the keyword return.
 

 4. 

In Flash ActionScript, there are two types of scope; block scope and movie-clip scope.
 

 5. 

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

 6. 

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

 7. 

An array is simply a block of variables.
 

 8. 

The speed of the computer has no effect on the game experience because slower computers play Flash movies at slower rates
 

 9. 

The’ setInterval function is not global and is not called on a reference
 

 10. 

The entire setBubble function is basically one big switch statement because it is the cleanest solution to implement a state machine where each state follows the previous one without backtracking or skipping ahead.
 

 11. 

The playIntro function’s only purpose is to check the game state and  either send lester on his current route or choose a new route for him
 

 12. 

Changes to the actual frame rate of the game should have little or no effect on the speed at which things move in our games.
 

 13. 

One way to create a new object in Flash is to insert a new symbol.  Doing this creates a new movie clip that is added to your library.
 

 14. 

To open the library panel, you can use the shortcut keys “ALT + L”
 

 15. 

The poperties panel shows porperties for a text field when one is selected.
 

 16. 

The playhead’s position on the timeline is identified by its green color.
 

 17. 

A keyframe is a special frame where things change on the stage.
 

 18. 

ActionScript is now divided into two versions: ActionScript 1.0 (AS 1.0) and ActionScript 2.0 (AS 2.0).
 

 19. 

Both versions of Action Script are conveniently based on the ECMAScript standard (ECMA-262) which is a standard based on C++ syntax.
 

 20. 

When Flash sees a break statement in your code, it immediately leaves the current code block and begins executing script one scope above.
 

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

 21. 

Consider the following code and indicate the most correct answer.

function foo(){
     trace(“calling foo”);
}
fooReference = foo;
fooReference();

foo();
fooReference();
a.
both function calls will work
c.
you need to trace the fooRefernce to make that work
b.
only the foo(); function call will work
d.
none of the above
 

 22. 

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
 

 23. 

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
 

 24. 

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.
 

 25. 

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.
 

 26. 

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.
 

 27. 

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

 28. 

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.
 

 29. 

The setInterval Function
a.
calls a given piece of code once every so many milliseconds
d.
both a and b
b.
Is used to create a new interval event
e.
none of the above
c.
can be substituted through advanced mathematical functions
 

 30. 

Concerning state machines, there can and will be code that exists...
a.
and is executed every frame the machine is in the given state
d.
none of the above
b.
in each state circle
e.
a, b, and c, are all correct
c.
when the proper input is given to spur a state change
 

 31. 

Laying out all of the functions before they are implemented...
a.
gives you a better idea of how everything is going to interconnect
c.
is rarely done
b.
should only happen with psuedocode
d.
both b and c
 

 32. 

Considering the Graph on Figure A, to solve for c you would take the square root of the following....
a.
(Bx - Ax)2 + (By - Ay)2 = c2
c.
(Bx - Ax) + (By - Ay) = c2
b.
(Ax - Bx)2 + (Ay - By)2 = c2
d.
(Bx - Ax)2 + (By - Ay)2 = c
 

 33. 

Angles on the Cartesian plane are drawn starting at the X axis.  These angles are given in degrees.  The angle is usually labeled...
a.
theta ()
c.
sigma (S)
b.
delta (D)
d.
beta (B)
 

 34. 

You would use SOHCAHTOA to ...
a.
find the length of the unkown side given you have the length of one side and you know  an angle
c.
inverse trigonometric functions
b.
find the angle since we know the lengths of the sides
d.
both a and c
 

 35. 

Layers are primarily a method of organizing __________ on your stage.
a.
objects
c.
sound
b.
movie clips
d.
all of the above
 

 36. 

You can attach script...
a.
to any frame of your main movie timeline
d.
all of the above
b.
to movie clip instances
e.
none of the above
c.
to frames in the timelines of movie clips in your library
 

 37. 

An event handler is a ...
a.
bit of script that sits and waits on a special event to occur.
c.
bit of script that is called once when the instance leaves the stage.
b.
bit of script that is called once when the instance enters the stage
d.
all of the above
 

 38. 

Suppose you have instantiated a movie clip called ball on the stage.  With this clip being selected, you attach the following code to the instance....

onClipEvent(enterFrame){
       _xscale = xscale + 4;
}

This code will...                                     
a.
move the ball instance 4 pixels to the right along the x axis each frame by using the enterFrame event handler
c.
not work unless it is placed in the _root location of your movie
b.
make the ball instance 4 percent fatter each frame by using the enterFrame event handler
d.
none of the above.
 

 39. 

Attaching the following code to an instance of a movie clip will....

onClipEvent(load){
      _alpha = 50;
}
a.
reduce the saturation of the clip by 50 pixels
c.
reduce the saturation of the clip by 50 percent
b.
increase the saturation of the clip by 50 percent
d.
increase the saturation of the clip by 50 pixels
 

 40. 

Consider the following code and that it is placed into the first frame of a movie...

trace(“hello!”);

The Output panel will show
a.
one instance of the word ‘hello!’
c.
this function is just declared and not called so there won’t be any output
b.
several instances of the word ‘hello!’
d.
It won’t show anything because “hello” was not declared as a variable.
 

 41. 

Operators are special symbols we can enter into a script that allow us to manipulate variables.  The variables they operate on are called...
a.
values
c.
logical operators
b.
operands
d.
event handlers
 

 42. 

Indicate below what is the correct compound statement.
a.
myNumber = myNumber + 100;
c.
myNumber += 100;
b.
myNumber + 100 = myNumber;
d.
none of the above
 

 43. 

Curly braces define what is commonly called...
a.
ActionScript
c.
code block
b.
C++
d.
script
 

 44. 

Indicate the best description for the following flow chart.

final_exam_sem_1_files/i0460000.jpg

a.
if Conditional
c.
else if Conditional
b.
else Conditional
d.
none of the above
 

 45. 

The following flow chart is a model for what type of Conditional

final_exam_sem_1_files/i0470000.jpg

a.
do while Conditional
c.
while Conditional
b.
nested Conditional
d.
for conditional
 

Matching
 
 
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
 

 46. 

Reverses the order of all elements in an array.
 

 47. 

Joins all the elements of an array into a string
 

 48. 

Adds and removes elements from an array
 

 49. 

Joins two strings and returns the conglomeration.
 

 50. 

Removes the last elements from an array and returns its value
 

 51. 

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

 52. 

Removes the first element from an array and returns its value
 

 53. 

Sorts an array based on one element of the array
 

 54. 

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

 55. 

Sorts an Array
 

Problem
 

 56. 

Using the distance formula, solve for c if the actual coordinates of point A were (6,8) and the actual coordinates of point B were (12,15). (hint: draw a picture and plug the values into the distance formula)
 

 57. 

Consider the following statement...

resutl1 = 5 + 3 - 2 + 11 - 4;

What is the value of result1?
 

 58. 

Consider the following...

trace( 5 % 2);
trace( 10 % 2);
trace( 10 % 3);
trace( 1 % 5);
trace( 7 % 0);

What is the output for the trace function?
 

 59. 

Which trace function will print?

if( true ){
     trace(“line 1”);
     break;
     trace(“line 2”);
}
trace(“line 3”);
 

 60. 

Consider the following script...

exp = “hello”;
switch( exp ){
     case “hello”:
           trace(“case 1”);
           break;
     case “hi”:
           trace(“case 2”);
           break;
}

What is the output?
 



 
Submit          Reset Help