Difference between revisions of "SL Cert - Scripting Test Reviews"

From Second Life Wiki
Jump to navigation Jump to search
m (Configured stable versioning for SL Cert - Scripting Test Reviews: [Precedence: Quality, Default: Stable])
 
(16 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{SLCert Navbox}}
[[Category:Certification]]
'''Scripting Test Review Page'''
'''Scripting Test Review Page'''


Line 4: Line 7:


Q1) A script is written in what computer language?
Q1) A script is written in what computer language?
a) html
:: a) html
b) c++
:: b) c++
c) lsl
:: c) lsl
d) xml
:: d) xml


Q2) Which of the following could a script be used for?
Q2) Which of the following could a script be used for?
a) uploading textures
:: a) uploading textures
b) uploading audio/media
:: b) uploading audio/media
c) increasing simulator performance
:: c) increasing simulator performance
d) none of the above
:: d) none of the above


Q3) What is Mono?
Q3) What is Mono?
a) a form of audio using only one channel
:: a) a form of audio using only one channel
b) a french soft cheese
:: b) a french soft cheese
c) an open source scripting engine
:: c) an open source scripting engine
d) a database
:: d) a database


Q4) What does lsl stand for?
Q4) What does lsl stand for?
a) Lucifers Standard Lemon
:: a) Lucifers Standard Lemon
b) Linden Scripting Logo
:: b) Linden Scripting Logo
c) Language Scripting Loop
:: c) Language Scripting Loop
d) Linden Scripting Language
:: d) Linden Scripting Language


Q5) What memory would a pre mono script have available?
Q5) What memory would a pre mono script have available?
a) 64k
:: a) 64k
b) 32k
:: b) 32k
c) 16k
:: c) 16k
d) 8k
:: d) 8k


Q6) When a script is compiled, how does it treat code comments?
Q6) When a script is compiled, how does it treat code comments?
a) causes compile error
:: a) causes compile error
b) converts them
:: b) converts them
c) ignores them
:: c) ignores them
d) highlights them
:: d) highlights them


Q7) Consider the following code:-
Q7) Consider the following code:-
<lsl>


integer v;
integer v;
default
default
     {
     {
     on_rez(integer p){state run;}
 
     state_entry(){v=10;state run;}
     on_rez(integer p){
     state_exit(){v=100;}
        state run;
    }
 
     state_entry(){
        v=10;
        state run;
    }
 
     state_exit(){
        v=100;
    }
 
     }
     }
state run
state run
     {
     {
     on_rez(integer p){llResetScript();}
 
    state_entry(){llSay(0,"V="+(string)v)};
     on_rez(integer p){
          llResetScript();
     }
     }
    state_entry(){
        llSay(0,"V="+(string)v);
    }
    }
</lsl>


Q7a) If the above script is placed in an object and that object is rezzed inworld, what would it say as the value of V?
Q7a) If the above script is placed in an object and that object is rezzed inworld, what would it say as the value of V?
a) 100
:: a) 100
b) 20
:: b) 20
c) 10
:: c) 10
d) 0
:: d) 0


Q7b) If the above script was reset whilst rezzed in world, what would it say as the value of V?
Q7b) If the above script was reset whilst rezzed in world, what would it say as the value of V?
a) 100
:: a) 100
b) 20
:: b) 20
c) 10
:: c) 10
d) 0
:: d) 0


Q8) Consider the following code:-
Q8) Consider the following code:-


<lsl>
integer v;
integer v;
default
default
     {
     {
     on_rez(integer p){state run;}
 
    state_entry(){v=10;state run;}
     on_rez(integer p){
          state run;
     }
     }
    state_entry(){
          v=10;
          state run;
    }
    }
state run
state run
     {
     {
     on_rez(integer p){llResetScript();}
 
     state_entry(){llSay(0,"V="+(string)v)};
     on_rez(integer p){
    state_exit(){v=100;}
        llResetScript();
    }
 
     state_entry(){
        llSay(0,"V="+(string)v);
     }
     }
    state_exit(){
          v=100;
    }
    }
