Wednesday 3 February 2016

Test answers for Action Script 3.0 Test (Mac Version)

4 Answered Test Questions:

1. Given the code snippet below, what will be the value of myFlag after the 2nd assignment:

var myFlag : Boolean=false;
myFlag=Boolean (new Date ( ) );
Answers:
• True
• False
• Run time error
• Type Coercion error at compile time
2. 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);
Answers:
• One,Two,Three
• Four,Two,Three
• One,Four,Three
• Two,Three,Four
3. 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);
Answers:
• Undefined
• 0
• 3
• Runtime error: Null pointer reference
4. 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);
}
Answers:
• << try >> << catch >> ArgumentError: throw this error << throw >> << Error >> ArgumentError: throw this error << catch >> ArgumentError: throw this error
• << try >> << catch >> ArgumentError: throw this error << throw >>
• << try >> << catch >> ArgumentError: throw this error << throw >> << catch >> ArgumentError: throw this error
• Compilation error: Nesting or try catch block not permitted

75 NOT Answered Yet Test Questions:

(hold on, will be updated soon)
5. What will be the output of the following trace statement?
trace(myXML..employee.*.@*);
Answers:
• An XMLList that includes every attribute defined on the employee tag, its parent and all descendants
• An XMLList that includes every attribute defined on the employee's parent tag and all descendant tags
• An XMLList that includes every attribute defined on the employee tag's descendants but not on the employee tag
• An XMLList that includes every attribute defined on the employee tag and all its descendants
6. Which of the following are primitive datatypes in Action script 3.0:
Answers:
• Array
• Date
• String
• XML
• Null
7. 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?
Answers:
• func1 is called but func2 is not called.
• func2 is called but func1 is not called.
• Either func1 or func2 are randomly chosen and called.
• Both func1 and func2 are called.
8. Given the following string variable declaration, where 3 is an int

var myString : String = "These are " + 3 + " lines"
The value stored in myString is:
Answers:
• These are 3 lines
• These are lines
• These are three lines
• Compilation Error: could not convert int to String
9. The compiled output of an Action script file is:
Answers:
• '.class' file
• '.swf' file
• '.as' file
• '.mxml' file
10. Given the following instantiation of a date type variable, choose the statement which is true.

var myDate : Date = new Date()
Answers:
• The value of myDate is the current time stamp.
• The value of myDate is an instance of the date class with all values set to either 0 or blank.
• The value of myDate is null.
• None of the above
11. The addEventListener() method of the EventDispatcher class is used to:
Answers:
• create a new Event
• delete an event
• add/register a new listener for an event
• deregister an event listener
12. Which of the following syntax would be used to call a method name helloWorld(), (defined in the html Wrapper) from actionscript?
Answers:
• Application.call ("helloWorld");
• ExternalApplication.call ("helloWorld");
• ExternalInterface.call ("helloWorld");
• helloWorld ();
13. A String is:
Answers:
• a series of zero or more characters.
• a series of one or more characters.
• a single character.
• a set of no more than 5 characters.
14. What is the length of the given array?

var myArray1 : Array = new Array ("One", "Two", "Three");
Answers:
• 0
• 1
• 2
• 3
15. Which of the following conditions must be true to facilitate the usage of seek() function of an Array Collection's Cursor?
Answers:
• The Array Collection must contain only similar data types.
• The Array Collection must be sorted.
• The Array Collection should have more than 278 objects.
• None of the above
16. 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");
        }
Answers:
• Equal
• Unequal
• ""
• Compilation error: Syntax error
17. Which of the following Errors does not occur at runtime?
Answers:
• Compile time error
• Runtime-error
• Synchronous error
• Asynchronous error
18. Which of the following is not a phase in the event propagation lifecycle?
Answers:
• Targeting
• Bubbling
• Cancelling
• Capturing
19. 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());
}
Answers:
• Line1 Value of num in try: 25 Value of num in catch: 25 Value of num: 0
• Line1 Value of num in catch: 25 Value of num: 0
• Line1 Value of num in try: 25 Value of num in catch: 25
• Line 1 Value of num in try: Infinity Value of num: 0
20. Which of the following is not a valid Action script data type?
Answers:
• int
• uint
• long
• String
21. 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):
Answers:
• One
• Two
• Three
• No match
22. A constant (const) variable can be initiated only once.
Answers:
• True
• False
23. What will be the output of the following trace statement?

trace ("output: " + 10 > 20);
Answers:
• output: True
• output: false
• true
• false
24. Which of the following classes is not used to interact with the client system environment?
Answers:
• Application Class
• ApplicationDomain Class
• System Class
• Capabilities Class
25. What does the addItem() method of the ArrayCollection class do?
Answers:
• It adds an item at the beginning of the collection.
• It adds an item at the end of the collection.
• It removes an item from the beginning of the collection.
• It removes an item from the end of the collection.
26. Which of the following loop structures are used to access dynamic instance variables of an object?
Answers:
• while
• do-while
• for
• for-each-in
27. Given that ClassB extends ClassA, which of the following (when written inside the constructor of ClassB) would invoke the constructor of ClassA?
Answers:
• super();
• super().ClassA();
• ClassA();
• this.ClassA();
28. When in application, in what order do the following events take place (starting from the first)?
Answers:
• Creation complete, pre-Initialize, Initialize, Application complete
• pre-Initialize, Creation complete, Initialize, Application complete
• pre-Initialize, Initialize, Application complete, Creation complete
• pre-Initialize, Initialize, Creation complete, Application complete
29. 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?
Answers:
• Yes, for any event
• Yes, but only for MouseEvent.CLICK
• No, events that occur in the Child.swf do not propagate outside that swf
• None of the above
30. Which of the following is not a valid quantifier metacharacter used in Regular expressions?
Answers:
• +
• –
• *
• ?
31. Which nature of ActionScript is depicted by the use of Events?
Answers:
• Synchronous
• Asynchronous
• Procedure oriented
• Object oriented
32. Which of the following methods of the XML object class can be used to add a new node to an XML object?
Answers:
• addNode()
• appendNode()
• addChild()
• appendChild()
• prependChild()
33. The only difference between a timer and a loop is that timers are machine speed independent while loops are not.
Answers:
• True
• False
34. What is the default maximum size of Shared objects?
Answers:
• 10KB
• 100KB
• 500KB
• 1MB
35. The source of an ArrayCollection is of the type:
Answers:
• ArrayCollection
• int
• String
• Array
36. When a variable is of the type protected, it is accessible in:
Answers:
• all child classes irrespective of the package
• only child classes in the same package
• only child classes outside the current package
• not accessible in any of the child classes.
37. Which of the following statements about the system class is true?
Answers:
• It is used to access the user's operating system.
• It can be used to set the content of the user's clipboard.
• It can be used to retrieve current memory usage for flash player.
• All of the above
38. While accessing the clipboard through the system manager class, we can:
Answers:
• read data from the clipboard.
• write data to the clipboard.
• read data from and write data to the clipboard.
• Neither read data from nor write data to the clipboard.
39. If no Access modifier is specified for a property in a class, then by default, the property is:
Answers:
• Public
• Private
• Protected
• Internal
40. Which of the following properties of the Date class does not accepts 0 as a value?
Answers:
• hours
• date
• day
• month
41. Which property of the Event object contains information about the component which generated that event?
Answers:
• target
• currentTarget
• type
• eventPhase
42. Which of these is not a valid access modifier?
Answers:
• Private
• Protected
• Internal
• All of the above are valid.
43. Which class is the parent class of all custom event classes?
Answers:
• Event
• MouseEvent
• ResultEvent
• EventDispatcher
44. Given the following statements about the try/catch/finally block, choose the correct option.
Answers:
• Try is optional but catch and finally are required.
• Catch is optional but try and finally are required.
• Finally is optional but try and catch are required.
• All three blocks are required.
45. Which of the following methods of the String class does not accept a regular expression as its parameter?
Answers:
• search()
• substring()
• replace()
• match()
46. The minimum version of flash player required to run Action script 3.0 is:
Answers:
• 6.0
• 8.0
• 9.0
• 10.0
47. E4X in Action script is used to:
Answers:
• manipulate complex numeric data.
• manipulate String data.
• manipulate string and numeric data.
• manipulate XML data.
48. 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
Answers:
• Compilation error at line1
• Compilation error at line4
• Compilation error at line5
• No error. The code will compile and run without errors.
49. Which of the following keywords is used to bring control out of a loop?
Answers:
• break
• continue
• end
• terminate
50. Which event is triggered when a timer completes its execution?
Answers:
• TimerEvent.CYCLE_COMPLETE
• TimerEvent. END
• TimerEvent. COMPLETE
• TimerEvent.TIMER_COMPLETE
51. Which of the following statements is true?
Answers:
• An array is a collection of objects of the same data type.
• An array is a collection of objects irrespective of the data types.
• The size of an array must be declared when the array is first declared.
• The starting index of an array is 1.
52. Which of the following methods of the String class returns the no. of characters in a string?
Answers:
• size()
• numChar()
• length()
• None of the above
53. The useWeakReference parameter in the addEventListener method is used to:
Answers:
• make the listener eligible for garbage collection
• make the Component for which the event is registered eligible for garbage collection.
• make the parent of the Component for which the event is registered eligible for garbage collection.
• All of the above
54. 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);
Answers:
• Hello
• Blank
• Compilation error
• Runtime error
55. The Error class serves as the base class for all run-time errors thrown by Flash.
Answers:
• True
• False
56. Given the declaration 'a timer', which of the following statements is correct?

var myTimer:Timer = new Timer (500,5);
Answers:
• When the timer is started, the TimerEvent.TIMER event is dispatched 5 times with a difference of 0.5 seconds between 2 successive events.
• When the timer is started, the TimerEvent.TIMER_COMPLETE event is dispatched 5 times with a difference of 500 seconds between 2 successive events.
57. Which of the following statements is correct?
Answers:
• The '.' and '@' operator can be used only to read data.
• The '.' operator can be used to read data and write data but the '@' operator can be used only to read data.
• The '.' and '@' operator can be used both to read and write data.
• The '@' operator can be used to read data and write data but the '.' operator can be used only to read data.
58. Based on the above mentioned declaration of myXML, how can we access the id attribute of the 'employee' tag?
Answers:
• myXML.managers.employee[1].@id
• myXML.employeeList.managers.employee[1].@id
• myXML.managers.employee[1].id
• myXML.employeeList.managers.employee[1].id
59. Which of the following statements is not correct?
Answers:
• TimerEvent.TIMER is dispatched when one cycle of the timer is complete.
• When the repeat count in a timer is set as 0, the timer continues indefinitely until the stop() method is invoked.
• When a timer is instantiated, it starts automatically.
• All of the above statements are correct.
60. What will the output of the following trace statement?

trace(myXML.employee.(lastName=="Zmed"));
Answers:
• All employee blocks are printed on the console.
• The first employee block is printed on the console.
• The complete structure of myXML is printed in the console.
• Only the lastName tag with value "Zmed" is printed.
61. 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?
Answers:
• str1= str1+str2;
• str2.concat(str1,str2);
• str1.concat(str1,str2);
• str1.concat(str2);
• str2.concat(str1);
62. Which of the following is not a correct way of adding an item to an Array myArr?
Answers:
• myArr.push(item);
• myArr.addItem(item);
• myArr[0] = item;
• myArr=[item];
63. 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
Answers:
• Only i and ii are true
• Only i, ii and iii are true
• Only i, ii and iv are true
• All the four are true
64. 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?
Answers:
• Null
• A reference to the last item in the array collection
• A reference to the first item in the array collection
• A reference to any random item in the array collection
65. 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;
Answers:
• only i & ii are valid
• only ii & iii are valid
• only i & iii are valid
• i, ii & iii are all valid
66. 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");
     }
Answers:
• Code Start try catch finally Code End
• Code Start catch finally
• Code Start try catch finally
• Code Start catch
67. 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?
Answers:
• Hello World
• Blank string
• Program execution ends with a Runtime error
• Compilation error
68. Which of the following is not a security-sandbox type?
Answers:
• Local-trusted
• Local-with-networking
• Remote
• Remote-with-networking
69. The default values of String and int type variables are:
Answers:
• null and 0 respectively.
• "" and NaN respectively.
• null and Nan respectively.
• "" and 0 respectively.
70. 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.
Answers:
• Security, SecurityErrorEvent.SECURITY_ERROR
• SecurityError, SecurityErrorEvent.ERROR
• SecurityError, SecurityErrorEvent.SECURITY_ERROR
• Security, SecurityErrorEvent.ERROR
71. What does XML stand for?
Answers:
• Exclusive Markup Language
• Extensible Markup Language
• Exclusive Model Language
• Extensible Model Language
72. The trim() method of StringUtil Class is used:
Answers:
• only to remove all white spaces from the beginning of the string.
• only to remove all white spaces from the end of the string.
• to remove all white spaces from the beginning and the end of the string.
• to remove all whitespaces in the string including those inside the string.
73. Which of the following is a valid variable name?
Answers:
• _123
• 123
• my@Var
• my-Var
74. Which of the following statement is not correct?
Answers:
• While accessing child nodes of an XMLList, the array access operator '[]' can be used and the starting Index is 0.
• While accessing child nodes of an XMLList, the array access operator '[]' can be used but the starting Index in this case is 1.
• While fetching children of an XMLList, the children() method of the XML class can be used interchangeably with the '*' operator.
• All of the above statements are correct.
75. Which of the following types of variables can be accessed without creating an object of a class?
Answers:
• Constant
• Final
• Static
• Global
76. By default, Which SWL local sandbox system is used by flash players to place all local SWF files and assets?
Answers:
• local-trusted sandbox
• local-with-networking sandbox
• local-with-filesystem sandbox
• The AIR application sandbox
77. Which kind of an error is thrown when parsing error occurs in the action script?
Answers:
• Type error
• Syntax error
• Argument error
• Verify error
78. Given a number, num = 23, which of the following methods will be used to convert it to a String:
Answers:
• num.toString();
• num.toSentence();
• num.toWord();
• num.toNumber();
79. The following regular expression : var pattern : RegExp = /\d+/; will match:
Answers:
• one or more words
• zero or more words
• one or more digits
• zero or more digits

No comments:

Post a Comment

Cooking channel intro green screen

  Click here to download HD Videos