Elance Actionscript 3 Test Answers 2015




What keyword brings control out of a loop?
split
break
end
stop


Read the following code: var str1:String = "foobar"; var str2:String = "helloWorld"; var str3:String = (str1.length > 5) ? str1 : str2; trace(str3); What will be the output?
foobar
There will be no output
helloWorld
IllegalOperationError


When started, how will the following Timer execute? var timer:Timer = new Timer(3000,0); will run for:
it will not run
3s - 1time
3000ms - Infinite
300ms - 1time


Which of these errors does not occur at runtime?
Compile time error
Runtime error
Programming error
Synchronous error


What type of number is returned by Math.asin()?
Degree
Radian
Cosine
Whole


When using addChild() to add a child object, what does the "child" get added to?
The timeline
The Display List
A Movie Clip
_root


Sprite is a class of the following package:
flash.mob
flash.graphics
flash.display
flash.sprite


Which is NOT a valid access modifier?
These are all valid access modifiers
internal
private
protected


What is the output of the following snippet? var animal1:String = "Lions"; var animal2:String = "Dogs"; var zoo:Array = new Array(animal1, animal2, " and Bears"); zoo[1] = "Tigers"; trace(zoo);
Nothing; the function throws a compiler error
Lions,Tigers, and Bears
Tigers,Dogs, and Bears
Tigers,Lions, and Bears


Which class is used to load an XML File?
URLLoader
NetLoader
Loader
FileLoader


To detect when an object has entered into a stage we listen for:
obj1.addEventListener(Event.Init,fn);
obj1.addEventListener(Event.InitStage, fn);
obj1.addEventListener(Event.ADDED_TO_STAGE,fn);
obj1.addEventListener(Event.ENTER_FRAME,fn);


What is the result of the following code? var b:Array = [1,2,3].map(function(i) { return i+1 }); trace(b);
2,3,4
,,
undefined
error
1,1,1


What class is needed to change the alignment of text in a TextField?
TextDisplayMode
TextFormat
Format
TextFieldAutoSize


What does the stop() action do?
The code progress stops until play() is called
It stops playback in the timeline it is called in
It stops playback in the _root timeline
Flash doc pauses until the user presses “return”


The proper syntax for assigning an object literal is:
var obj:{"foo", "bar"}
var obj:Object = {"foo", "bar"}
var obj:Object = {prop1:"foo", prop2:"bar"}
var obj:{prop1:"foo", prop2:"bar"}


What event is dispatched when a Loader finishes loading?
Event.REQUEST_COMPLETE
Event.COMPLETE
Event.COMPLETE_REQUEST
Event.LOADING_COMPLETE


What symbols represent an XML literal tag delimiter?
< >
{ }
[ ]
( )


How would you load an image from an external file?
url = new URL("file location");
var urlReq:URLRequest = new URLRequest("file location");
var ldr = new loader("file location");
var URLRequest = ("file location");
var loader = new URL("file location");


Choose the BEST appropriate data type for the following situation: A teacher would like you to record a list of student names and grades in an array.
String
uint
int
Char


On an Event handler function, how do you know which item fired the event ?
By accessing the parent property of the event
It is impossible
By accessing the target property of the event


Which of these is a valid variable declaration?
var myVar = "";
var myVar:String;
var myVar:String = new String();
var myVar:String = "";
All of them.


Which method will call the constructor of a parent class?
branch()
super()
constructor()
parent()


public function someFunction(value: Number) { switch(value) { case 5: trace ("Hello"); case 9: trace ("World"); } trace("Apples"); } What would the output be if someFunction(4) were called?
Nothing; the function would throw a compiler error
HelloWorldApples
Hello World Apples
Apples


Which keyword allows a child class to overwrite a parent class's method?
override
final
static
overwrite


To detect when an object was entered to stage we listen for:
ADDED_TO_STAGE
ADD_STAGE
ADDED_INTO_STAGE
ADDED


The function Date.getDay() will return a zero for what day of the week?
Wednesday
Sunday
Monday
Saturday


The correct syntax for removing an object from a specific index position of the stage is:
stage.removeChild(index);
stage.removeChildIndex(index);
stage.removeChildAt(index);
stage.remove(index);


