Wednesday, July 17, 2013

Action Script 3.0 Test Answer

Action Script 3.0 Test Answer

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
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
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 is the length of the given array?
var myArray1 : Array = new Array ("One", "Two", "Three");
a. 0
b. 1
c. 2
d. 3
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
Which of the following is not a security-sandbox type?
a. Local-trusted
b. Local-with-networking
c. Remote
d. Remote-with-networking
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 keywords is used to bring control out of a loop?
a. break
b. continue
c. end
d. terminate
Which class is the parent class of all custom event classes?
a. Event
b. MouseEvent
c. ResultEvent
d. EventDispatcher
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
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.
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
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. Line1
Value of num in try: 25
Value of num in catch: 25
Value of num: 0
b. Line1
Value of num in catch: 25
Value of num: 0
c. Line1
Value of num in try: 25
Value of num in catch: 25
d. Line 1
Value of num in try: Infinity
Value of num: 0
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 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 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 of the following is a valid variable name?
a. _123
b. 123
c. my@Var
d. my-Var

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 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.
Which of the following property of the String class returns the no. of characters in a string?
a. size
b. numChar
c. length
d. None of the above
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.
Which of the following Errors does not occur at runtime?
a. Compile time error
b. Runtime-error
c. Synchronous error
d. Asynchronous error
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.
A constant (const) variable can be initiated only once.
a. True
b. False
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. All 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 is the default maximum size of Shared objects?
a. 10KB
b. 100KB
c. 500KB
d. 1MB
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.
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
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 Start try catch finally Code End
b. Code Start catch finally Code End
c. Code Start
try
catch
finally
d. Code Start
catch
What will be the output of the following trace statement?

trace ("output: " + 10 > 20);
a. output: true
b. output: false
c. true
d. false
The Error class serves as the base class for all run-time errors thrown by Flash.
a. True
b. False
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




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.
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 classes is not used to interact with the client system environment?
a. Application Class
b. ApplicationDomain Class
c. System Class
d. Capabilities Class
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
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();
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 these is not a valid access modifier?
a. Private
b. Protected
c. Internal
d. All of the above are valid

No comments:

Post a Comment