Mid term project Flashcards
By the end of this unit, you will be able to create flowcharts to design, plan, and write pseudocode for your programs. Understand the concepts of encryption, decryption, and a letter shift algorithm.
When writing larger programs, it is often useful to _______ and ________.
When writing larger programs it is often useful to break down the task into manageable pieces and make a plan before you even start to write code.
Two particular useful tools that programmers will use in this planning process are writing _____ and constructing a _______.
Two particular useful tools that programmers will use in this planning process are writing pseudocode and constructing a flowchart. Planning things out in advance with a lot of pseudocode or a flowchart for simple programs may not be necessary. However, with more complex programs, spending some time planning in advance of writing actual code can save you a lot of time as it helps you break down a large program that could be hard to grasp the entirety of into several smaller pieces that are much easier to code.
What is pseudocode?
Pseudocode is just a description with normal words of the various steps that go into an algorithm or your program.
Write a pseudocode based on this instruction.
Let’s imagine that we were going to write a program to help a user add numbers together until they tell us to stop.
We might write:
Ask the user if they would like to add more numbers
If yes:
Ask them for the next number
Add that number to the running total
Go back to ask the user if they would like to add more numbers
If no:
Print out the sum
What are flowcharts and how does it help when writing code?
Flowcharts can also be useful for planning and representing how a program will work, though they are visual. To help people understand what everything in our flowcharts means at a glance, there are a number of specific meanings behind different symbols.
What are the different symbols that are used in flowcharts to plan for how you will code a program?
Rectangle but will curve sides on the left and right—> Meaning: this is the start or end of your program (a “ terminal point”).
Rectangle—> Meaning: this represents a process or action (something that changes values).
Triangle at the top + a triangle at the bottom combined to form a shape—> Meaning: this is a decision point where we do different things based on a condition.
Rhombus—> Meaning: This indicates a place where we get put input or provide output.
——> (This arrow indicates the direction in which the program runs.)
What is encryption?
Encryption is the process of translating plain text data (plaintext) into something that appears to be random and meaningless (cipher text).
What is decryption?
Decryption is the process of converting cipher text back to plaintext.
Why do we need to use decryption and encryption?
These methods are used to transfer data securely.
Did Julius Caesar use data encryption?
Yes. Julius Caesar (100-44 BC) used a simple substitution with the normal alphabet in his government communications. This cipher was not very strong, but in a time when few people read in the first place, it was good enough. He also used transliteration of Latin into Greek letters and a number of other simple ciphers. When Julius Caesar sent messages to his trusted acquaintances, he didn’t trust the messengers. So, he replaced every A with a D, every B with an E, and so on through the alphabet. Only someone who knew the “shift by 3” rule could decipher his messages.
Data encryption has been widely used throughout history and in present day, so this is a very useful skill to know. Is this statement true or false?
True
What does ASCII stand for and what does it mean?
ASCII stands for American Standard Code for Information Interchange, and is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices. Mode modern character-encoding schemes are based on ASCII, although they support many additional characters. In ASCII, each character has a corresponding integer number.
In python, how can you switch between a character and its ASCII value?
In python, you can switch between a character and its ACSII value using the functions ord() and chr(). For example:
print(ord(‘a’))
Output:
97
print(chr(97))
Output: a
Consider the following code:
print(ord(‘5’) - ord(‘0’))
Output: 5
This evaluates to 53-48