var check:Boolean = 0; will have value of?
undefined
1
false
0
true


What is the difference between .swc and .swf?
.swc is for graphics
.swc can be imported as a standalone library
none
.swf is more lightweight


Which class can be used to change the color of a display object?
Transform
Matrix
ObjectFormat
ColorTransform


How do you create a circle?
obj.graphics.drawCircleObject();
obj.graphics.circle();
obj.graphics.drawCircle();
obj.grafics.circle();


The addEventListener() function is used to ________.
Add an event
Hide an event listener
Register an event listener for an event
Remove an event


ButtonOne.addEventListener(MouseEvent.CLICK,runA); ButtonTwo.addEventListener(MouseEvent.CLICK,runB); What happens when ButtonOne's click event is triggered?
Both runA and runB are called
Neither runA nor runB are called
runA is called
runB is called


What is the smallest amount by which the Timer class measures time?
Nanoseconds
Frames
Seconds
Milliseconds


How do you add an object to the display list?
add(object);
addChild(object);
addToDisplay(object);
addToStage(object);


What is the import statement for Mouse Click events?
flash.MouseEvent.MouseClick;
flash.events.MouseEvent;
flash.display.MovieClip.MouseEvent;
flash.event.MouseClick;
flash.display.MouseClick;


Which statement can be used to exit an otherwise infinite for loop?
default;
skip;
exit;
break;


Which of the following is NOT a function of the String class?
concat
substr
substring
color


How do you end filling on a shape object?
obj.end();
obj.graphics.end();
obj.gfx.endFill();
obj.grafics.endFill();
obj.graphics.endFill();


Which event class can be used to tell if a user clicks on an object?
MouseEvent
ClickEvent
Event
CursorEvent


What expression will insert a new line into a String?
\n
\new
newline
break


Which function of the String class returns the number of characters in a string?
size()
chars()
length()
characters()


Which of these is a valid variable declaration?
var a:Number = 0;
var int a = 0;
a => 0
variable a = 0;


What element appears above and below lines of annotated code to distinguish them from working code?
*/ and /*
/< and >/
<< and >>
/* and */


Which one of the following is a strict type declaration?
var myVar = new Sprite();
var myVar:Sprite = new Sprite();
var myVar = Sprite();
var myVar:* = new Sprite();


The correct syntax for opening a webpage using the default web browser is:
open(new SiteRequest("www.web.site"));
navigateToURL(new URL("www.web.site"));
navigateToURL(new URLRequest("www.web.site"));
navigateToSite(new Site("www.web.site"));


To display messages on the console we type:
console.log('foo');
trace('foo');
print('foo');
console('foo');


To disable mouse selection to an InteractiveObject, the correct syntax is:
item.mouseEnabled = false;
item.disableMouse()
item.enabled(false)
item.canClick = false;


What is a Sprite?
A display object container
A woodland fairy
A bitmap image
A data type similar to a String


What is the method to add a DisplayObject on the DisplayList ?
addChild()
load()
push()
addItem()


Which of the following is a function of the MovieClip class?
play()
end()
halt()
gotoAndHalt()


What is the output of the following snippet? var string1:String = "Hello World"; var string2:String = "Hello World"; if (string1 == string2) { trace("TRUE"); } else { trace("FALSE"); }
TRUE
Neither; the code results in a compile time error
Neither; the code prints out nothing
FALSE


Choose the BEST appropriate data type for the following situation: Lucy wants to store the names of the animals at the zoo into an array of variables.
Char
Word
Int
String


What is the correct function to call in order to open an external url?
navigateToURL(new URLRequest("www.web.site"));
navigateToURL(new URL("www.web.site"));
open(new SiteRequest("www.web.site"));
navigateToSite(new Site("www.web.site"));


What is the modular and performance-oriented concept upon which ActionScript is built?
Script Code Programming
Procedural Programming
Functional Programming
Object Oriented Programming


To bind an event listener the correct syxtax is:
item.addListener('event',function);
item.listener('event',function);
item.addEventListener('event',function);
item.eventListener('event',function);


