Hello, I am fairly new to this, and I am working on a project and I am trying to get a better understanding of everything, and had a few questions about scratch. Can anyone help me?
1) Once a variable contains a value, can that value be changed?
2) Can a variable contain a number, then later in the program, contain words, and if so could that be a bad thing?
3) If there are two loops, the outer executes 5 times, the inner executes 3 times. Inside the inner loop, there is a block of code that makes a sprite say "text". How many times will the sprite say, text'?
4) You have a program that has an if/else structure, and two variables, X and Y. The only time you want the alternative block(s) to execute is when both variables equal 10. What Boolean expression could you use for this situation?
Offline
TRocket wrote:
1) yes it can be changed
2) yes
3)15 times
4)[blocks] << <( <{ X }> <=>10 )> <and> <( <{ Y }> <=>10 )> >>[/blocks]
Here's a clearer version of 4);
If (X = 10) and (Y = 10) then (ect..)
Offline
1) Once a variable contains a value, can that value be changed?
Yes.
2) Can a variable contain a number, then later in the program, contain words, and if so could that be a bad thing?
Yes, and then no.
3) If there are two loops, the outer executes 5 times, the inner executes 3 times. Inside the inner loop, there is a block of code that makes a sprite say "text". How many times will the sprite say, text'?
15.
4) You have a program that has an if/else structure, and two variables, X and Y. The only time you want the alternative block(s) to execute is when both variables equal 10. What Boolean expression could you use for this situation?
X=10 and Y=10.
Hope I helped!
Offline
RedRocker227 wrote:
1) Once a variable contains a value, can that value be changed?
Yes.
2) Can a variable contain a number, then later in the program, contain words, and if so could that be a bad thing?
Yes, and then no.
3) If there are two loops, the outer executes 5 times, the inner executes 3 times. Inside the inner loop, there is a block of code that makes a sprite say "text". How many times will the sprite say, text'?
15.
4) You have a program that has an if/else structure, and two variables, X and Y. The only time you want the alternative block(s) to execute is when both variables equal 10. What Boolean expression could you use for this situation?
X=10 and Y=10.
Hope I helped!![]()
Offline
Sounds like homework questions to me! hahaha
also, the 4th question asks that the ALTERNATIVE block executes when both variables equal 10 - so your condition could be one of these two possibilities...
1. not (x = 10) or not (y = 10)
2. not ( x=10 and y=10 )
this interchangability between negated and/or conditions is called Demorgan's Law
Last edited by Ratty1967UK (2011-11-21 16:31:50)
Offline
Ratty1967UK wrote:
Sounds like homework questions to me! hahaha
![]()
also, the 4th question asks that the ALTERNATIVE block executes when both variables equal 10 - so your condition could be one of these two possibilities...
1. not (x = 10) or not (y = 10)
2. not ( x=10 and y=10 )
this interchangability between negated and/or conditions is called Demorgan's Law
Oh yeah, I didn't realise that it said ALTERNATIVE blocks execute. That's what happens when you only skim the question though I guess
Offline
TRocket wrote:
1) yes it can be changed
2) yes
3)15 times
4)[blocks] << <( <{ X }> <=>10 )> <and> <( <{ Y }> <=>10 )> >>[/blocks]
-THANKS THIS HELPS A LOT-
Offline
DigiTechs wrote:
TRocket wrote:
1) yes it can be changed
2) yes
3)15 times
4)[blocks] << <( <{ X }> <=>10 )> <and> <( <{ Y }> <=>10 )> >>[/blocks]Here's a clearer version of 4);
If (X = 10) and (Y = 10) then (ect..)
-THANKS THIS HELPS A LOT-
Offline
RedRocker227 wrote:
1) Once a variable contains a value, can that value be changed?
Yes.
2) Can a variable contain a number, then later in the program, contain words, and if so could that be a bad thing?
Yes, and then no.
3) If there are two loops, the outer executes 5 times, the inner executes 3 times. Inside the inner loop, there is a block of code that makes a sprite say "text". How many times will the sprite say, text'?
15.
4) You have a program that has an if/else structure, and two variables, X and Y. The only time you want the alternative block(s) to execute is when both variables equal 10. What Boolean expression could you use for this situation?
X=10 and Y=10.
Hope I helped!![]()
-THANKS THIS HELPS A LOT-
Offline
Ratty1967UK wrote:
Sounds like homework questions to me! hahaha
![]()
also, the 4th question asks that the ALTERNATIVE block executes when both variables equal 10 - so your condition could be one of these two possibilities...
1. not (x = 10) or not (y = 10)
2. not ( x=10 and y=10 )
this interchangability between negated and/or conditions is called Demorgan's Law
-THANKS THIS HELPS A LOT-
Offline
you're welcome - glad I could help
Offline