COMPUTER NETWORKS AND COMMUNICATIONS
NETWORK SECURITY AND CYBERSECURITY
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
What’s wrong with this code?function start() { move(); go(); go();}function go() { move(); move();}function go() { move(); move();}
|
The go function is called twice
|
|
The go function has a syntax error
|
|
The go function has been defined twice
|
|
go is not a command that Karel understands
|
Explanation:
Detailed explanation-1: -As it turns out, there is a way for Karel to make right turns. Karel can “turn right” by turning left three times. Three lefts make a right!
Detailed explanation-2: -Calling turnAround() move(); move(); move(); turnAround(); move(); move(); move(); That’s all it takes to use our function.
Detailed explanation-3: -The mystery function takes as input a list and a value, and determines whether the value appears in the list.
Detailed explanation-4: -There can only be one start function. You have to have a start function. All of your code must be inside the start function or another function body. All function definitions must be outside of the start function.
There is 1 question to complete.