PROGRAMMING Flashcards

(14 cards)

1
Q

what are the 5 data types in programming languages

A

C - character
R - real
I - integer
B - boolean
S - string

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

what is casting

A

converting between data types. e.g. string to integer

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

what are the commands for casting

A

int(“1”) = converts string to integer
real(1) = converts integer (1) into a real (1.0)
bool(1) = converts integer (1) into a boolean value (True)
str(True) = converts boolean value (True) into the string (“True”)

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

what are the 3 arithmetic operators that you need to know

A

** = to the power of. 2**3 =8
// = DIV 20 // 3 = 6
% = MODULO 20 % 3 =2

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

what are the comparison operators

A

==, <, > , !=, <=, >=

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

What 2 things can data value be stored as

A

constants or variables

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

what is a constant data value

A

a constant is assigned a data value at design time and can’t be changed

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

what is a variable data value

A

variable is a data value that can change value throughout the program

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

what is the shape of a NOT

A

triangle and a little circle

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

what is the shape of a AND

A

a rectangle with its right side being curved

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

what is the shape of a OR logic gate

A

an curved arrow head

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

How can you search data

A

SQL
search (what you’re looking for)
from (from where, which table?)
where (what conditions? population > 1000)

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

what is the difference between procedures and functions

A

procedures don’t have to take in parameters
function has to take atleast 1 parameter

procedures don’t return a value
functions will always return a value

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

what are the 2 types of variable and explain

A

local = can only be used within the structure they’re declared in
global = can be used any time after their declaration

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