1.8 Programming Q Flashcards
Purpose of computer program
Specific set of ordered instructions to be performed by a computer.
Program represents solution to a problem.
Execute 1 introduction at a time (in sequence)
Can be written in high level language c#
Can be written in low level machine code
How IDEs used to create computer programs
Program code created using code editor.
Code then translated into machine code.
Source code not be executed unless fully compiled.
IDEs provides programmers with facilities required to complete development from coding to testing.
IDE consist of..
IDEs consist of
Source code editor - can enter code
Compiler- program can run
Debugger- error correction as u enter code
GUI- intuitive interface
Solution explorer- view files associated w program.
Describe 2 examples of how IDEs help SW developers in the production of error free code
Debugging- can be used to detect and correct problems automatically if commands incorrect.
Syntax error assistance- as code entered
Code editor will place wavy line beneath code incorrect or cause problem.
What happens when an IDE debuts program
IDE works through the program in a systematic way
Finds code that is not producing accurate results.
Debugger used to detect and correct these issues.
Can set breakpoints where the program will stop during execution, allowing programmer to view results at that stage and examine code.
How breakpoints used in production of computer program
Programmer set point which code stop executing (otherwise run until end)
Allows results of processing to be examined at breakpoint.
If program does not run programmer can use breakpoints to find sections of source code do not contain errors by allowing them to run up to breakpoint.
Role of an interpreter during process of translation
Translates SC one line at a time.
Processor executes one line of code before moving into next.
No version of machine code is stored.
Role of compiler during translation
Convert whole program at once into machine code before executing it.
Syntax of each statement is checked.
If incorrect, compiler will generate list of errors.
Cannot be executed unless all syntax errors removed.
C+C role played by interpreters and compilers in translating source code
Similarities
BOTH are translating source code into machine code for computer to understand
BOTH will not execute code if contains syntax errors.
C+C role played by interpreters and compilers in translating source code.
Differences
INTERPRETER translates one line of code at a time.
COMPILER translates whole program at one time.
Execution time slower w INTERPRETER
COMPILER does not identify which line of code contains an error.
INTERPRETER does not run the line of code if there is an error.
What is an algorithm
Set of rules for a computer program.
Carried out in order.
Represent solution to a problem.
Can break down any problem into a series of ordered steps.
Role of syntax in creation of computer program
Set of rules that govern how statements should be structured.
Each programming language has own unique syntax.
Syntax errors are identified during process if translation.
Specifies how commands should be used to create statements.
Statements make up source code.
What is meant by count controlled loop
Variable is used to control number of times instruction carried out.
Variable known at “loop counter” to set an initial value of counter.
Each time loop executed, counter is incremented.
Sequence carried out SET NO. OF TIMES.
What is meant by iteration
Ability to repeat line of code many times.
Expressed through loops.
Iteration= each time a repeated instruction is carried out.
Objects
Instance of a class
Stores data about a person or thing.
Can perform actions and interact with other parts of program.
Methods
Section of code contained within a class.
Defines an action of an object that a class can perform.
A class can have several methods.
Methods only have access to data in their class.
Classes
Way of defining
Attributes that an object can possess
Methods that are used to manipulate their properties of an object.
Classes can have a sub class which inherits attributes from parent class.
Inheritance
Fundamental feature of OOP
a new class can inherit the attributes and behaviours of the existing class.
The new class is known as a sub class.
Existing class is known as parent class.
Sub class inherits attributes from parent class.
Sub class can have own attributes.
How methods, objects and inheritance can be used to create better SW.
Classes and methods can be reused in other programs and apps.
Objects can be extended to include other behaviours and attributes.
Reusing enables faster development and lower overall costs.
Encapsulation- once an object is created it can be used without knowledge of how it was implemented.
With inheritance the testing of a derived class can assume the base class is correct and can focus on additional attributes and behaviours.
What’s an integrated development environment
An application used to create SW.
Contains the poems tools developers need to write and test SW.
Source code editor features
Intellisense or autocompletion
Bracket matching
Syntax error assistance.
Data types
Int whole numbers
Double decimals.
Char single characters.
String test anything.
Date.
Time.
Boolean.
Variables
Place holders or storage boxes to store values in memory.
Each storage box given unique name.
Type of data permitted is assigned.
Variables allow program to store values that are required during the execution of the program.
Why a program might need to be translated
Computers operate in binary/ machine code.
Programming languages are designed to be understood by humans.
These include high level languages.
A program must be converted to binary before computer can execute it.
What is meant by condition controlled loop
Sequence of instructions executed/ repeated while a condition is true.
Condition tested at start of loop or until condition becomes true.
In which case condition tested at end of loop.