To communicate with Javascript the correct synxtax is:
Interface.call('foo');
ExternalInterface('foo');
ExternalInterface.call('foo');
External.call('foo');


Which class can be used to find the size in bytes of your SWF or other media file?
FileSize
LoaderInfo
Loader
FileData


Sprite is a class of the following package:
flash.display
flash.graphics
flash.display.graphics
flash.displaycore


Referring to the index position of an array item that doesn't exist will throw which error?
EvalError
RangeError
DefinitionError
SizeError


What is the name of the function of the StringUtil Class that removes all white spaces from the beginning and end of a String?
trim()
clean()
removeWhiteSpace()
cut()


What is a correct syntax to cast a String "str" into a Number?
newNum = Number(str);
newNum = stringToNumber(str);
newNum = str.Number();
newNum = cast(str, Number);


Which is required to download images from another domain?
allowdomain policy file
crossdomain policy file
username and password
serial number


Choose the BEST appropriate data type for the following situation: Your boss wants you to calculate the percentage of people that donated more than five dollars to your non-profit.
int
Number
long
String


Which of the following is not a primitive type in ActionScript 3.0?
Number
String
Array
Boolean


Which of the following is an example of a bitwise operator
?
||
!=
>> 


Which method allows you to join two Arrays into a new Array?
var myNewArray:Array = myArray1 + myArray2;
var myNewArray:Array = myArray1+=myArray2;
var myNewArray:Array = myArray1.concat(myArray2);
var myNewArray:Array = join(myArray1, myArray2);


The correct syntax for testing for overlap between the bounding boxes of two objects is:
obj1.hitTestPoint(obj2);
obj1.hitTestObject(obj2);
obj1.hitTestBox(obj2);
obj1.hitTest(obj2);


How can you retrieve an attribute from an XML variable?
myXML.item.source;
myXML.item.@source[source];
myXML.item.@source;
myXML.item.source[source];


In the event of an infinite recursion, what exception will be thrown?
BreakError
IllegalOperationError
TimeoutError
StackOverflowError


What is the default maximum size allocated by the user for shared objects?
1 KB
1 MB
100 KB
10 KB


How do you properly remove c in: var c:MovieClip = new MovieClip(); c.addEventListener(Event.ENTER_FRAME, myFunction); addChild(c);
removeChild(c);
delete c;
c.removeEventListener(Event.ENTER_FRAME, myFunction); removeChild(c);


Which class can be used to read the URL that your SWF or media file is currently running on?
Stage
Security
LoaderInfo
Loader


What object can't be added to display list directly?
TextField
SimpleButton
Bitmap
Shape
BitmapData


If a Timer is set with a repeatCount of 0 (zero), how many times will the timer run?
It will throw an error
Infinitely many
Zero
One


What is the difference between .swc and .swf?
.swc is a library of assets, .swf is for Flash Professional only
.swc is an executable packet, .swf is a library
.swc is for Flex, .swf is for Flash Professional
.swc is a class packet, .swf is an executable


To dispatch an event with a custom type the correct syntax is:
this.dispatchEvent('event');
this.dispatchEvent(new Event('myEvent'));
this.dispatchNewEvent(new Event('event'));
this.dispatch(new Event('myEvent'));


To successfully remove an event listener the correct syntax is:
this.removeEventListener('event');
this.removeEvent('event',function);
this.removeEventListener(new Event('event'),function);
this.removeEventListener('event',function);


ActionScript 3.0 is related most closely to ________.
Perl
C
JavaScript
Java


What is an appropriate class to utilize when importing data from an external file?
FileReference
URLLoader
There is no such class
URLFile


What access modifier hides a variable or function?
(none of these)
final
private
hidden


To skip the remaining code in a loop and proceed to the next cycle without leaving the loop you would type
return;
continue;
break;
exit;


Which property of an event listener can be set to allow for garbage collection of that listener?
priority
useWeakReference
useCapture
collected


What is the name of the variable that passes arguments into a flash movie (.swf)?
SWFVar
FlashVars
FlashVar
SWFObject


Which video format is AIR and Flash Player NOT compatible with?
FLV
MP4
M4A
OGG


