Please enable JavaScript to use CodeHS

Mocha Glossary

Flashcards

Course:

Module:

Search:

lowerCamelCase General

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

lowerCamelCase

World General

A "world" or "Karel World" is a grid that karel lives in.

karel World

Karel General

Karel is a dog who listens to your commands.

Karel

Command Java

A command is an instruction you can give to Karel.

Karel Documentation Java

Documentation for all Karel Commands and Syntax

Curly Bracket General

An open curly bracket is { and a close curly bracket is }

Curly Bracket

Parentheses General

( and )

Parentheses

Method Java

A method is a way to teach the computer a new command

Define a method Java

Defining a method means to teach the computer a new command and explain what it should do when receiving that command.

Calling a method Java

Calling a method actually gives the command, so the computer will run the code for that method.

Indentation General

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

Method body Java

The part of the method that contains the commands

Decomposition General

Decomposition is breaking your program into smaller parts.

Decomposition

Break Down (Decompose) Java

Breaking down (decomposing) your code is splitting it up into several smaller, simpler methods

Read Like a Story Java

Programs that “Read like a story” have good decomposition and make the code easy to follow.

Top Down Design Java

Top down design is a method for breaking a problem down into smaller parts.

Programming Style General

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.

Programming Style

Comment Java

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

Precondition Java

Assumptions we make about what must be true before a method is called.

Postcondition Java

What should be true after a method is called

SuperKarel General

SuperKarel is like Karel but already knows how to turnRight() and turnAround()

SuperKarel

Loop General

A loop is a way to repeat code in your program.

Loop

Control Structure General

A control structure lets us change the flow of the code.

Control Structure loops if statements

Increment General

To add to or increase

Increment

For Loop Java

A for loop lets us repeat code a **fixed number of times**.

Condition General

A condition is code that you put inside an if statement or while-loop.

Condition

If Statement General

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

If Statement

If Else Statement General

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

If Else Statement

While Loop General

Lets us repeat code as long as something is true.

While Loop

Fencepost Problem General

A problem when using a while loop where you forget one action at the beginning or the end.

Fencepost Problem

Pseudocode General

Pseudocode is a brief explanation of code in plain English.

Pseudocode

Edge Case General

An edge case is a problem in your code that only occurs in extreme situations.

Edge Case

Debugging General

Debugging is fixing a problem in your code.

Debugging

The run method Java

The run method is where a Java program begins.

Hello World General

Traditionally the very first program you write when learning a programming language, a program that prints "Hello world" to the user.

System.out.println Java

Java method that lets us print out a line of output to the user

System.out.print Java

Java method that lets us print output to the user, without ending the line printed.

Double Quotes General

The `"` character

Variable Java

A symbol or container that holds a value.

int Java

`int` is a Java type that represents an integer (a whole number)

String Java

String is a Java type that represents a string of characters (text)

char Java

`char` is a Java type that represents a single character (a single letter)

boolean Java

`boolean` is a Java type that can either be true or false

double Java

`double` is a Java type that represents a real number with decimal values

Declare a variable Java

Declaring a variable is defining it for the first time.

Initialize a variable Java

Initializing a variable is giving it an initial value, or a starting value.

Assigning to a variable Java

Assigning to a variable is updating the variable's value

Type Java

The type of a variable defines what kinds of values the variable can hold

Variable General

A symbol or container that holds a value.

variable

readLine Java

Java method that lets us read in a line of input from the user as a String

readInt Java

Java method that lets us read in an integer input from the user

readDouble Java

Java method that lets us read in a decimal value input from the user

readBoolean Java

Java method that lets us read in a true or false value input from the user

Scanner class Java

A class within java.util. It contains code specifically designed to help with user input.

Variables and Data Types General

Understanding how data is stored and manipulated in programs.

User Input General

Data provided by the user to a program via input commands.

Decrement General

To subtract from or decrease

decrement

Modulus operator General

The modulus operator (written as % in most programming languages) divides two numbers and returns the remainder.

Integer Division General

When two integers are divided, the decimal values are truncated, or chopped off.

integer overflow General

When a value higher than the maximum or lower than the minimum is used which can result in logic errors.

