2.2 Programming fundamentals Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What are the 3 programming fundamentals

A

Sequence
Selection
Iteration

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

5 data types

A

Integer
Real
Float
Boolean
String

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

What is casting

A

Changing the data type of something

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

Cast 1 into int

A

int(“1”)

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

Cast 1 into true

A

bool(1)

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

Arithmetic operators

A

*
/

//
%

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

Assignment operator

A

=

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

What is a high-level language

A

Programming language used by humans
Has to be translated for computers to read

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

Comparison operators

A

==
!=
<
>
<=
>=

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

What is a constant

A

A variable that does not change

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

How to concatenate

A

newString= string1 + “ “ string2

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

What is concatenation

A

The conjoining of 2 strings

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

Example of string manipulation

A

.upper()
.left()
.length()

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

What are the boolean operators

A

And
Or
Not
Not and

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

Give an example of selection

A

if then

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

What does the switch statement do

A

If statement with one variable

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

What is sequence

A

When the code runs from top to the bottom

18
Q

What is selection

A

Selects a certain part of the code to run depending on conditions

19
Q

What is iteration

A

Looping code

20
Q

Types of looping

A

Condition-controlled For
Count-controlled Do until, while

21
Q

What does a for loop do

A

Loops for a certain amount of times

22
Q

What does a do until loop do

A

Controlled by condition at the end of the loop

23
Q

What does a while loop do

A

Control by condition at the start of the loop

24
Q

Write a random number generator

A

roll = random(1,4)

25
Q

What is an array

A

Data structure used to store data under one name

26
Q

What is a 1D array

A

A list

27
Q

What is a 2D array

A

A list of lists

28
Q

Arrays have a fixed

A

Length

29
Q

Where is 2D array used

A

Database

30
Q

How to open file

A

file = open(“file.txt”)

31
Q

How to create a file

A

newFile(“myfile.txt”)

32
Q

How to write to a file and how to read

A

writeLine()
readLine()

33
Q

Difference between records and arrays

A

Records can store different data types

34
Q

How to do SELECT FROM in SQL

A

SELECT hotelName
FROM hotels

35
Q

WHERE does in SQL?

A

Used in SELECT and FROM where you want certain conditions to be met

36
Q

What are procedures

A

Set of instructions stored under one name

37
Q

What are functions

A

Procedures that always return a value

38
Q

What are parameters

A

Special variables used to pass values into a subprogram

39
Q

Arguments

A

The values that parameters take

40
Q

Local variables

A

Used within the structure they are declared in

41
Q
A
41
Q

Global variables

A

Can be used any time after their declaration