</lsl>


Q8a) If the above script is placed in an object and that object is rezzed inworld, what would it say as the value of V?
Q8a) If the above script is placed in an object and that object is rezzed inworld, what would it say as the value of V?
a) 100
:: a) 100
b) either 0 or 10
:: b) either 0 or 10
c) either 10 or 20
:: c) either 10 or 20
d) 0
:: d) 0


Q8b) If the above script was reset whilst rezzed in world, what would it say as the value of V?
Q8b) If the above script was reset whilst rezzed in world, what would it say as the value of V?
a) 100
:: a) 100
b) 20
:: b) 20
c) 10
:: c) 10
d) 0
:: d) 0
 
Q8c) What would the object say if it were rezzed and then reset?
:: a) 100
:: b) 20
:: c) 10
:: d) 0
 


Q9) Consider the following code:-
Q9) Consider the following code:-
<lsl>


integer i=1;
integer i=1;
float f=1.0;
float f=1.0;
string s="1";
string s="1";
default
default
     {
     {
     on_rez(integer p){llResetScript();}
 
     on_rez(integer p){
        llResetScript();
    }
 
     state_entry()
     state_entry()
         {
         {
Line 110: Line 173:
         llSay(0,"V="+(string)s);
         llSay(0,"V="+(string)s);
         }
         }
     }
     }
</lsl>


Q9a) When the above script runs what will it say as the value of V?
Q9a) When the above script runs what will it say as the value of V?
a) 3
:: a) 3
b) 7
:: b) 7
c) 12
:: c) 12
d) 1
:: d) 1


Q9b) If the line 'llSay(0,"V="+(string)s);' is changed to 'llSay(0,"V="+(string)v;' what would it say as the value of V?
Q9b) If the line <lsl>llSay(0,"V="+(string)s);</lsl> is changed to <lsl>llSay(0,"V="+(string)v);</lsl> what would it say as the value of V?
a) 3
:: a) 3
b) 7
:: b) 7
c) 12
:: c) 12
d) 1
:: d) 1


Q9c) Keeping the code as per change in Q9b and altering the line 'v=v+1' to 'v*=3', what would it say as the value of V?
Q9c) Keeping the code as per change in Q9b and altering the line <lsl>v=v+1;</lsl> to <lsl>v*=3;</lsl> what would it say as the value of V?
a) 3
:: a) 3
b) 7
:: b) 7
c) 12
:: c) 12
d) 1
:: d) 1


Q10) Which of the following is a function?
Q10) Which of the following is a function?
a) (vector)v
:: a) (vector)v
b) llSay()
:: b) llSay()
c) !=
:: c) !=
d) state_entry()
:: d) state_entry()


Q11) Which of the following is an operator?
Q11) Which of the following is an operator?
a) (vector)v
:: a) (vector)v
b) llSay()
:: b) llSay()
c) !=
:: c) !=
d) state_entry()
:: d) state_entry()


Q12) Which of the following is a typecast?
Q12) Which of the following is a typecast?
a) (vector)v
:: a) (vector)v
b) llSay()
:: b) llSay()
c) !=
:: c) !=
d) state_entry()
:: d) state_entry()


Q13) Which of the following is an event?
Q13) Which of the following is an event?
a) (vector)v
:: a) (vector)v
b) llSay()
:: b) llSay()
c) !=
:: c) !=
d) state_entry()
:: d) state_entry()


Q14) Which of the following is a function?
Q14) Which of the following is a function?
a) setup()
:: a) setup()
b) timer()
:: b) timer()
c) on_rez()
:: c) on_rez()
d) state_entry()
:: d) state_entry()


Q15) Consider the following code:-
Q15) Consider the following code:-
<lsl>


