# CS110 Algorithms 1 Study Guide

Programming Semantics
-in linguistics, the study of meanings
-in computer science, the term is used to differentiate the meaning of an instruction from its format
IPO (Input-Processing-Output)
a fundamental design of how a system or computer program works
Input
-whatever goes into the computer
input can take a variety of forms, from commands you enter from the keyboard to data from another computer or device
-a device that feeds data into a computer, such as a keyboard or mouse, is called an input device
-before a computer can operate on data, the data needs to be entered or inputted
Output
-anything that comes out of a computer
-output can be meaningful information or gibberish, and it can appear in a variety of forms — as binary numbers, as characters, as pictures, and as printed pages
-output devices include display screens, loudspeakers, and printers
-the result that is displayed after the input is processed
Processing
something is done with the input to calculate the output
Pseudo-Code
an outline of a program, written in a form that can easily be converted into real programming statements
Instruction
-a basic command
-often used to describe the most rudimentary programming commands
Variable
-symbol or name that stands for a value
-plays an important role in computer programming because they enable programmers to write flexible programs
-rather than entering data directly into a program, a programmer can use variables to represent the data
-then, when the the program is executed, the variables are replaced with real data
-this makes it possible for the same program to process different sets of data
-something that can store a piece of data
String Variable
computing data on which arithmetical operation will not perform; a variable that contains letters or numbers in which a numeric operation cannot be performed
Numeric Variable
-symbolic name of a data element whose value changes during the carrying out of a computer program; one that can hold digits, have math operations performed on it, and usually can hold a decimal point and a sign indicating positive (+) or negative (-)
Computer Program
-an organized list of instructions that, when executed, causes the computer to behave in a predetermined manner
-without programs, computers are useless
Initialize a Variable
to assign a starting value to a variable
Accumulate Values
values that increase in increments throughout a program
Logical Operators
-NOT, AND, OR
-an operator that uses logical data as operands to produce logical data as a result
Arithmetic Operators
-in formulas, symbols that perform mathematical calculations
-uses mathematical functions (+,-,*,/)
Condition
the entity that determines the action taken by the program each time it is run
What are the steps involved in using the computer as a problem solving tool?
1.) develop an algorithm and a flow chart
2.) write the program in a computer language
3.) enter the program into the computer
4.) test and fix the program as necessary
5.) run the program, input the data, and get the output from the computer
What are the five basic symbols used in a flow chart?
Start or stop: Rectangle with rounded edges
Computational or processing: Rectangle
Input or Output: Parallelogram
Decision: Diamond
Connector: Circle
What are the advantages of a high level programming language?
-high level programming languages are easier to read, easier to understand, easier to learn, easier to use
-syntax is the structure, while semantics are the meaning
-the syntax informs the semantics
Increment/Decrement a Variable
-increment: to add a fixed amount
–if you count consecutively from 1 to 10 you increment by one
–if you count by twos, you increment by two
-decrement: decrease variables by a specified number
Counter
variable whose value is the address where the next instruction of data element will be assembled into memory
Iterate
to execute (programs) a single pass through a set of instructions
loop
a piece of code that causes the program to ask a question repeatedly and carry out action repeatedly until the answer is such that the action is no longer required
Modulus Operator
works with numbers and yields the remainder when the first operand is divided by the second
Algorithm
-a formula or set of steps for solving a particular problem.
-set of rules must be unambiguous and have a clear stopping point
-can be expressed in any language, from natural languages to programming languages
-any well defined computational procedure that takes some value or set of values as input and produces some value or set of values as output
Computer Programming
writing, testing, and implementing code necessary to make certain functions happen on a computer
Programming Language
a vocabulary and set of grammatical rules for instructing a computer to perform specific tasks
Language
-as C, FOTRAN, or Pascal that enables a programmer to write programs that are more or less independent of a particular type of computer
-such languages are considered high-level because they are closer to human languages and further from machine languages
Low Level Programming Language
-a machine language or an assembly language
-low level languages are closer to the hardware than are high level programming languages, which are closer to human languages
Programming Syntax
-syntax refers to the spelling and grammar of a programming language
-computers are inflexible machines that understand what you type only if you type it in the exact form that the computer expects
-the expected form is called the syntax
-the format, which covers the spelling of language and components and the rules controlling how components are combined