Coding 1 Semester Exam Study Guide

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/111

flashcard set

Earn XP

Description and Tags

Jake P

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

112 Terms

1
New cards

What 4 commands does Karel know?

move(); turnLeft(); putBall(); takeBall();

2
New cards

Dissect a Karel command.

-No spaces in commands -Need to match exact capitalization - Every command ends in ();

3
New cards

What is a street in Karel's world?

A street is a row in Karel's world

4
New cards

What is an avenue in a Karel world?

An avenue is a column in Karel's world

5
New cards

How can we make Karel turn right, even though Karel doesn't know a turn right command?

We can create a turnRight function and have Karel turn left three times

6
New cards

Why are functions useful?

They allow programmers to reuse repeatable code, and help make code more readable and efficient

7
New cards

Why should the name of the function describe WHAT the function does?

Programs are written in code not just for computers to read but for other people, too!

8
New cards

The name of the function should sound like a command and start with an …

Action verb

9
New cards

How do you write a multi-line comment?

/ *

10
New cards

*

11
New cards
  • /
12
New cards

How do you write a single-line comment?

//

13
New cards

What are preconditions?

What assumptions we make and what must be true BEFORE the function is called

14
New cards

What are postconditions?

What should be true AFTER the function is called

15
New cards

What is the difference between Karel and Super Karel?

turnRight(); and turnAround(); are already defined in super Karel

16
New cards

Explain For Loops.

For Loops let us repeat a section of code a fixed number of times

17
New cards

What is a condition?

A condition is a function that returns a true/false answer

18
New cards

Why do we use if statements in JavaScript?

To do something only if a condition is true

19
New cards

What is the difference between if statements and if/else statements?

With the if statement, a program will execute the true code or do nothing. With the if/else statement, the program will execute either the true code block or the false code block so something is always executed with an if/else statement

20
New cards

What does an if/else statement look like in JavaScript?

if (condition) {

21
New cards

// code

22
New cards

} else {

23
New cards

// code

24
New cards

}

25
New cards

What does the command console.log do?

JavaScript function that prints out a line to the user

26
New cards

Explain what variables are and what they are used for.

Variable means anything that can vary. It stores the data value that can be changed later on

27
New cards

What are the three functions that we can use to get user input?

readLine

28
New cards

readInt

29
New cards

readFloat

30
New cards

Describe the different mathematical operators we can use in programs.

Addition +

31
New cards

Subtraction -

32
New cards

Multiplication *

33
New cards

Division /

34
New cards

Exponentiation **

35
New cards

Modulus %(divide and take the remainder)

36
New cards

What is the drivers role AND the navigator's role when pair programming?

The driver's role is to control the computer and focus on the task at hand. The navigator's role is to review the code and think of strategic alternatives

37
New cards

Explain why random numbers are a useful part of computer programs.

To make our programs more interesting

38
New cards

What are the three steps to add objects?

  1. Create the object
39
New cards
  1. Customize the object
40
New cards
  1. Add the object to the canvas
41
New cards

What happens when you set debug mode to true?

The program lets you see a red frame around the shape of the object and a bold red point at the anchor point

42
New cards

What can you add to the canvas besides shapes?

  1. Images
43
New cards
  1. Text
44
New cards
  1. Lines
45
New cards

Where should you put a URL for an image?

You should store it inside of a constant (const)

46
New cards

Explain the purpose of getWidth() & getHeight().

They return the width & the height of the canvas

47
New cards

To position a circle at the center of the canvas what should the circle's x AND y coordinates be set to?

getWidth()/2, getHeight()/2

48
New cards

What are booleans?

Refers to a value that is either true or false

49
New cards

Who are Booleans named after?

George Boole

50
New cards

(mathematician, philosopher, logician, one of the founders of computer science)

51
New cards

Describe the meaning and usage of the OR Operator (||).

OR (||): The operator which would return the value TRUE or Boolean value of 1 if either or both of the operands are TRUE or have a Boolean value of 1

52
New cards

Describe the meaning and usage of the AND Operator (&&).