What method is used to find the character at position (i) in a String (s)?
s.getCharPos(i)
s.getChar(i)
s.charCodeAt(i)
s.charAt(i)


What will be in output console? var a: Sprite = new Sprite(); var b: Sprite = a; a = null; trace(b);
BreakError
IllegalOperationError
StackOverflowError
[object Sprite]


How do you access a specific child of a container Sprite?
mySprite.getChildByIndex(index);
mySprite.getChildByName('child');
mySprite.getChild('child');
mySprite.getChildren(index);


What is the default maximum size for a remote shared object?
5 MB
512 kB
100 kB
1 MB


Read the following code: var i:int = 5; var s:String = "5"; trace(i==s); trace(i===s); What will this code output?
true, false
true, true
false, false
false, true


Which of the following text controls allows the user to input text? i. Text ii. TextArea iii. TextInput iv. RichTextEditor
i, iii, and iv
ii, iii, and iv
i, ii, and iii
i, ii, and iv


Read the following code: var bool1:Boolean = true; var bool2:Boolean = false; trace(bool1 ||= bool2); trace(bool1 &&= bool2); What will be the output?
false, true
true, true
false, false
true, false


Which one is a valid method of opening a link in ActionScript 3?
getURL(new URLRequest("http://google.com"), "_blank");
navigateToURL("http://google.com", "_blank");
navigateToURL(new URLRequest("http://google.com"), "_blank");
getURL("http://google.com", _blank);


How do you store data in a Dictionary?
dictionary.push('key');
dictionary['key'].push('key');
dictionary = 'key';
dictionary[key] = 'key';


What property of an event listener refers to the object actively processing an Event object?
currentTarget
target
listener
currentObject


Which of the following ways can be used to concatenate String str1 and String str2? 1). str1 = str1 + str2; 2). str1.concat(str2); 3). str1.concat(str1, str2); 4). str1 += str2;
All
1, 3, and 4
1, 2, and 3
1, 2, and 4


What will be in output console? var a: Sprite = new Sprite(); var b: Sprite = a; a = null; trace(b);
undefined
[Object Sprite]
b
nothing
null


The volume of a sound can be adjusted using what class?
SoundMixer
Sound
SoundChannel
SoundTransform


What is the output of the following snippet? var world:Number = 3; trace("Hello " + world + 3 + "3");
Hello world 6
Hello 333
Hello world 33
Hello 36


Which of the following is a function of the Timer class?
reset()
tick()
progress()
restart()


To cast a class as a specific type the correct syntax is:
type:myType = new Type(myType);
type:myType = new Type();
type:myType = new myType();
type:myType = new Type() as myType;


Which of the following is a valid way to create a Vector of type String? i. var v: Vector.<String> = new <String>["str1", "str2", "str3"]; ii. var v:Vector.<String> = new Vector.<String>(); iii. var v:<String>Vector = new <String>Vector(); iv. var v: <String>Vector = ["str1", "str2", "str3"];
i and ii
All of these
i and iv
i, ii, and iii


Which keyword will prevent a method from being overwritten by a child class?
protected
final
native
override


What are the three phases of the event flow?
listen, catch and register
capture, target and bubbling
hold, acquire and callback
addListener, callback and removeListener


To display hand cursor over a Sprite you declare:
mouseChildren = true;
useHandCursor = true;l
showHandCursor = true;
cursor = pointer;


What does the following display? for each (var someVar in someArray) { trace(someVar); }
The contents of the array someVar
The contents of the array someArray
None of these
The someArray of someVar


What is AVM1Movie ?
AVM1Movie is a simple movie played in the the AS3 Virtual Machine
AVM1Movie does not exists in ActionScript 3.0
AVM1Movie is a class that represents AVM1 movie clips, which use ActionScript 1.0 or 2.0.


Which of these functions of ArrayCollection adds an item at the end of a collection?
add()
addItem()
splice()
append()


Which of the following will add the element someElement to the end of the Array someArray?
someArray.append(someElement);
someArray[someArray.length] = someElement;
someArray.add(someElement);
someArray[0] = someElement;


Which of the following will NOT be garbage collected?
sprite.addEventListener(MouseEvent.Click, myFn,false,0,true);
sprite.addEventListener(MouseEvent.Click,myFn);
this.removeChildByName('mySprite');
sprite = null;


