Real World Programming - Functions

Ace your homework & exams now with Quizwiz!

How many times should the start function be called in a program?

0

How many times should the start function be defined in a program?

1

In the following code snippet, how many times is the turnRight function called and how many times is it defined? move(); turnLeft(); move(); turnRight(); turnRight(); move(); turnRight(); function turnRight() { turnLeft(); turnLeft(); turnLeft(); }

Called 3 times, defined 1 time

Why do we use functions in programming? A. Break down our program into smaller parts B. Avoid repeating code C. Make our program more readable D. All of the above

D

What is top down design?

Top down design is a way of designing your program by starting with the biggest problem and breaking it down into smaller and smaller pieces that are easier to solve.

Which function will teach Karel how to spin in a circle one time? - Hint: Use "function spin() {"

function spin() { turnLeft(); turnLeft(); turnLeft(); turnLeft(); }


Related study sets

Ch 5 Entrepreneurship and Starting a Small Business SmartBook...

View Set

chapter 7 decision making (management)

View Set

Unit VI Exam [Entropy and Free Energy]

View Set

Chapter 28: Head and Spine Injuries - Delilah

View Set