Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 I have a question...
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
lei4848




PostPosted: Mon Jun 19, 2006 9:53 pm   Post subject: I have a question...

If an if statement containing many elsif parts and no else part

a) Only one of the conditions is allowed to be true; otherwise there is an error.
b) All the actions corresponding to true conditions are selected.
c) Only the first true condition (if any ) is selected.
d) At least one of the conditions is required to be true, otherwise there is a run-time error.
e) None of the above.
Sponsor
Sponsor
Sponsor
sponsor
TheOneTrueGod




PostPosted: Mon Jun 19, 2006 10:01 pm   Post subject: (No subject)

d)
Martin




PostPosted: Mon Jun 19, 2006 10:17 pm   Post subject: (No subject)

No.

The answer is c). Try it out and see

code:

var x := 2
var y := 2
if x = 0 then
  put x
elsif x = 1 then
  put x
elsif x = 2 then
  put x
elsif y = 2
 puts "This isn't called!"
end if
Bored




PostPosted: Tue Jun 20, 2006 7:57 am   Post subject: (No subject)

You shouldn't do peoples homework for them. This is obviously either a quiz question or homework question they don't know and are to lazy to check out.
TheOneTrueGod




PostPosted: Tue Jun 20, 2006 8:01 am   Post subject: (No subject)

lol, I know, thats why I gave him the wrong answer... Have more faith in my Turing knowledge Confused
Bored




PostPosted: Tue Jun 20, 2006 8:02 am   Post subject: (No subject)

I knew you did but it was Martin that was aimed at.
upthescale




PostPosted: Tue Jun 20, 2006 2:39 pm   Post subject: (No subject)

Martin wrote:
No.

The answer is c). Try it out and see

code:

 puts "This isn't called!"


Seems liek Martin is familiar with Ruby...
aldreneo




PostPosted: Wed Jun 21, 2006 12:42 pm   Post subject: (No subject)

Or perl...Or was that C

AHHH this is what happens when you lean 5 languages at once
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: