Action Script 3.0 Test (Mac Version)

Action Script 3.0 Test (Mac Version)

Which of the following methods of the String class returns the no. of characters in
a string?

a. size()
b. numChar()
c. length()
d. None of the above
Which of the following is not a valid quantifier metacharacter used in Regular expressions?

a. +
b. –
c. *
d. ?
Which of the following is not a phase in the event propagation lifecycle?

a. Targeting
b. Bubbling
c. Cancelling
d. Capturing
The addEventListener() method of the EventDispatcher class is used to:

a. create a new Event
b. delete an event
c. add/register a new listener for an event
d. deregister an event listener
Which of the following statements is true?

a. An array is a collection of objects of the same data type.
b. An array is a collection of objects irrespective of the data types.
c. The size of an array must be declared when the array is first declared.
d. The starting index of an array is 1.
Which of the following methods of the XML object class can be used to add a new node to an XML object?

a. addNode()
b. appendNode()
c. addChild()
d. appendChild()
e. prependChild()
Which of the following loop structures are used to access dynamic instance variables of an object?

a. while
b. do-while
c. for
d. for-each-in
When a variable is of the type protected, it is accessible in:

a. all child classes irrespective of the package
b. only child classes in the same package
c. only child classes outside the current package
d. not accessible in any of the child classes.
Which of the following statements is not correct?
a. TimerEvent.TIMER is dispatched when one cycle of the timer is complete.
b. When the repeat count in a timer is set as 0, the timer continues indefinitely until the stop() method is invoked.
c. When a timer is instantiated, it starts automatically.
d. All of the above statements are correct.
Given that two event listeners are registered for a component CompA as:

CompA.addEventListener(MouseEvent.CLICK, funC1);
CompA.addEventListener(MouseEvent.CLICK, funC2);

What Will happen When a click event is fired on CompA?
a. func1 is called but func2 is not called.
b. func2 is called but func1 is not called.
c. Either func1 or func2 are randomly chosen and called.
d. Both func1 and func2 are called.
Which of the following methods of the String class does not accept a regular expression as its parameter?
a. search()
b. substring()
c. replace()
d. match()
The Error class serves as the base class for all run-time errors thrown by Flash.
a. True
b. False
Suppose we have two swf's named Parent.swf and Child.swf (in the same domain), where the Child.swf is loaded inside the Parent.swf as a module, can an Event listener be registered in the Parent.swf to detect mouse click events inside the Child.swf?
a. Yes, for any event
b. Yes, but only for MouseEvent.CLICK
c. No, events that occur in the Child.swf do not propagate outside that swf
d. None of the above
Which of these is not a valid access modifier?
a. Private
b. Protected
c. Internal
d. All of the above are valid.
Given the following code snippet:

public function helloWorld(value:int) : String {
switch(value){
  case 1:
    return "One";
  default:
    return "No Match";
  case 2:
    return "Two";
  case 3:
    return "Three";
   }
}

What will be returned if we pass call the above function as helloWorld(2):
a. One
b. Two
c. Three
d. No match
Suppose we have an arrayCollection whose cursor (myCursor) has been created using the arraycollection's getCursor() method. At runtime, when myCursor.afterLast returns true, what is the value of myCursor.current?
a. Null
b. A reference to the last item in the array collection
c. A reference to the first item in the array collection
d. A reference to any random item in the array collection
The following regular expression : var pattern : RegExp = /\d+/; will match:
a. one or more words
b. zero or more words
c. one or more digits
d. zero or more digits

What will be the output of the following code snippet?

try {    try {
        trace("<< try >>");
        throw new ArgumentError ("throw this error");
    } catch(error : ArgumentError) {
        trace("<< catch >> " + error);
        trace("<< throw >>");
        throw error;
    } catch(error:Error) {
        trace ("<< Error >> " + error);
    }
} catch (error:ArgumentError) {
    trace ("<< catch >> " + error);
}
a. << try >> << catch >> ArgumentError: throw this error << throw >> << Error >> ArgumentError: throw this error << catch >> ArgumentError: throw this error
b. << try >> << catch >> ArgumentError: throw this error << throw >>
c. << try >> << catch >> ArgumentError: throw this error << throw >> << catch >> ArgumentError: throw this error
d. Compilation error: Nesting or try catch block not permitted
What would happen when the following piece of code is compiled and run?