What is the result of the following code: import flash.utils.getDefinitionByName; var ClassReference:Class = getDefinitionByName("flash.display.Sprite") as Class; var instance:Object = new ClassReference(); trace(instance);
[object Object]
[object Sprite]
[object Class]
[object ClassReference]


How do you create style rules for textFields?
txt.setFontStyle(options);
txt.setTextStyle(options);
txt.setTextFormat(options);
txt.setStyle(options);


What property of the Date class does not accept 0 as a parameter?
month
date
day
hours


What class creates a two way connection between a client Flash/AIR application and a server?
ServerSocket
ServerConnect
LocalConnection
NetConnection


The following code will create: box.graphics.beginFill(0xffffff,0);
A white box
An empty box
Nothing
A black box


What is the difference between Shape and Sprite?
Shape cannot have event listeners attached.
Sprite cannot draw with graphics class.
Sprite cannot add children to it self.
Shape cannot add children to it self.


Which of the following snippets will set String myDay to the current day of the week?
var d:Date = new Date(); myDay = d.date;
var d:Date = new Date(); myDay = d.dayOfWeek;
var d:Date = new Day(); myDay = d.toString();
var d:Date = new Date(); myDay = d.day;


Which of these is not a valid class?
String
Number
Integer
MovieClip
none of these


Which class of objects can be focused by setting stage.focus?
DisplayObject
StaticText
MorphShape
InteractiveObject


What effect does the following code have? button.useHandCursor = true; button.buttonMode = true; button.mouseChildren = false;
No Mouse cursor
Resize Mouse cursor
Pointer Mouse cursor
Default Mouse cursor


How to change the text color of a TextField?
field.color = 0x000000;
field.fontColor = #000000;
field.textColor = 0x000000;
field.textColor = #000000;


Read the following code: var str1:String = "Hello world!"; trace(str1.substr(2,7)); What will be the output?
ello wo
ello w
llo wor
llo wo


To bind a Class to a bitmap object you do the following:
bitmap = new Class();
bitmap.addChild(myClass());
bitmap.addChild(myClass);
bitmap = new myClass();


To hide the standard context menu options, which function can you call?
removeBuiltInItems()
removeMenuItems()
hideBuiltInItems()
hideStandardMenu()


MovieClip is a direct child of which class?
Sprite
InteractiveObject
DisplayObject
Shape


Which is not a correct StageScaleMode Constant?
StageScaleMode.NO_SCALE;
StageScaleMode.EXACT_FIT;
StageScaleMode.NO_BORDER;
StageScaleMode.STRETCH;


Which of the following is NOT a property of a GeolocationEvent?
speed
heading
altitude
timezone


Which event fires when the display objects of a frame have loaded but before any frame scripts run?
exitFrame
frameConstructed
enterFrame
frameStart


To make a Sprite have hand cursor when hovered you do the following:
mySprite.useHandCursor = true;
mySprite.buttonMode = true;
mySprite.mouseChildren = true;
All of these


Tween easing is loaded by importing:
fl.motion.easing
flash.Tween.easing
fl.transitions.Tween.easing
fl.transitions.easing


What is the result of the following code: var b:Number = ["0","1","2","3","4"].indexOf(0); trace(b)
0
-1
undefined


The Loader object exists in which package?
flash.net
flash.display
flash.system
flash.media


What is an appropriate class to utilize when storing data to an external file?
URLFile
There is no such class
FileReference
URLLoader


What is the output of the following snippet? var s:String = "Pandas use tea cups to drink tea"; s.replace("tea", "");
Pandas use tea cups to drink tea
Pandas use tea cups to drink
Pandas use cups to drink
Nothing; the function throws a compiler error


Which of the following can you NOT do through the System class?
Read the user's clipboard
Set the user's clipboard
Read the amount of memory available to Flash/AIR
Close the Flash Player


Which is true about Stage?
Everything is a child of the stage.
Stage can be scaled.
The Stage needs instantiation
Stage object is optional.


What is the default access modifier if none is specified?
public
protected
private
internal
static