Lec 1 Flashcards
What is a computer
A computer is machine that can be programmed to carry out a wide variety of task
What is a program
A program or software is a set of instructions the computer follows to perform a task
What is a programmer
A programmer is someone trained to test computer programs
What is hardware
All the physical devices that make up a computer
-Note a computer is not a single device but a system of devices that work togther
What type of hardware makes makes up a computer and how you interact with them
Central Processing unit-Processes information, “the computers brain”
Main memory-RAM
Secondary Storage-disk, drive, ss, drives, usb, CDS, floppy disk(Physical memory)
Input devices-mouse, keyboards,microphones, webcame
Output devices monitor, printers, disk drives
Cell phone-listen to music through speakers
What can a computer do without software
A computer can’t do anything without software
How do computers store information digitally
Computer store information digitally into units of bits and bytes. Bytes are storage locations, where each byte can be stored.
What is a bit
A bit is a binary digit and 8 bits per bytes
-Switches on is 1 and switched off is 0
How to count in Binary
01101100
represent 115
bytes 1 is 2^15——–2^8
bytes 2 is 2^7——–2^0
What is the largest number that can be stored on one bytes
it is 255 because because add all the solutions of 2 ^x togather get you to 255
8516 is a decimal represented as
00100001 01000100
2^13–2^8–2^6—-2^2=8516
What is ASCII
The American standard code for information is a systems developed to represent text information
How does ASCII work
Each letter is case sensitive, and is assigned a decimal value and that gets converted and stored as binary values that the computer can undertsand and work with
Example
Binary-01000001
Decimal 65
Character is A
Binary-01100001
Decimal 95
Charavter a
How do program work
Computer store information i binary and the the central processing unit can only understands in 1 and 0’s called machine language
Example machine language input is 100110000 may tell computer to move values from storage to memory
What cpu can and can’t do
CPU’s can only perform simple task(add, subtract, divide, move from memory to storage, store, compare and programs in machine language are thosand of lines long ,so you need assembley language
What is assembly language
It was written in response to CPU only doing simple task but we have long lines of code.
Assembly language is one of the oldest programming languages. It is characterized by add, mul, mov
What does assembly language do
An assembler will translate assembly language into machine language, so the computer can execute the program .Assembly is low level language because it is extremely simple and close to machine language
Assembler language(add, mul, mov) to assembler to Machine language(binary)
What his high level language
High level language allows complex programs to be written without needing to know machine language-MatLab, CTT, CLT, JAVA, python,SQL
Each language has it own syntax
What is high level language syntax
They are rules that must be followed in order to write a program(like grammatical rules in language)Syntax indicates key words, operators, and punctuations can be used
Example:Like in Mat lab “NOT” is a wavey line but in CTT or Java… its !
What is an compiler
A compiler takes the entire program written in high level language, and translate it to machine language so the computer can understand it
-The language version of the program is executed in a separate step and the compiler give those machine language instructions to the CPU
-A program in compiler language will not work with errors of bugs
What are the two catagoies for high level language
Compiler or Interpreter language
What is an interpreter language
An interpreter take a high level program line by line and translates it into machine language so the computer can understand it
The interpreter is also executing the machine language program immediately(line by line as translated) and provides the machine language instructions to the CPU
An interpreter will run the program line by line until an error is found and then it will stop
How to design a program
A computer must be programmed to achieve a set of task. A programmers will typically use high level language. They never start code right way but create a design of the program.
Even though each program language has it own syntax- the logic and flow of information stays the same
Program development design
It is continuous refinement and maintenance process
1.Requirment analysis(User need)
2.Program Design stage(Map solution)
3.Implementation(Do)
4.Documentation and Testing(Write down who fixed or designed)
5.Operation and Maintenance(Revise solution and future maintenance)
WHAT stage of Program development design cycle is most important and why
Stage 1:the requriment anaysis stage serves a a solid foundation for the design of the program and consists of 2 major steps
1.Understand the task the program must perform(by collect information from user
2.Determine the logical sequences of steps that must be taken in order to perform the task by generated a algorithm and flowchart
What a programmer does
1.Work directly with client to agree program requirement were met
2.Porgrmmer will create algoritem-Set od well- defined logical steps requried to perfrom a task(Baking recipes)
Terminator – used to denote the start
and end of a flowchart/program
(Start)
Input/Output – used to denote any
instance where the program gets input
from the user or displays output to the user
/_Display____/
Process – used to denote any general
process or operation performed on the
data
[Solve] or [Calculate]
Module – used to denote any user-
defined subroutine or user-defined
function
[ Call|]
Decision – used to denote the start of a
decision structure or conditional
statement(Make a choice)
Diamond(arrow down, arrow true to the right out)
On-Page Connector – used to connect
between flowchart segments that are
located on the same page (A in a circles with down arrow on top)(A in a circles with down arrow at the bottom)
Off-Page Connector – used to connect
between flowchart segments that are
located on separate pages(upside-down pentagon with down arrow on top both pages) but slightly different
Arrow – used to denote the flow of
data in a program from one symbol to
the next(right arrow)
Algoritm for circufernces of a circle
1.Measure the diameter of a circle which is a line that goes from one side of the circle tot he other
2.Multiply by Pi
Generate flow chart for circumferences
Start-(______)
1.Get radius from user-/_Input____/
2.Set d=2* radius[}
3.Set c=d*pi-[]
4.Display answer to user /_Display____/
End
Make algorithm for 3x^2=-6x-9
1.Add -6x+9 to both sides
2.Solve for x using (a=3, b=6, c=9)
3.Solving/ Claculating is a process
4.Display answer to users
start-
rectangles-Add (6x+9)
Solve for x=-b
Solve for x^2+ib-
Display first root “x”
Display second root ^2
End
What is a variable is programming
A varibel is a a storage location inthe computer memory like radius =5 or x=2.7 or pi=3.1416
What does a program variable need
name
data type
values
What program variables have or don’t have
don’t have spaces
don’t have special characters except underscores
it can’t start with a number but a letter
What is data types
When creating a variable you must decide the type of information that can be stored and mismach variable values and data type leads to error
Integer-Whole numbers, no fractions or decimal values(3,-7)
Real or Float-Real numbers (fractions and decimals), floating-point(3.1416,36.4)
Char or charater-Text info, single characters, anything that can be entered on a keyboard like initial ‘A’
String-Text info, a sequence of characters(“bob”
Bool-Logical variable, can only hold the value TRUE
(1) or FALSE (0(is open=false)
What is the data type
3-integer
‘3’-char
3.0-float/real
“3.0”-String
What is the problem in
1Display “What is your favorite type of food?”
2Input favorite Food
3Display “The user’s favorite food is: “
4Display “favorite Food”
Its the space in favorite food in line 2
Its the “” in line 4
What is the differences between 3 and 3.0
they are different between 3 and 3.0 because they are represented differently in binary
3 is 00000011
while 3.0 is has an indicator at the beginning that the exponents are multiplied by
Step 1:Requriment Analsysis
break down larger problem into algorithmn-they are sequences of logical well-deifned steps that must be executed in order to accomplish the task
-must be communicated step by step
-algorithmns turn into flowcharts
-graphically repsent flow of infromation thru program help visualize the structure
Step 2 :Program design Stage
Teh alogirthm is step by step instrtcuion and the flow charts is a map showing the flow of information throughout your program
In stage 2 the programmer will use the flowchart to make a more dtailed blueprint of the program called peusudo code
What is Pseudocode
Pseudocode is an informal language that does not have syntax code.
- it is not executable
-it is used before the actual code is written
-they don’t worry about grammer, punication or speicifc deyails but design content, and form of program
It goes from pseudcode to highlevel language like python or matlab
Pseudo code what is your age
Declare Integer age
Display “What is your age?”
User Inputs age
Display “Your age is”,age
Pseudocode -Declare
You create a varibel and assign a data type
(Delcare Real num, date, temperature, name 1
Pseudocode -Display
“Prompt user”“Get from user” “show”
(Display “Todays date is”, date
Pseudocode -Input
STore into/ vlaue a variable
(Display “Please enter a number”)
(Input num)
Pseudocode -set
A.Initial vlaue of variable or assign a result of calc, fxn to a variable
Set counter=0
Set isFinished=Flase
Set
Pseudocode -call
call module
Write the pseudocode for area of a circle
Declare Real area
Declare Integer Radius
Display “Enter radius:”
Input( Radius^2)*3.1416
Display “Area is”, area
Wriete a