Arithmetic Expression General

A combination of numbers, operators, and sometimes variables that computes a value.

Round-Off Error General

The difference between the calculated approximation of a number and its exact mathematical value due to rounding.

Casting Java

Casting is turning something of one type into another type

Implicit Casting Java

When Java automatically casts the value correctly without the programmer needing to do so

Type Casting Java

The process of converting one data type into another.

Explicit Casting Java

Manually converting a larger data type to a smaller one using casting syntax.

Rounding Java

Reducing the number of decimal places in a number, sometimes involving casting.

Conditional Statement General

A statement that evaluates to true or false.

Negate General

To flip a boolean value, or take the opposite of a boolean value. If you negate true, you get false. If you negate false, you get true.

And operator Java

Logical operator that ANDs two boolean values. Written as `&&`. `a && b` will be true if both `a` and `b` are true.

Or operator Java

Logical operator that ORs two boolean values. Written as `||`. `a || b` will be true if `a` or `b` is true.

Not operator Java

Logical operator that negates a single boolean value. Written as `!`. `!a` will be true if `a` is false, and false if `a` is true.

Logical Operator Java

Used to make logical associations between boolean values.

Short Circuit Evaluation Java

When the result of a logical expression using && or || can be determined by evaluating only the first Boolean operand, the second is not evaluated.

Toggle General

To switch between two states, such as turning a light on and off

Compound Boolean Expression Java

A Boolean expression that combines two or more conditions using logical operators

Comparison operator General

Used to make comparisons between values.

comparison operator

Logical AND (`&&`) General

A logical operator that returns true if both conditions are true

Logical OR (`||`) JavaScript

A logical operator that returns true if at least one condition is true

Logical NOT (`!`) General

A logical operator that negates a Boolean value, turning true into false and vice versa

Conditional Statement General

A programming construct that executes code based on whether a condition is true or false

Iterate General

A single run through the instructions contained a loop

Iterate

Counter Java

A variable used to count the number of times an action has been performed.

DRY Principle Java

Otherwise known as Don’t Repeat Yourself, this principle is designed to help eliminate repeated code and reduce the complexity of a solution

Loop Control Variables Java

Variables used to control the execution of the loop, typically defining the start, end, and step of the loop

Infinite Loop General

A loop that has no way of stopping, and will keep looping forever.

Nested if Statements Java

The process of placing if statements within if statements.

String Comparison Java

The process of checking if two strings are equal using `.equals()` or `.equalsIgnoreCase()`

Object Java

An object is a single instance of a Java class. An object has both state and behavior.

Primitive Type Java

Primitive types are the basic, simple data types that are inherent to Java (int, double, char, and boolean)

Concatenation Java

Concatenation is another word for combining. Concatenating Strings is when we add Strings together.

.equals() method Java

A method used in Java to compare the contents of two Strings for equality

Loop-and-a-half Java

A loop, most often set with `while(true)`, that has a `break` statement in the loop body.

Short Circuit Evaluation General

A short cut when evaluating boolean expressions. If the result can be determined solely by the first part of a boolean expression, the second part is not evaluated, it is skipped.

De Morgan's Laws Java

Laws that define how we can negate an AND statement and how we can negate an OR statement

Sentinel Java

A constant that has the specific purpose of being the value that breaks out of a loop.

break statement Java

The `break;` statement breaks out of the current loop, without executing any more code in the loop.

Parameter Java

A variable that receives a value passed into a method from outside the method.

Return statement Java

The `return` statement exits a method and returns a value.

Return value Java

The value returned from a method.

Return type Java

A method's return type is the type of value returned from that method.

Method signature Java

A method's signature is the name of the method and the parameter list.

Call site Java

A method's call site is the point in the code where the method is called.

Class Java

A class is a template, or a blueprint, from which Java objects are created. All Java programs start with a class.

Substring Java

A substring is a smaller sequence of characters in a larger String.

Immutable Java

Unable to change. Strings in Java are immutable, meaning you can't change it once you make it. If you take a substring of a String, or concatenate something to a String, the result is a *brand new* String, rather than a modification of the original.

