Flashcards
computing programming theory flashcards

Flashcards do conjunto (22)
- 1what is an algorithmA sequence of steps that can be followed to complete a specific task
- 2what are data typesa particular kind of data item, as defined by the values it can take, the programming language used, or the operations that can be performed on it.
- 3give some data type examples?all programming languages have built on elementary data types, the most common ones are:integer a whole number (23,0,3)
rela/float, a number with a fractional part(13.5, 68.5)
boolean can only take true or false
string anything enclosed in quotes - 4what is sequence?the principle of putting the correct instructions in the right order within a program.
- 5what is selection?the process that allows a computer to compare values and then decide what course of action to take.
"the principle of choosing what action to take based on certain criteria." - 6Explain the purpose of IF.. THEN… ELSE within a program. How can ELIF also be used?the flow of the program is controlled by evaluation of Boolean condition which evaluates to True or False. the conditions in a if/else statement specifies the circumstances in which the steps are to be executed.
- 7what is indefinite and definite iterationindefinite iteration: a process that repeats until a condition is met
definite iteration : a process that repeats a set number of times - 8how does a while loop work?as long as the condition is true the instruction inside a loop is ran ,it is not necessary for the instruction to be executed if the condition is not met.
- 9what is a repeat loop and how does it work?In a REPEAT..UNTIL loop the statements in the loop are executed before the condition is evaluated
the statement will always be executed at least once
in Python ther REPEAT..UNTIL loop is not supported.
- 10how does a for loop work?the for loop uses definite repetition
used a specified number of times
“i” is the variable to store the loop
“(15)” is the number of times to be repeated
the next line of code has to be indented
he structure of the range function is range(start, upto, step)
- 11what are text files and binary files?textfiles ”a file that contains human-readable characters”
binary files”stores data as a sequence of 0’s and 1’s” - 12what is a record and what is a field?record “one line of a text file”
filed “an item of data” - 13what is exception handlingusing exception handling statements, you can intercept and handle exceptions so that your program does not crash
- 14give examples of what exception handling can be used for to prevent?-tring to read a non existent file
-tring to convert a non numeric string entered by the user, to an integer or real -number(floating point number)
-trying to perform calculations with non-numeric value
-division by zero - 15what is a subroutine?“subroutines is a named block of code designed to carry out a specific task.”
it is also self contained and it carries out one or more related processes - 16what is a function?“function is a subroutine that returns one or more value”
program execution starts at the first statement in the main program.
program flow will “jump” to the subroutine when called - 17what are Built-in Function ?built in functions are included in programming languages which perform common tasks.
eg. sqrt,len,asc,chr,round - 18what are Libraries ?libraries are included in programming languages which have libraries of pre defined subroutines, however they have to be imported at the start of the program.
- 19what are Parameters ?parameter: identifies data being passed into a subroutine
a parameters works like a variable in that it identifies the data that you want a subroutine to take in and use.
parameters appear in subroutine definitions parameters are part of the subroutine definition - 20what are Arguments ?argument: an item of data being passed to a subroutine
the argument is the actual value being passed to the subroutine.
the argument may vary from call to call, arguments appear in subroutine calls - 21what is a local variable?The variable does not exist outside the subroutine.
The local variable only exists in the subroutine in which it is declared.
the variable is only available for use in the specified subroutines and functions - 22what is a global variable?variable used in the main program are global variables and can be used anywhere including the subroutines.
In python all variables are assumed to be local variables.
to make a variable global. the Keyword “Global” followed by the variable name.
Informações
- Descrição
- FlashCards sobre computing programming theory flashcards, criado por Adnan Abdullah em 23-01-2018.
- Criado por
- Adnan Abdullah · jan 2018
- Atualizado
- 4 jun 2018
- Visualizações
- 1
- Avaliação