2.2 - Problem solving and programming Flashcards
What Is an IDE? Explain.
Intergrated development environment.
Software enables you to enter/edit/interpret + run your programs.
What are the 3 things a debugging facility can do?
IDE
- Set a breakpoint in a program; causes program to stop on that line.
- Set a watch on a variable so that its value is displayed each time it changes.
- Step through a program one line at a time.
Why do you use a debugging facility?
IDE
Helps you find logic errors in a program.
What 4 features of an IDE make coding quicker & easier?
- Adding line numbers.
- Automatically indenting code.
- Auto-completing commands.
- Commenting/uncommenting a region.
What happens when you interpret or compile a program?
Syntax errors will be reported.
Why is your program still not running after correcting the syntax errors?
They may be logic errors.
Define an algorithm
A sequence of instructions that can be follwed to solve a problem.
What are the 3 components of an algorithm?
- Input.
- Process.
- Output.
What are the 4 characteristics of Pseudocode?
- Writes intructions in statements that are between English + programing languages.
- They are guidelines but no strict rules.
- Aid thinking out steps needed before starting to code.
- Makes coding easier.
What is = used for?
(Pseudocode)
To assign
What is + - * / ** (exponentiation) used for?
(Pseudocode)
Used for common arithmetic.
What is an identifier?
A name that points to a memory location.
What is an assignment?
Assiging a value to the memory location
e.g.
Start
score = 0
score = score + 1
End
What is a statement?
A single instruction
Programs have a series of instructions.
What are the 3 advantages of pseudocode?
- Don’t need to follow a specific structure or syntax of a language.
- Easy to understand.
- It is easy and quick to convert to a programming language.
What is a programming construct?
It controls how statements in a program are executed.
What are 3 constructs?
- Sequence
- Selection
- Iteration
What is a variables?
It is a named container to store values which can change at any point during the program. It is held by the computer in a memory location.
What is a input()?
Used to set data into the computer program.
It is an inbuilt function.
What is a sequence?
- line of code, one after the other.
- Group of statements executed once in the order they appear.
What is int?
Integer
What is str?
String.
What is Char?
Character
How does Selection work?
Programs have sets of instructions that are carried out one after another. Sometimes more than 1 path to follow. So a decision needs to be made -> this is the selection.
What happens in an if statement?
- If this happens do this.
- (programming syntax)
- If statements always end in a colon :
When are IF & ElSE used?
when the answer to the question is false.
What are the 3 features of a constant?
- You cannot assaign to a constant.
- It reduces the risk of error.
- Constant value has to be changed in the source code + recompiled.
What is ELIF?
Allows you to have 3+ option/choices.
Selection allows more than one path.
ELIF = ELSE IF
What is Mod?
It is an operator used to find the remainder of an integer.
e.g. x = 17 mod 3, x = 2
What is div?
It returns the integer part after a calulation.
What is a subroutine?
A set of instructions with a name?
How does a subroutine work?
- program execution starts at the first statement.
- Program flow will ‘Jump’ to the subroutine called.
- When subroutine has finished, the program will continue from where it was called.
What is a function?
A subroutine that must always return 1 values.
(Can do this in a return statement).
What is a procedure?
A subroutine that doesn’t have to return a value but can return multiple.
What happens when a variable is in scope?
Values can be accessed.