var p : * = new ArrayCollection()      //Line1
p.addItem("vishal");          //Line2
p.addItem(24);           //Line3
p= new Date();           //Line4
var mydate : Date = p;          //Line5
a. Compilation error at line1
b. Compilation error at line4
c. Compilation error at line5
d. No error. The code will compile and run without errors.
A constant (const) variable can be initiated only once.
a. True
b. False
What does XML stand for?
a. Exclusive Markup Language
b. Extensible Markup Language
c. Exclusive Model Language
d. Extensible Model Language
Given the following code snippet, what will be the output when helloWorld( ) is run?

public function helloWorld() : void {
        trace("Code Start" );
         try{
            throw new Error ("Test_Error");
            trace("try");}
         catch(err : Error) {
          trace("catch");
          return;}
         finally{
          trace("finally");}
        trace("Code End");
     }
a. Code StarttrycatchfinallyCode End
b. Code Startcatchfinally
c. Code Starttrycatchfinally
d. Code Startcatch
Which of the following properties of the Date class does not accepts 0 as a value?

a. hours
b. date
c. day
d. month

Which of the following syntax would be used to call a method name helloWorld(), (defined in the html Wrapper) from actionscript?
a. Application.call ("helloWorld");
b. ExternalApplication.call ("helloWorld");
c. ExternalInterface.call ("helloWorld");
d. helloWorld ();
When in application, in what order do the following events take place (starting from the first)?
a. Creation complete, pre-Initialize, Initialize, Application complete
b. pre-Initialize, Creation complete, Initialize, Application complete
c. pre-Initialize, Initialize, Application complete, Creation complete
d. pre-Initialize, Initialize, Creation complete, Application complete




Based on the above mentioned declaration of myXML, how can we access the id attribute of the 'employee' tag?
a. myXML.managers.employee[1].@id
b. myXML.employeeList.managers.employee[1].@id
c. myXML.managers.employee[1].id
d. myXML.employeeList.managers.employee[1].id
Which class is the parent class of all custom event classes?
a. Event
b. MouseEvent
c. ResultEvent
d. EventDispatcher
Which of the following is not a correct way of adding an item to an Array myArr?
a. myArr.push(item);
b. myArr.addItem(item);
c. myArr[0] = item;
d. myArr=[item];
Which of the following types of variables can be accessed without creating an object of a class?
a. Constant
b. Final
c. Static
d. Global
The minimum version of flash player required to run Action script 3.0 is:
a. 6.0
b. 8.0
c. 9.0
d. 10.0
The default values of String and int type variables are:
a. null and 0 respectively.
b. "" and NaN respectively.
c. null and Nan respectively.
d. "" and 0 respectively.
Which of the following is not a valid Action script data type?
a. int
b. uint
c. long
d. String
What will the output of the following trace statement?

trace(myXML.employee.(lastName=="Zmed"));
a. All employee blocks are printed on the console.
b. The first employee block is printed on the console.
c. The complete structure of myXML is printed in the console.
d. Only the lastName tag with value "Zmed" is printed.
What would be the output of the following code snippet?
private var myStr : String;

public function get myStr() : String {
        return myStr;
}
public function set myStr (value:String) : void {
        myStr=value;
}
-------------------------------------------------------
myStr="Hello";
trace(myStr);
a. Hello
b. Blank
c. Compilation error
d. Runtime error
Which of the following conditions must be true to facilitate the usage of seek() function of an Array Collection's Cursor?
a. The Array Collection must contain only similar data types.
b. The Array Collection must be sorted.
c. The Array Collection should have more than 278 objects.
d. None of the above
Which property of the Event object contains information about the component which generated that event?
a. target
b. currentTarget
c. type
d. eventPhase
An Swf in a local security sandbox:
a. can access all resources in the local security sandbox.
b. can access some but not all resources in the local security sandbox.
c. can access no resources in the local security sandbox.
d. can access resources in the local as well as the remote security sandbox.
Which of the following statements about the system class is true?
a. It is used to access the user's operating system.
b. It can be used to set the content of the user's clipboard.
c. It can be used to retrieve current memory usage for flash player.
d. All of the above
Which of the following are primitive datatypes in Action script 3.0:
a. Array
b. Date
c. String
d. XML
e. Null
Given the following code snippet, what will be the output when helloWorld() is run?