Escape Sequence General

Escape sequences are characters with special meanings.

Static method Java

A method called on the Class, rather than on a specific object of the Class.

Javadoc Java

A specific standard for commenting Java programs. Javadoc is a format to follow when commenting in order to clearly explain your code.

Exception Java

An exception is thrown by Java when a **runtime error** is encountered. The exception provides information about what kind of error occurred.

Java Documentation Java

Documentation showing the syntax and examples for how to use the various features of Java.

Bug General

A bug is a problem in your code.

Bug

Compile Time Error Java

An error in the actual Java code. The code will not **compile** into an executable program, because there are errors in the text of the code.

Compiler Java

A tool that compiles your Java code, it takes the Java code you've written and turns it into an executable program.

Runtime Error Java

An error that happens while the program is running. Even if the code is written with the proper syntax, there are things that can go wrong while the program is running.

Object Oriented Programming Java

Programming model that focuses on **objects** and the data and actions associated with the objects.

State Java

The state of an object is all of the object's associated data. It is the *state* that the object is in.

Behavior Java

The behavior of an object is what the object is able to do. It is the actions that can be performed by the object.

Instance Java

Instance is what you call a specific object constructed from a class. Instance and object generally refer to the same thing. An object is a specific instance of a class.

Client Java

When someone else creates a Class (like `String`, or `Randomizer`), and you are using the functionality of that Class in your program, your program is a *client* of the class. You are using the class as a client.

Instance Variable Java

A variable defined in a Class, for which each object of the class has its own copy.

Constructor Java

A constructor is a special method of a Class that constructs a new object (a new instance) of the Class and sets the initial values for the instance variables.

toString Java

toString is a special method you write in your class that returns a String representation of the object.

Instance Method Java

An instance method is a method that defines the behavior of an object. It defines an action that the object can perform.

Visibility Java

Visibility (usually `public` or `private`) defines who has access to something (usually a variable or method). Public means code outside of the class can access, private means only code inside the class can access.

Static variable Java

A variable or attribute of a class that is shared between **all** instance of a class. Each instance **does not** get their own copy.

Package Java

Related classes are grouped together into packages.

this Java

The `this` keyword is a reference to the current object (the current instance).

Class Hierarchy Java

Class hierarchy refers to the arrangement of classes and how they relate to each other.

Inheritance Java

When a subclass extends a superclass, the subclass inherits all of the static methods, static variables, and public instance methods of the superclass. This is called inheritance.

Abstract Class Java

A class, usually at the top of a Class Hierarchy, that cannot be instantiated, because not all of its methods are defined.

Abstract method Java

A method, written in an Abstract Class, that is not defined. The word `abstract` must come right before the method's return type. It is up to the subclass to fill in the definition for the abstract method.

Method Overriding Java

If a subclass defines a new method body for a method defined in the superclass, then the subclass has **overridden** the method of the superclass.

Interface Java

An interface provides a list of methods that *must* be defined if a class chooses to implement the interface.

Comparable Interface Java

The Comparable Interface is a standard interface in Java that mandates that all classes implementing the Comparable interface must define a method called `int compareTo(Object o)` that returns a positive int if the parameter `o` passed in is *less than* the current instance, returns 0 if it is equal, and a negative int if it is greater.

Polymorphism Java

Polymorphism is the capability of a method to do different things depending on which object it is acting upon.

Dynamic Binding Java

Also called late binding, this refers to Java choosing the proper method to call at run time, as opposed to at compile time.

Subclass Java

If a class A extends the class B, then A is a subclass of B.

Superclass Java

If a class A extends the class B, then B is the superclass of A.

super Java

The `super` keyword lets us reference the superclass when writing code inside of a subclass.

Scope General

In what part of the program the variable exits

Scope

Local variable General

A variable that is restricted to use in a certain scope of a program

Local variable

Getter Method Java

An instance method that allows the client to **get** the value of an instance variable on an object.

Setter Method Java

An instance method that allows the client to **set** the value of an instance variable on an object.

Method Overloading Java

Classes can have multiple methods with the same name, as long as the parameters to those methods are different. Doing this is called "overloading" a method.

