Section 1 Fundementals of programming Flashcards

1
Q

What is a integer ?

A

a whole number such as 1 5 7

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what is a real / float ?

A

a number with a fractionl part such as 3.142

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what is a boolean

A

a bolean variable can only take the value TRUE or FALSE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a character?

A

a letter on number or a special character typically represneted in ASCII

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a string?

A

anyhting enclosed in quote marks is a string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does the operator div do?

A

divides your integer telling you how many will fit into the number given without exceeding the limit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does the operator mod do?

A

this finds the remainder

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what is a sequence ?

A

two or more statemnets following one after the other

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what is selection?

A

statements that are used to select which statement will be executed next depending on some conditions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what are all of the relationl operators ?

A
> greater than 
< less than 
>= greater than or equal to
<= less than or equal to 
= equal
<> not equal
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is indefinite iteration?

A

this is where the iteration contiues until some specified condition is met ( this would use a WHILE loop)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what is definite iteration ?

A

this is where the number of times the loop is to be executed is decieded in advance ( this would use a FOR loop)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what is an array?

A

this is a finite , ordered set of elements of the same type of data ( such as intergers , real or char)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what is a 2 dimensional array?

A

this is when each varible in the array has more than one item assigned to it ( e.g. class_names = [[f_name, l_name][oskar, janyszko]]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

what is a subroutine?

A

this is a named block of code which performs a specific task within a program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

what are the two subroutines supported by most high-level languages ?

A

functions and procedures

17
Q

what is a function ?

A

a secrtion of code that is reposnible for carrying out a specfic task that retuerns a value

18
Q

what is a proceduer?

A

a section of code that is used to perform a specific task that does not return a value once completed

19
Q

what is a global variable ?

A

variables that can be used anywhere in the program , including within any subroutine

20
Q

What is a local variable ?

A

can be used and these only exist during the execution of the subroutine

21
Q

how would you write to a file in python ?

A

f.write(filename)

22
Q

how would you read from a file in python?

A

f.read(filename)

23
Q

when would you use exception handling

A
  • trying to read a non - existent file
  • trying to convert a non numeric string enetered by a user to an interger or a real number
  • trying to perform calculations with a non numeric variable
  • division by zero