public function helloWorld() : void {
    trace("Line 1" );
    var num : Number=25;
    try{
      num=num/0;
      trace ("Value of num in try: "+num.toString());}
    catch (err : IOError) {
      trace("Value of num in catch: "+num.toString());}
    finally{
      num=0;}
    trace("Value of num: "+num.toString());
}
a. Line1Value of num in try: 25Value of num in catch: 25Value of num: 0
b. Line1Value of num in catch: 25Value of num: 0
c. Line1Value of num in try: 25Value of num in catch: 25
d. Line 1Value of num in try: InfinityValue of num: 0
Given the code snippet below, what will be the value of myFlag after the 2nd assignment:

var myFlag : Boolean=false;
myFlag=Boolean (new Date ( ) );
a. True
b. False
c. Run time error
d. Type Coercion error at compile time
The trim() method of StringUtil Class is used:
a. only to remove all white spaces from the beginning of the string.
b. only to remove all white spaces from the end of the string.
c. to remove all white spaces from the beginning and the end of the string.
d. to remove all whitespaces in the string including those inside the string.
Which kind of an error is thrown when parsing error occurs in the action script?
a. Type error
b. Syntax error
c. Argument error
d. Verify error
Which of the following is a valid variable name?
a. _123
b. 123
c. my@Var
d. my-Var
Read the following statements and then choose the correct option.

i. A class can extend another class
ii. A class can Implement an Interface
iii. An interface can extend a class
iv. An interface can extend another interface
a. Only i and ii are true
b. Only i, ii and iii are true
c. Only i, ii and iv are true
d. All the four are true
Which of the following Errors does not occur at runtime?
a. Compile time error
b. Runtime-error
c. Synchronous error
d. Asynchronous error
What will be the output of the following code snippet?

        var num1 : String="Hello";
        var num2:String="Hello";
        if (num1===num2) {
            trace ("Equal");
          } else {
            trace ("Unequal");
        }
a. Equal
b. Unequal
c. ""
d. Compilation error: Syntax error
While accessing the clipboard through the system manager class, we can:
a. read data from the clipboard.
b. write data to the clipboard.
c. read data from and write data to the clipboard.
d. Neither read data from nor write data to the clipboard.
What will be the output of the following trace statement?

trace ("output: " + 10 > 20);
a. output: True
b. output: false
c. true
d. false
Which of the following keywords is used to bring control out of a loop?
a. break
b. continue
c. end
d. terminate
What does the addItem() method of the ArrayCollection class do?
a. It adds an item at the beginning of the collection.
b. It adds an item at the end of the collection.
c. It removes an item from the beginning of the collection.
d. It removes an item from the end of the collection.
Which of the following statements is correct?
a. The '.' and '@' operator can be used only to read data.
b. The '.' operator can be used to read data and write data but the '@' operator can be used only to read data.
c. The '.' and '@' operator can be used both to read and write data.
d. The '@' operator can be used to read data and write data but the '.' operator can be used only to read data.
When ActionScript can immediately judge an operation to be in violation of a security rule, the __________ exception is thrown, and if, after waiting for some asynchronous task to complete, ActionScript deems an operation in violation of a security rule, the __________ event is dispatched.
a. Security, SecurityErrorEvent.SECURITY_ERROR
b. SecurityError, SecurityErrorEvent.ERROR
c. SecurityError, SecurityErrorEvent.SECURITY_ERROR
d. Security, SecurityErrorEvent.ERROR
What is the default maximum size of Shared objects?
a. 10KB
b. 100KB
c. 500KB
d. 1MB
Given the following instantiation of a date type variable, choose the statement which is true.

var myDate : Date = new Date()
a. The value of myDate is the current time stamp.
b. The value of myDate is an instance of the date class with all values set to either 0 or blank.
c. The value of myDate is null.
d. None of the above
What will be the output of the following code snippet?

    var myArray1 : Array = new Array("One", "Two", "Three");
    var myArray2 : Array = myArray1;
    myArray2[1] = "Four";
    trace(myArray1);
a. One,Two,Three
b. Four,Two,Three
c. One,Four,Three
d. Two,Three,Four
What will be the output of the following code snippet?