AND (&&): The operator returns a value of TRUE if both its operands are TRUE, and FALSE otherwise

53
New cards

Describe the meaning and usage of the NOT Operator (!).

NOT (!): The operator reverses the logical value associated with the expression it operates

54
New cards

Explain the meaning of this comparison operator (<).

< Returns true if the value on the left is less than the value on the right, otherwise it returns false
55
New cards

Explain the meaning of this comparison operator (<=).

56
New cards

Explain the meaning of this comparison operator (>).

Returns true if the value on the left is greater than the value on the right, otherwise it returns false

57
New cards

Explain the meaning of this comparison operator (>=).

= Returns true if the value on the left is greater than or equal to the value on the right, otherwise it returns false

58
New cards

Explain the meaning of this comparison operator (==).

== Returns true if the value on the left is equal to the value on the right, otherwise it returns false

59
New cards

Explain the meaning of this comparison operator (!=).

!= Returns true if the value on the left is not equal to the value on the right, otherwise it returns false

60
New cards

Karel

A dog who listens to your commands.

61
New cards

World

A grid that Karel lives in.

62
New cards

lowerCamelCase

A naming convention where the first letter is lower case, and each subsequent start of a word is upper case.

63
New cards

Command

An instruction you can give to Karel.

64
New cards

Move();

Moves Karel one spot in the direction that he's facing.

65
New cards

turnLeft();

Rotates Karel 90 degrees to the left.

66
New cards

putBall();

Adds one ball in spot that Karel is at.

67
New cards

takeBall();

Removes one ball in the spot that Karel is at.

68
New cards

Walls

All of the edges in Karel's world; barriers that Karel is at.

69
New cards

Functions

A way to teach Karel a new command.

70
New cards

Define a Function

To teach the computer a new command and explain what it should do when receiving that command.

71
New cards

Call a Function

Actually giving the command, so the computer will run the code for that function

72
New cards

Main function

This is the function that is called when you click run.

73
New cards

Top Down Design

A method for breaking our program down into smaller parts.

74
New cards

Decomposition

Breaking your program into smaller parts.

75
New cards

Read Like a Story

Programs that have good decomposition and make the code easy to follow.

76
New cards

Programming Style

The way your code is written is the style. It covers the aspects of the code that goes beyond whether or not it just works.

77
New cards

Comment

A message in your code that explains what is going on.

78
New cards

API

A set of words for building software.

79
New cards

Super Karel

Like Karel but already knows how to turnRight() and turnAround().

80
New cards

For Loop

Let us repeat code a fixed number of times.

81
New cards

Conditional

A function that returns a true or false answer.

82
New cards

If Statement

Lets you ask a question to the program and only run code if the answer is true.

83
New cards

If/Else Statement

Control structure that lets us do either one section of code or another depending on a test.

84
New cards

While Loop

Lets us repeat code as long as something is true.

85
New cards

Indentation

The visual structure of how your code is laid out. It uses tabs to organize code into a hierarchy.

86
New cards

Hello World

Traditionally the very first program you write when learning a programming language.

87
New cards

console.log

JavaScript function that prints out a line to the user.

88
New cards

Variable

A symbol or container that holds a value.

89
New cards

Declare a Variable

Defining a variable for the first time.

90
New cards

Intialize a Variable

Giving the variable on initial value.

91
New cards

Number Variable

Integers (positive or negative whole numbers) and Floats (numbers that have a decimal).

92
New cards

Boolean Variable

Has a variable that is either true or false.

93
New cards

String Variable

Stores text. String concatenation is combining strings in JavaScript

94
New cards

readLine

Allows for the reading of user input when a string is used.

95
New cards

readInt

Allows for the reading of user input when an integer is used.

96
New cards

readFloat

Allows for the reading of user input when a decimal number is used.

97
New cards

Modulus

Returns the remainder of a dividing two numbers (%).

98
New cards

Increment

Increase the value of a variable by 1.

99
New cards

Decrement

Decrease the value of a variable by 1.

100
New cards

Constant

In programming, a variable that's value can not be changed through reassignment.