T7 - Programming fundamentals Flashcards

1
Q

data type

A

The kind of values that can be used in a data item

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

eg of data types

A

integer, float / real, character, string, Boolean

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

eg of arithmetic operators

A

+, -, *, /, ^, MOD, DIV

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

The operator DIV

A

is used for integer division, also known as quotient

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

MOD (modulus) is

A

used to find the remainder when dividing one integer by another

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

data type and memory

A

Data types will determine the amount of memory allocated

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

constants in pseudocode n python

A

const
-snakecase inpython

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

Snake case

A
  • separated with an underscore and capital letters
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Use of snake case

A
  • shows programmer that it must stay the same
    -prevents the value from being changed accidentally by a part of code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Constants

A
  • won’t change its value whilst program runs
  • can be changed by a programmer before the program is compiled or translated
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Casting

A
  • converts data types
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Pseudocode:
converts a string s to an integer

A

int(s)

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

Inputs from the user

A

are strings

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

Concatenating means

A

joining together:

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

The concatenate operator is

A

+
- used to join together strings

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

pseudocode: converts a string s to a number with a decimal point

A

float(s)

17
Q

pseudocode: converts an integer or floating point number x to a string

A

str(x)

18
Q

pseudocode: converts a string (e.g.”True”) to a Boolean

A

bool(s)

19
Q

pseudocode: ASC(‘a’)

A

evaluates to 97, using ASCII

20
Q

pseudocode: CHR(97)

A

evaluates to ‘a’

21
Q

String handling functions:
Python

A

= variable.len

22
Q

Pseudocode: string length

A

str.length

23
Q

Pseudocode: letters from right

A

str.right(n)

24
Q

Pseudocode: letters from left

A

str.left(n)

25
Q

pseudocode substring

A

str.substring(start,end)

26
Q

all uppercase

A

.upper

27
Q

all lowercase

A

.lower =

28
Q

Comments:

A

to describe the purpose of the program
to state the author of the program
to explain what the code does

29
Q

comments - python

A

Python - comments start with #

30
Q

comments in Pseudocode

A
  • start with a double slash //