Week 0 - Scratch Flashcards
What is meant by a unary numbering system for couting?
- The unary numeral system is the simplest numeral system to represent natural numbers.
- To represent a number N, an arbitrarily chosen symbol representing 1 is repeated N times. For example, using the symbol | (a tally mark), the number 6 is represented as ||||||1. (Its like counting on your hands)
What is a binary numbering system and how does it relate to computers?
- Computers today count using a system called binary.
- It’s from the term binary digit that we get a familiar term called bit. A bit is a zero or one.
- Computers only speak in terms of zeros and ones. Zeros represent off. Ones represent on.
- Computers are millions, and perhaps billions, of transistors that are being turned on and off.
- If you imagine using a light bulb, a single bulb can only count from zero to one.
How many bits are in a byte?
8.Computers generally use eight bits to represent a number. For example, 00000101 is the number 5 in binary.
The reason for having 8 bits in a byte is just something that was decided on and became standard. 8 bits just seem good enough.
What is ASCII and why was it created?
- ASCII stands for American Standard Code for Information Interchange
- Just as numbers are binary patterns of ones and zeros, letters are represented using ones and zeros too!
- Since there is an overlap between the ones and zeros that represent numbers and letters, the ASCII standard was created to map specific letters to specific numbers.
- For example, the letter A was decided to map to the number 65.
- ASCII is a character encoding standard that uses a unique numerical value to represent each character. The original ASCII standard used 7 bits to represent each character, which allowed for a total of 128 unique characters. However, the ASCII standard has since been extended to use 8 bits to represent each character, which allows for a total of 256 unique characters 34.
In summary, ASCII can be represented using either 7 or 8 bits, depending on the version of the standard being used.
What is unicode and utf-8? How does it relate to emojis?
- UTF stands for Unicode Transformation Format. It is a variable-length character encoding standard used for electronic communication.
- UTF-8 Unicode Transformation Format – 8-bit) is the World Wide Web’s most common character encoding. Each character is represented by one to four bytes. UTF-8 is backward-compatible with ASCII and can represent any standard Unicode character.
- The first 128 UTF-8 characters precisely match the first 128 ASCII characters (numbered 0-127), meaning that existing ASCII text is already valid UTF-8. All other characters use two to four bytes. Each byte has some bits reserved for encoding purposes. Since non-ASCII characters require more than one byte for storage, they run the risk of being corrupted if the bytes are separated and not recombined.
- UTF-8 is one of the types of Unicode character encodings. It is capable of encoding all 1,112,064 valid character code points in Unicode using one to four one-byte (8-bit) code units.
- Since there were not enough digits in binary to represent all the various characters that could be represented by humans, the Unicode standard expanded the number of bits that can be transmitted and understood by computer
- Computer scientists faced a challenge when wanting to assign various skin tones to each emoji to allow the communication to be further personalized. In this case, the creators and contributors of emojis decided that the initial bits would be the structure of the emoji itself, followed by skin tone.
- More and more features are being added to the Unicode standard to represent further characters and emojis.
What is Big O notation?
- Big O notation is a mathematical notation that describes the efficiency of an algorithm in terms of time and space complexity.
- It tells you how long an algorithm takes to run or how much memory it uses as the input size grows.
- Big O notation can express the best, worst, and average-case scenarios of an algorithm.
- It is a useful tool for comparing different algorithms and choosing the most optimal one for a given problem
- A constant algorythm might be written as O(1) and a linear algorythm as O(n). A verry efficient algorythm would have a time complexity (big O) of O(log2n) - log base 2*
What is pseudocode?
Pseudocode is a human-readable version of your code.
What is a function in programming?
- Its a verb
- A function is a block of code that performs a task.
- It can be called and reused multiple times.
- You can pass information to a function and it can send information back.
- Many programming languages have built-in functions that you can access in their library, but you can also create your own functions.
What is a condition in programming?
- Satements like
if
orelse if
. - They typically make use of boolean statements. I.e. True/False or 1/0.
- In programming, a condition is the state of something in the program that’s true or false. For example, when looking at the condition of a computer variable, you can use a conditional statement to evaluate the condition of the variable.
- A conditional statement is a programming language command for handling decisions. Specifically, conditionals perform different computations or actions depending on whether a programmer-defined Boolean condition evaluates to true or false
What is a boolean expression?
- Expressions that can be stated as true or false, such as “It is raining.”
- A boolean expression is an expression used in programming languages that produces a Boolean value when evaluated.
What is a loop in programming?
- In computer programming, a loop is a sequence of instructions that are repeated until a certain condition is reached.
- Loops are control structures of a program and simplify the process of coding.
- There are two types of loops: entry controlled loops and exit controlled loops.
- An entry-controlled loop is a loop where the condition is tested before entering the loop body. A while loop is an example of an entry-controlled loop. e.g. While x = false, loop.
- An exit-controlled loop is a loop where the condition is tested after executing the loop body. A do-while loop is an example of an exit-controlled loop. This means the loop will start without testing a condition and test the condition after the first loop.
do { // code block to be executed } while (condition);
What does abstraction mean in programming?
- Abstraction is an essential skill and concept within computer programming. It is the act of simplifying a problem into smaller and smaller problems.
- For example, if you were hosting a huge dinner for your friends, the problem of having to cook the entire meal could be quite overwhelming! However, if you break down the task of cooking the meal into smaller and smaller tasks (or problems), the big task of creating this delicious meal might feel less challenging.
- If you are doing the same thing over and over again and you see yourself repeatedly coding the same statements, it’s likely the case that you could program more artfully – abstracting away this repetitive code.
- In programming its the act of simplifying code by moving repetative pieces into a function. The function may then be invoked using only its name instead of retyping all of the code in the function.
What is meany by passing arguments or parameters to a function?
- In programming, an argument is a value that is passed to a function or method when it is called.
- A parameter is a variable in a method definition. In other words, when you create your method you will define that it may require a parameter.
- When a method is called, the arguments are the data you pass into the method’s parameters. In other words, parameters are the placeholders for arguments that are passed to a function or method
How many bit combinations are in one byte and in four bytes?
A byte is a unit of digital information that most commonly consists of eight bits 1. Each bit can be either 0 or 1, which means that there are 2^8 = 256 possible combinations of bits in a byte 1.
Therefore, there are 256 possible combinations in a byte.
A byte is a unit of memory data equal to either seven or eight bits, depending on whether or not it needs error correction (parity) 1. Therefore, four bytes would be equal to 32 bits. The number of combinations in 32 bits is 2 raised to the power of 32, which is 4,294,967,296