integer v;
integer v;
default
default
     {
     {
     on_rez(integer p){llResetScript();}
 
     on_rez(integer p){
          llResetScript();
    }
 
     touch_start(integer n)
     touch_start(integer n)
         {
         {
Line 171: Line 244:
         if(v==10 || v==20){llSay(0,"HELLO!");}
         if(v==10 || v==20){llSay(0,"HELLO!");}
         }
         }
     }
     }
</lsl>


Q15a) Whats the minimum number of times object containing this script needs to be touched in order to make it say "HELLO!"?
Q15a) Whats the minimum number of times object containing this script needs to be touched in order to make it say "HELLO!"?
a) 1
:: a) 1
b) 2
:: b) 2
c) 5
:: c) 5
d) 10
:: d) 10


Q15b) Changing above code '(v==10 || v==20)' to '(v==10 || v!=20)'. Whats the minimum number of times object needs to be touched in order to say "HELLO!"?
Q15b) Changing above code <lsl>(v==10 || v==20)</lsl> to <lsl>(v==10 || v!=20)</lsl> Whats the minimum number of times object needs to be touched in order to say "HELLO!"?
a) 1
:: a) 1
b) 2
:: b) 2
c) 5
:: c) 5
d) 10
:: d) 10
          
          
Q15c) Changing above code to '(v==10 || v<20)'. Whats the minimum number of times object needs to be touched in order to say "HELLO!"?
Q15c) Changing above code to <lsl>(v==10 || v<20)</lsl> Whats the minimum number of times object needs to be touched in order to say "HELLO!"?
a) 1
:: a) 1
b) 2
:: b) 2
c) 5
:: c) 5
d) 10
:: d) 10
 
Q15d) Changing above code to <lsl>(v>4 && (v+1)>5)</lsl> Whats the minimum number of times object needs to be touched in order to say "HELLO!"?
:: a) 1
:: b) 2
:: c) 5
:: d) 10
 
Q16) The following questions refer to the code below. Assume that the script is reset, and the owner right clicks and releases on the object twice. (The owner is the only person to touch the object.)
 
<lsl>
integer number;
integer dragging;
 
default
{
 
    state_entry(){
        number = 0;
        dragging = 0;
    }
 
    touch_start(integer num_detected)
    {
          number += 1;
    }
 
    touch_end(integer num_detected)
    {
          if(llDetectedKey(0)==llGetOwner()) {
              number+=2;
              llOwnerSay((string)number);
          }
    }
 
    touch(integer num_detected)
    {
          dragging += 1;
    }
}
</lsl>
 
Q16a) What is the final number that is printed at the end?
::  a) 1
::  b) 2
::  c) 3
::  d) 4
::  e) 5
::  f) 6
::  g) 7
::  h) 8
::  i) Not enough information to determine.
::  j) No number is printed.
 
Q16b) What is the value of "dragging?"
::  a) 1
::  b) 2
::  c) 3
::  d) 4
::  e) 5
::  f) 6
::  g) 7
::  h) 8
::  i) Not enough information to determine.
::  j) No number is printed.
 
Q16c) If the script is reset and someone other than the owner clicks on the object twice, what is the last number printed?
::  a) 1
::  b) 2
::  c) 3
::  d) 4
::  e) 5
::  f) 6
::  g) 7
::  h) 8
::  i) Not enough information to determine.
::  j) No number is printed.
 
 
Q17) The following questions refer to the code below. Assume that the script is reset, and the owner right clicks and releases on the object twice. (The owner is the only person to touch the object.)
 
<lsl>
float time_to_wait;
integer number_calls;
 
default
{
 
    state_entry(){
        time_to_wait = 10.0;
        number_calls = 0;
    }
 
    touch_start(integer num_detected)
    {
          llSetTimerEvent(time_to_wait);
    }
 
    timer()
    {
        if(time_to_wait < 1.0) {
            time_to_wait *= 0.5;
            number_calls += 1;
            llSetTimerEvent(time_to_wait);
        } else {
            llSetTimerEvent(0.0);
            llOwnerSay((string)number_calls);
        }
    }
 
}
</lsl>
 
Q17a) What is the final number that is printed at the end?
::  a) 1
::  b) 2
::  c) 3
::  d) 4
::  e) 5
::  f) 6
::  g) 7
::  h) 8
::  i) No number is printed.


Q15d) Changing above code to '(v>4 && (v+1)>5)'. Whats the minimum number of times object needs to be touched in order to say "HELLO!"?
Q17b) How much time passes before a number is printed?
a) 1
::  a) 10 sec.
b) 2
::  b) 15 sec.
c) 5
::  c) 17.5 sec
d) 10
::  d) 18.375 sec.
::  e) 18.750 sec.
::  f) 19.375 sec.
::  g) Not enough information to determine.
::  h) No number is printed.

Latest revision as of 14:54, 8 December 2009

Scripting Test Review Page

SL Cert Basic Scripting Example Test

Q1) A script is written in what computer language?

a) html
b) c++
c) lsl
d) xml

Q2) Which of the following could a script be used for?

a) uploading textures
b) uploading audio/media
c) increasing simulator performance
d) none of the above

Q3) What is Mono?

a) a form of audio using only one channel
b) a french soft cheese
c) an open source scripting engine
d) a database

Q4) What does lsl stand for?

a) Lucifers Standard Lemon
b) Linden Scripting Logo
c) Language Scripting Loop
d) Linden Scripting Language

Q5) What memory would a pre mono script have available?

a) 64k
b) 32k
c) 16k
d) 8k

Q6) When a script is compiled, how does it treat code comments?

a) causes compile error
b) converts them
c) ignores them
d) highlights them

Q7) Consider the following code:-

<lsl>

integer v; default

   {
   on_rez(integer p){
        state run;
   }
   state_entry(){
        v=10;
        state run;
   }
   state_exit(){
        v=100;
   }
   }

state run

   {
   on_rez(integer p){
         llResetScript();
   }
   state_entry(){
       llSay(0,"V="+(string)v);
   }
   }

</lsl>

Q7a) If the above script is placed in an object and that object is rezzed inworld, what would it say as the value of V?

a) 100
b) 20
c) 10
d) 0

Q7b) If the above script was reset whilst rezzed in world, what would it say as the value of V?

a) 100
b) 20
c) 10
d) 0

Q8) Consider the following code:-

<lsl> integer v;

default

   {
   on_rez(integer p){
          state run;
   }
   state_entry(){
          v=10;
          state run;
   }
   }


state run

   {
   on_rez(integer p){
       llResetScript();
   }
   state_entry(){
       llSay(0,"V="+(string)v);
   }
   state_exit(){
         v=100;
   }
   }

</lsl>

Q8a) If the above script is placed in an object and that object is rezzed inworld, what would it say as the value of V?

a) 100
b) either 0 or 10
c) either 10 or 20
d) 0

Q8b) If the above script was reset whilst rezzed in world, what would it say as the value of V?

a) 100
b) 20
c) 10
d) 0

Q8c) What would the object say if it were rezzed and then reset?

a) 100
b) 20
c) 10
d) 0


Q9) Consider the following code:-

<lsl>

integer i=1; float f=1.0; string s="1";

default

   {
   on_rez(integer p){
       llResetScript();
   }
   state_entry()
       {
       integer v=i+(integer)f+(integer)s;
       v=v+1;
       v+=1;
       v++;
       ++v;
       llSay(0,"V="+(string)s);
       }
   }

</lsl>

Q9a) When the above script runs what will it say as the value of V?

a) 3
b) 7
c) 12
d) 1

Q9b) If the line <lsl>llSay(0,"V="+(string)s);</lsl> is changed to <lsl>llSay(0,"V="+(string)v);</lsl> what would it say as the value of V?

a) 3
b) 7
c) 12
d) 1

Q9c) Keeping the code as per change in Q9b and altering the line <lsl>v=v+1;</lsl> to <lsl>v*=3;</lsl> what would it say as the value of V?

a) 3
b) 7
c) 12
d) 1

Q10) Which of the following is a function?

a) (vector)v
b) llSay()
c) !=
d) state_entry()

Q11) Which of the following is an operator?

a) (vector)v
b) llSay()
c) !=
d) state_entry()

Q12) Which of the following is a typecast?

a) (vector)v
b) llSay()
c) !=
d) state_entry()

Q13) Which of the following is an event?

a) (vector)v
b) llSay()
c) !=
d) state_entry()

Q14) Which of the following is a function?

a) setup()
b) timer()
c) on_rez()
d) state_entry()

Q15) Consider the following code:-

<lsl>

integer v;

default

   {
   on_rez(integer p){
         llResetScript();
   }
   touch_start(integer n)
       {
       v+=n;
       if(v==10 || v==20){llSay(0,"HELLO!");}
       }
   }

</lsl>

Q15a) Whats the minimum number of times object containing this script needs to be touched in order to make it say "HELLO!"?

a) 1
b) 2
c) 5
d) 10

Q15b) Changing above code <lsl>(v==10 || v==20)</lsl> to <lsl>(v==10 || v!=20)</lsl> Whats the minimum number of times object needs to be touched in order to say "HELLO!"?

a) 1
b) 2
c) 5
d) 10

Q15c) Changing above code to <lsl>(v==10 || v<20)</lsl> Whats the minimum number of times object needs to be touched in order to say "HELLO!"?

a) 1
b) 2
c) 5
d) 10

Q15d) Changing above code to <lsl>(v>4 && (v+1)>5)</lsl> Whats the minimum number of times object needs to be touched in order to say "HELLO!"?

a) 1
b) 2
c) 5
d) 10

Q16) The following questions refer to the code below. Assume that the script is reset, and the owner right clicks and releases on the object twice. (The owner is the only person to touch the object.)

<lsl> integer number; integer dragging;

default {

    state_entry(){
        number = 0;
        dragging = 0;
    }
    touch_start(integer num_detected)
    {
         number += 1;
    }
    touch_end(integer num_detected)
    {
         if(llDetectedKey(0)==llGetOwner()) {
             number+=2;
             llOwnerSay((string)number);
         }
    }
    touch(integer num_detected)
    {
         dragging += 1;
    }

} </lsl>

Q16a) What is the final number that is printed at the end?

a) 1
b) 2
c) 3
d) 4
e) 5
f) 6
g) 7
h) 8
i) Not enough information to determine.
j) No number is printed.

Q16b) What is the value of "dragging?"

a) 1
b) 2
c) 3
d) 4
e) 5
f) 6
g) 7
h) 8
i) Not enough information to determine.
j) No number is printed.

Q16c) If the script is reset and someone other than the owner clicks on the object twice, what is the last number printed?

a) 1
b) 2
c) 3
d) 4
e) 5
f) 6
g) 7
h) 8
i) Not enough information to determine.
j) No number is printed.


Q17) The following questions refer to the code below. Assume that the script is reset, and the owner right clicks and releases on the object twice. (The owner is the only person to touch the object.)

<lsl> float time_to_wait; integer number_calls;

default {

    state_entry(){
        time_to_wait = 10.0;
        number_calls = 0;
    }
    touch_start(integer num_detected)
    {
         llSetTimerEvent(time_to_wait);
    }
    timer() 
    {
        if(time_to_wait < 1.0) {
            time_to_wait *= 0.5;
            number_calls += 1;
            llSetTimerEvent(time_to_wait);
        } else {
            llSetTimerEvent(0.0);
            llOwnerSay((string)number_calls);
        }
    }

} </lsl>

Q17a) What is the final number that is printed at the end?

a) 1
b) 2
c) 3
d) 4
e) 5
f) 6
g) 7
h) 8
i) No number is printed.

Q17b) How much time passes before a number is printed?

a) 10 sec.
b) 15 sec.
c) 17.5 sec
d) 18.375 sec.
e) 18.750 sec.
f) 19.375 sec.
g) Not enough information to determine.
h) No number is printed.