try {    try {
        trace("<< try >>");
        throw new ArgumentError ("throw this error");
    } catch(error : ArgumentError) {
        trace("<< catch >> " + error);
        trace("<< throw >>");
        throw error;
    } catch(error:Error) {
        trace ("<< Error >> " + error);
    }
} catch (error:ArgumentError) {
    trace ("<< catch >> " + error);
}
a. << try >> << catch >> ArgumentError: throw this error << throw >> << Error >>    ArgumentError: throw this error << catch >> ArgumentError: throw this error
b. << try >> << catch >> ArgumentError: throw this error << throw >>
c. << try >> << catch >> ArgumentError: throw this error << throw >> << catch >> ArgumentError: throw this error
d. Compilation error: Nesting or try catch block not permitted
Which nature of ActionScript is depicted by the use of Events?
a. Synchronous
b. Asynchronous
c. Procedure oriented
d. Object oriented
What will be the output of the following trace statement?

trace(myXML..employee.*.@*);
a. An XMLList that includes every attribute defined on the employee tag, its parent and all descendants
b. An XMLList that includes every attribute defined on the employee's parent tag and all descendant tags
c. An XMLList that includes every attribute defined on the employee tag's descendants but not on the employee tag
d. An XMLList that includes every attribute defined on the employee tag and all its descendants
Given a number, num = 23, which of the following methods will be used to convert it to a String: 

a. num.toString();
b. num.toSentence();
c. num.toWord();
d. num.toNumber();
A String is:
a. a series of zero or more characters.
b. a series of one or more characters.
c. a single character.
d. a set of no more than 5 characters.
If no Access modifier is specified for a property in a class, then by default, the property is:

a. Public
b. Private
c. Protected
d. Internal
Which event is triggered when a timer completes its execution? 

a. TimerEvent.CYCLE_COMPLETE
b. TimerEvent. END
c. TimerEvent. COMPLETE
d. TimerEvent. TIMER_COMPLETE 

Given two String variables str1="Hello" and str2="World", which of the following 2 ways can be used to concatenate the 2 strings and store the result in str1?
a. str1= str1+str2;
b. str2.concat(str1,str2);
c. str1.concat(str1,str2);
d. str1.concat(str2);
e. str2.concat(str1);
Given the following string variable declaration, where 3 is an int

var myString : String = "These are " + 3 + " lines"
The value stored in myString is:
a. These are 3 lines
b. These are lines
c. These are three lines
d. Compilation Error: could not convert int to String
What will be the output of the following code snippet?

    var myArray1 : Array = new Array ("One", "Two", "Three");
    for(var i : int=0; i<3; i++)
    {
        delete myArray1[i];
    }
    trace(myArray1.length);
a. Undefined
b. 0
c. 3
d. Runtime error: Null pointer reference 

Which of the following is not a security-sandbox type?
a. Local-trusted
b. Local-with-networking
c. Remote
d. Remote-with-networking
 
E4X in Action script is used to: 

a. manipulate complex numeric data.
b. manipulate String data.
c. manipulate string and numeric data.
d. manipulate XML data.

Which of the following statement is not correct?

a. While accessing child nodes of an XMLList, the array access operator '[]' can be used and the starting Index is 0.
b. While accessing child nodes of an XMLList, the array access operator '[]' can be used but the starting Index in this case is 1.
c. While fetching children of an XMLList, the children() method of the XML class can be used interchangeably with the '*' operator.
d. All of the above statements are correct.
Look at the following function declarations and then choose the correct option.

i. public function myFunction():*;
ii. public function myFunction():void;
iii. public function myFunction():String;
a. only i & ii are valid
b. only ii & iii are valid
c. only i & iii are valid
d. i, ii & iii are all valid
Ques:Given the following code snippet:

public class Student {
    public function Student () {
        trace("Student variable created");
    }
    public function hello () : String {
        return "Hello World";
    }
}
-------------------------------------------------------
public function helloWorld () : String {
    var student1 : Student;
    return student1.hello ();
}

What will the function helloWorld() return?
a. Hello World
b. Blank string
c. Program execution ends with a Runtime error
d. Compilation error
Given that ClassB extends ClassA, which of the following (when written inside the constructor of ClassB) would invoke the constructor of ClassA?
a. super();
b. super().ClassA();
c. ClassA();
d. this.ClassA();
Given the declaration 'a timer', which of the following statements is correct?

var myTimer:Timer = new Timer (500,5);
a. When the timer is started, the TimerEvent.TIMER event is dispatched 5 times with a difference of 0.5 seconds between 2 successive events.
b. When the timer is started, the TimerEvent.TIMER_COMPLETE event is dispatched 5 times with a difference of 500 seconds between 2 successive events.

0 comments: