Section 1&2 Flashcards

1
Q

What is decomposition?

A

Breaking a complex problem down into a smaller problems and solving each one individually.

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

What is abstraction?

A

Picking out the important bits of information from the problem, ignoring specific details that don’t matter.

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

What is algorithmic thinking?

A

A logical way of getting from the problem to the solution.

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

What is pseudo code?

A

Pseudo-code is not an actual programming language but it should follow a similar structure and read like one.

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

What does the shapes mean?

A

Oval- start and stop
Parallelogram- input/ output
Rectangle- process
Diamond- decision

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

What are the two types of search algorithms?

A

Binary search and linear search

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

What is binary search?

A

When you find the middle item in an ordered list and then check if the value is higher or lower. Then keep splitting it in half till u find it.

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

What is linear search?

A

Looking through it one by one.

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

Name the two sorting algorithms

A

Bubble sort and merge sort

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

What is a bubble sort?

A

Look at the first two items in the list. If they’re in the right order, you don’t have to do anything. If they’re in the wrong order, swap them. Move onto the next pair. Keep repeating till it’s sorted.

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

What is merge split?

A

When you split the list in half and keep repeating it till they are in pairs. Then you leave them or switch them into the right order. Then you put them back together slowly pair by pair siting them all the way.

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

What are the 4 different data types?

A
Integer- whole numbers
Real- decimal points
Boolean-only two values
Character- a single letter, number or symbol.
String-collection of characters.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How much memory does each data type take?

A
Integer-2 bytes or 4 bytes
Real- 4 bytes or 8 bytes
Boolean- 1 byte
Character- 1 byte
String- 1 byte for each character
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is casting?

A

Languages have function that let you manually convert between data types.

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

List the casting conversions.

A

String_TO_INT(‘1’)
INT_TO_STRING(1)
STRING_TO_REAL(‘1.0’)
REAL_TO_STRING (1.0)

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

What are the 6 different operators?

A
Addition= +
Subtraction= -
Multiplication= *
Division= /
Integer division= DIV
Remainder= MOD
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Name the comparison operators

A
Is equal to - =
Is not equal to- equal with a line through it
Is less than- <
Is greater than- >
Is less than or equal to- >/
Is greater than or equal to- \
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is a constant?

A

A constant is assigned a value at design time that can’t be changed. If you attempt to change the value of a constant in a program then an error message will be returned. It has to be declared.

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

What is a variable?

A

Variable can change value which makes them far more useful than constants. It has to be declared.

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

What is concatenation?

A

When two strings are joined together.

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

Ways to manipulate strings

A

LEN (string) - returns the number of characters in the string
POSITION(string, character)- returns the position of the first occurrence of a certain character in the given string.
SUBSTRING(x, y, string)- extracts a substring from the original string starting at position x and finishing at position y.

22
Q

What does if statements allow you to check?

A

IF statements allow you to check if a condition is true or false, and carry out different actions depending on the outcome.

23
Q

What is a nested if?

A

It’s a more complex IF statements can be made by putting one IF statement inside another one. Nested IF statements allow you to check more conditions once you’ve established that the previous condition is true or false.

24
Q

What is an else if?

A

It checks multiple conditions and give different outputs depending on which is true. They are different from nested if as they only check more conditions if the previous condition is false.

25
Q

What is a case statement and when are they used.

A

Case statement can check if a variable has a specific value. They are used when you want a program to perform different actions for different values of the same variable.

26
Q

What are a repeat until loops?

A

It is controlled by a condition at the end of the loop. Keep going until the condition is true. Always runs the code inside them once. You get an infinite loop if the condition is never true.

27
Q

What is a while loop?

A

Controlled by a condition at the start of the loop. Keeps going while the condition is true. Never runs the code inside if the condition is initially false. You get an indefinite loop if the condition is always true.

28
Q

What is a do while loop?

A

Controlled by a condition at the end of the loop. Keeps going while the condition is true. Always run the code inside them at least once. You get an indefinite loop if the condition is always true.

29
Q

What are for loops? What do they do?

A

For loops repeat the code inside for a certain amount of time. The number of the times that the code repeats will depend on an initial value, end value and step count.

30
Q

What is a nested iteration?

A

Nested iteration statements will typically just have one loop inside another loop.

31
Q

What are the three Boolean operators?

A

And,Or and not

32
Q

What is the pseudo code to code to generate random numbers?

A

Random_INT(1, 14)

33
Q

What is an array?

A

An array is a data structure that can store a group of data values, of the same type, under one name.

34
Q

What is an element?

A

Each piece of data in an array is an element.

35
Q

What are one-dimensional arrays?

A

One dimensional arrays are like lists.

36
Q

Things that you need to know about arrays and elements.

A

1) creating arrays- just like variables, you start off with the array name and the assignment operator.
2) retrieving elements- from an array can be done by using the name of the array and the elements position.
3) changing elements- is done by reassigning the array position to a different data value,
4) the number of elements in an array can be found using the LEN() function.

37
Q

What is a two-dimensional array?

A

Same as one-dimensional arrays where each element is also a one-dimensional array. The position of an element is usually written as [a,b], where a represents the position of the one-dimensional list that the element is in and b represents its position within that one-dimensional list.

38
Q

What is a record?

A

A record is a type of data structure, which means that it is used to store a collection of data values.

39
Q

Why are records useful?

A

They can store values with different data types, such as strings, integers and Boolean.

40
Q

Details about records

A

Each item in a record is called a field, and each file is given a data type and a field name when the record is created. Records are fixed in length, which means that you can’t add extra field lines to them once they’ve been created.

41
Q

How to create a record?

A

When you create a record structure, you can assign a data type and name to each field. Then you can assign it to variables. You can use the variable name to access the whole record.

42
Q

What is an array?

A

A group of records.

43
Q

How do you store data permanently?

A

by writing it to an external file

44
Q

How do you open and close a file?

A

Open ()

Close()

45
Q

How to read or write to a file once it’s opened?

A

Readln()

Writeln()

46
Q

What is a sub routine?

A

Subroutines are a set of instructions stored under one name. They can either be a function or a procedure. The main difference is that functions always returns values, procedures don’t.

47
Q

What is a parameter?

A

Parameters are special variables used to pass values into a subroutine.

48
Q

What is a local variable?

A

A local variable is a variable that can only be used within the structure they are declared in- they have a local scope. Variables declared inside subroutines are called local variables.

49
Q

Advantages of a local variable

A

It won’t affect any coding accept the coding inside the subroutine. It can be reused in an another variable.

50
Q

What is a global variable?

A

A global variable is a variable that can be used any time after their declaration- they have a global scope.