Variable Shadowing General

If two variables have the same name, and exist inside of the same scope, the variable with the *more specific* scope takes precedence. This is called shadowing. Local variables and parameters shadow the more general global variables (instance variables).

Pointer Java

When an object is assigned to a variable, the variable doesn't hold all of the object's data, it only holds a *pointer* to the object's data. The variable holds a memory location (think of it as a pointer to that memory location), and the object data is stored at that memory location.

Null Pointer Java

Before an object variable is initialized, it doesn't point to any memory. It holds a **null pointer**.

Integer and Double Classes Java

These classes are part of the java.lang package and Object class and have a number of useful methods.

Integer(int value) and Double(double value) Java

Constructs a new Integer object or a new Double Object that represents the specified int or double value

Integer.MIN_VALUE and Integer.MAX_VALUE Java

The minimum/maximum value represented by an int or Integer, which are -2147483648 and 2147483647

int intValue() and double doubleValue() Java

Returns the value of this Integer as an int and this Double as a double

Autoboxing Java

Automatic conversion between primitive types and their corresponding object wrapper classes

Unboxing Java

Reverse of autoboxing; automatic conversion from the wrapper class to the primitive type

Object Superclass Java

The Object class is the superclass of all other classes in Java.

Data Structure Java

A particular way of organizing data in our programs.

Array Java

A data structure that stores a **fixed** number of elements, all of the same type, one after another like a list.

Array Index Java

The position of an element in an array. The first element is at index 0, the second element is at index 1, and so on.

Indexing into an array Java

Getting a value at a particular index in an array.

Array length Java

The number of elements an array can hold. You can get the length of an array `arr` by typing `arr.length`

2D Array Java

A 2D Array is an array of arrays, used to represent tables, grids, and matrices.

Row-major Order Java

The ordering of 2D arrays is row-major order, meaning the first index is the row, and the second index is the col. `arr[2][0]` would access the element on the third row and first column.

Nested For Loop Java

A for loop written, or “nested”, inside of another for loop. For example:

For Each Loop Java

A for loop that is written differently so that it loops through each element in a data structure, as opposed to having a loop counter variable that goes from 0 to length-1.

HashMap Java

A data structure that stores key -> value mappings.

Key Java

A key is the value used to look something up in a HashMap

Value (HashMap value) Java

The value is the result you get when you look up a key in a HashMap. It is the value paired with a key.

Iterating over an array Java

Looping through all of the elements of an array

ArrayList Java

ArrayList is a Java class that is like an Array with extra powers. It can automatically resize and comes with other helpful methods.

List Interface Java

A Java Interface that represents a general List. The interface provides a list of methods that classes should implement if they want to be used as a List.

Number System General

A number system defines how we represent numbers. It defines which digits we can use, and what value each position (place value) in a number has.

Binary General

The binary number system is the Base 2 Number System. It is a number system that only uses 2 digits (0 and 1).

Number Base General

The number base of a number system defines how many digits are in the number system, and the base of the exponent for each place value in a number.

Decimal General

The decimal number system is the Base 10 number system. It is a number system that only uses 10 digits (0 through 9).

Octal General

The octal number system is the Base 8 number system. It is a number system that only uses 8 digits (0 through 7).

Hexadecimal General

The hexadecimal number system is the Base 16 number system. It is a number system that only uses 16 digits (0 1 2 3 4 5 6 7 8 9 A B C D E F)

Bit General

Bit means "binary digit". A bit is a single digit in a binary number. A bit can either be 0 or 1.

Byte General

A byte is 8 bits.

Kilobyte General

A kilobyte (kB) is 2^10 bytes (1024 bytes) of binary data.

Megabyte General

A megabyte (MB) is 2^20 bytes (1024 kB) of binary data.

Gigabyte General

A gigabyte (GB) is 2^30 bytes (1024 MB) of binary data.

Network Protocols Java

Protocols for data sharing on the internet that define rules and conventions for communication between network devices.

Data Privacy Java

The appropriate use of data based on circumstances

Data Security Java

The integrity, confidentiality, and availability of data

Enhanced For Loop Java

A loop that is an alternate to a for or while loop that accesses each value in an array starting at the first value and proceeding in order.

Enhanced For Loop Variable Java

Variable created in the enhanced for loop header that contains a copy of the array variable.

Row Major Order Java

The process of traversing a 2D array by accessing all elements in a row before moving on to the next row.

Column Major Order Java

The process of traversing a 2D array by accessing all values at the first column in every row, before moving to the next column

Algorithm General

An algorithm is a set of steps or rules to follow to solve a particular problem.

algorithm, process

Big-Oh Notation General

Notation that describes how complex an algorithm is. A larger number inside of the Big-Oh notation means the algorithm takes longer to complete, a smaller number means the algorithm takes less time to complete.

Linear Search General

Also called sequential search, a search algorithm that searches for a given value in a list of values. Linear search is less efficient than binary search.

Sort General

To arrange a list of values in order from least to greatest (or greatest to least).

Selection Sort General

Sorting algorithm that takes an array of values and sorts it. The idea is to have a sorted part of the list and an unsorted part. On each iteration, selection sort finds the lowest value in the unsorted section of the list and adds it to the end of the sorted part.

Insertion Sort General

Sorting algorithm that sorts an array of values. The idea behind insertion sort is to have a sorted part of the list and an unsorted part. On each iteration of the algorithm, we grab the next unsorted element and place it in its proper position in the sorted section.

Recursion General

At a high level, recursion is when a function (or method) calls itself.

Divide and Conquer General

A problem solving approach where you **divide** the problem into several smaller sub-problems of similar form, and keep doing so until the problems are trivially simple to solve (**conquer**)

Mergesort General

A recursive sorting algorithm that sorts an array of values more efficiently than Selection Sort and Insertion Sort using a Divide and Conquer approach.

Base Case General

The base case is the simplest form of the recursive problem. The base case can be immediately solved without breaking the problem down any further.

Recursive Case General

The recursive case is the general form of the recursive problem. In this case the problem needs to be broken down by one step toward the base case, and the algorithm makes a recursive call to itself to solve this slightly smaller problem. This process repeats until the base case is reached.

Infinite Recursion General

Infinite recursion occurs when the base case can never be reached.

Binary Search General

Search algorithm that only works on a sorted list. It discards half of the list on each iteration, getting to the solution much faster than Linear Search.

Algorithm Java

Step-by-step process that solves a problem.

Statement execution count Java

The number of times a statement is executed by the program.

Processing Time General

The amount of time a computer spends processing program instructions.

Efficiency General

The ability to achieve an end goal with little to no waste.

Constant Java

A constant is a variable you define at the top of the program that doesn’t change. The reason to define constants is to store named variables that have relevant values for the program.

Accessor Method Java

A method that enables user to obtain information about an object’s instance and static variables.

Mutator Method Java

A method that enables user to change the value of an object’s instance and static variables.

null Java

A keyword that indicates a reference object doesn’t point to any object data.

GUI (graphical user interface) General

A type of interface that uses interactive graphical elements such as windows, buttons, and icons.

Black box programming General

when programs are used and tested without the user necessarily understanding how each part of the program is working, but are able to understand what the final output or product will be.

Subclass Java

A child class that inherits attributes and behaviors from a superclass (parent).

Polymorphism Java

An object can take on different forms depending on its implementation. Java can call the correct method even when an object is disguised as a more generic reference type

Steganography General

The art and science of concealing secret messages in such a way that no one apart from the intended recipient knows about the existence of the message. In digital information, Steganography is the practice of concealing a file, message, image, or video within another file, message, image, or video.

RGB Color Encoding General

The RGB encoding scheme allows us to encode colors as numeric data. It defines the amount of Red, Green, and Blue light in a pixel. Each color channel can have a value between 0 and 255.

Method Java

Procedures that allow us to control and define the behavior of an object.

ArrayLists Java

A mutable list of object references. We can create ArrayLists by using the constructor new ArrayList<E>().

Pixel General

Images are made up of pixels, which are essentially a grid of values. Each value, or pixel, encodes the color at that position in the image.

Encode General

The process of converting information or data into a specific format that can be understood or processed by a computer.