Programming Flashcards

1
Q

What are the 5 main data types?

A
  • Integer (INT)
  • Real/ float (REAL)
  • Boolean (BOOL)
  • Character/char (CHAR)
  • String (STRING)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What do the main data types store?

A

> Integer - whole numbers,
Real - numbers with decimals,
Boolean - true or false,
Character - a single letter, number or symbol,
String - used to represent text, can hold a collection of characters (cannot do maths).

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

What is the typical amount of memory taken up from the main data types? (in order)

A

1) Real - 4 Bytes or 8 Bytes,
2) Integer - 2 Bytes or 4 Bytes,
3) String - 1 Byte per character,
4) character - 1 Byte,
5) Boolean - 1 bit is needed but 1 byte is often used.

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

Is it possible to change one data type to another?

A

Yes, most languages do allow you to convert data types.

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

What does an assignment look like in pseudocode?

A

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

What are examples of selection?

A

If/Case, Though case is not used in pseudocode, it is specific to certain programming languages like VB.

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

What are the two types of iteration?

A

> Definite - a known number of loops at the start of the iteration,
Indefinite - loops until a condition is met.

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

What are examples of indefinite iteration?

A

While loops

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

What are examples of definite iteration?

A

For loops

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

What does DIV do?

A

Divides a number to the nearest whole number without going over, for example: 20 DIV 3 = 6

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

What does MOD do?

A

Gives you the remainder of a division, for example: 20 MOD 3 = 2

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

What is a constant?

A

A variable where data is assigned and then cannot be changed.

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

What is a variable?

A

A location where data values can be stored as a certain file type.

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

What is the difference between a constant and a variable?

A

The data in a constant cannot change but a variables data can.

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

How do you create a random number in Pseudocode?

A

RANDOM_INT(x, y)

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

What are arrays?

A

A data structure that an store a group of data values of the same type. a[]

17
Q

What is it called when array already has data assigned to indexes?

A

Prepopulated

18
Q

What does a prepopulated 1D array look like in pseudocode?

A

a ← [‘Denial’, ‘lebron’, ‘Nig’, ‘Cmon’]

19
Q

What are 2D arrays?

A

The same as an array but with columns and rows instead of just one list. a[x][y] or a[x, y]

20
Q

What does a prepopulated 2D array look like in pseudocode?

A

a ← [[‘Joe’, ‘Momma’], [‘Nig’, ‘Cmon’]]

21
Q

What is a record?

A

Similar to an array but stores multiple data types. Each item stored in a record is called a field and can have a different data type assigned to it.

22
Q

How do you declare a record?

A

RECORD [name of record]

[data type] [name of field]
[data type] [name of field]

ENDRECORD

23
Q

How do you assign values to a record?

A

record

24
Q

Can you use an array to store records?

A

Yes, if they have the same record structure.

25
Q

Why do we use files in programming?

A

To permanently store data when the program closes since the program loses all data once finished.
You can read or write to a file by using WRITELINE() or WRITE()/ READLINE() or READ.

26
Q

How do you open and close a file in a program?

A

Variable

27
Q

Why do we use subroutines and functions?

A
  • Code can be repeated instead of rewritten,
  • Code can be edited without effecting the rest of the program,
  • Variables can be stored locally instead of taking up extra memory globally.
28
Q

What is the difference between subs and functions?

A

Functions return a value.