Karel Questions

07/11/2013 13:52

What is programming?

Is the process of writing programs with many code languages.

 

Who/What is Karel?

Karel is a dog that listens to your commands. Karel is also a programming language.

 

What is a command?

A command makes Karel do something in it's world.

 

What is a function?

Funtions allows to break down a program into smaller parts, and make the program easier to understand

 

What is the analogy we use to describe functions in Karel?

The analogy for functions in Karel is that we give Karel a brain

 

What is a bug?

A bug is mistake in your program and causes the program to crash.

 

What is top down design?

Top down design is breaking a big problem into a small problem and making the small problem into an even smaller problem.

 

How would you apply top down design to everyday activities?

Eating Lunch:

  • Get stuff
  • Prepare the ingredients
  • Make Lunch
  • Eat it

Why should you use comments?

It makes the code easy to read and easy to understand.

 

What is programming style?

It is that you have broken down the program in a reasonable way, and make the code easy to understand.

 

What can Super Karel do?

Super Karel can turn right and turn around.

 

What is a loop?

A loop allows you to repeat to repeat code.

 

What is a for loop?

A for loop allows you to repeat code for a fixed number of times.

 

When do we use a for loop?

We use for loops when you need to repeat something in a code for a certain amount of times.

 

What are examples of when you use if/else statements in your life?

If road is blocked: wait, else: cross.

 

What is a while loop?

A while loop allows you to repeat code while some condition is true.

 

How do we decide if we should use a while loop or a for loop?

You use a for loop if you want to repeat code for a fixed number of times, or you use a while loop when you want code to repeat infinite times while some condition is true.


What are different type of control structures, and how do know when to use each use?

  • If statement: You use this when you want to solve one problem.
  • If/Else statement: You use this when you have to solve multiple problems.
  • For Loop: You use this if you need to repeat code a fixed number of times.
  • While loop: You use this when you need to repeat code infinite times while some condition is true.

 

Why is indenting important?

To show proper structure.