3.2 Programming Flashcards

1
Q

What is Declaration?

A

reserving space in memory for a variable

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

What is Assignment?

A

Saving a value into a variable

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

What is a Variable?

A

A named space in memory that can change

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

What is a Constant?

A

A named space in memory that can’t change

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

What is a Data Type?

A

Type of data that can be stored e.g. integer

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

What is Input?

A

What the user types in

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

What is Output?

A

What the computer displays onto the screen

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

What is Casting?

A

Changing from one data type to another

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

What is Concatenation?

A

Joining data together

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

What is Commenting?

A

Adding non-executional code to your program

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

Why declare a constant instead of a variable?

A

-To tell the programmer the constant should not change
-This way it won’t accidentally change the value of it

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

What are the naming conventions?

A

camelCase and snake_case

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

What is an output statement?
How are they written in VB and Pseudocode?

A

What the computer displays onto the screen
-VB: console.writeline(“”) OR console.write(“”)
-Psuedocode OUTPUT “”

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

What is an input statement?
How are they written in VB and Pseudocode?

A

Input statements is what the user types in.
The input can be assigned to variables.
In VB you use
{variable} = console.readline()
In Pseudocode you use
{variable} ← USERINPUT

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

What is the difference between Pseudocode and VB?

A

They use a variety of different symbols and code. For example VB uses = to assign a variable whereas Pseudocode uses ←.

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

Why is casting useful?

A

It can be used to turn a string into an integer so it can be useful for maths problems
It can also turn an integer into a string so you can add decimal places i.e. 10.00

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

Why is commenting useful?

A

It can tell the programmer what the code is doing
You can comment out code to see where it is going wrong (debugging)

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

Why is it important to name variables and constants as meaningful identifiers?

A

So you know what their purpose is.

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

What is selection?

A

Performing a logical test to see what code to execute (i.e. IF… THEN… ELSE)

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

What is iteration?

A

Repeating code

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

What is definite iteration?

A

Code that is repeated a known amount of times (i.e. FOR i ← 0 TO 9)

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

What is indefinite iteration?

A

Code that is repeated an unknown amount of times, it is repeated until a certain condition(s) is met.
(i.e. WHILE anotherGo = FALSE)

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

What is nested iteration?

A

Iteration inside of iteration
(loop inside of a loop)

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

What is the difference between While and Repeat Until (or Do Loop Until in VB)

A

While checks condition at the start
Do / Repeat Until loop checks condition at the end

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

What does Dim achieve in VB?

A

Declares a variable.

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

What does Const achieve in VB?

A

Declares a constant

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

What is string handling?

A

It is used to check and manipulate strings

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

What are the 2 main methods of putting variables/constants in the output statements?

A

Interpolation
Console.writeline($”{num1} + {num2} = {ans}”)

Braces
Console.writeline(“{0} + {1} = {2}”, num1, num2, ans)

29
Q

What is Case?

A

Case is like an IF statement it checks a variable
It is useful at checking things that have a range (i.e. a-z or A-Z)

30
Q

How do you convert a character into ASCII?

A

Asc(variable)

31
Q

How do you convert ASCII into a character?

A

Chr(variable)

32
Q

How do you do Random number generation (RNG) in VB?

A

Dim num1 as Integer
Dim num2 as Integer
Dim RanNum As New Random

num1 = ranNum.next(1, 11)
num2 = ranNum.next(1, 11)

-You have to go 1 value up to get the whole range (i.e. a six sided die would need 1,7 and that includes all 6 possible values)

33
Q

What is an array?

A

An array is a data structure which can hold multiple values

34
Q

What is an advantage of using an array?

A

It is more efficient than using multiple variables as it can hold multiple values under it’s indexes

35
Q

What is a disadvantage of using an array?

A

It can only hold data type

36
Q

How do you access different values in an array?

A

Each value has an index and you can access them through iteration.

37
Q

What is a parallel array?

A

2 1D arrays that have related information (e.g. Student names and test score)

38
Q

What is a 2D array?

A

It is like a 1D array except it has 2 dimensions so you use it like a grid (i.e. to get to 1 part you have to use to points (1, 2))

39
Q

How do you find values in a 2D array?

A

You have to use nested iteration

40
Q

What is the limitation of a variables, 1D and 2D arrays?

A

They can only be 1 data type

41
Q

What is a record?

A

A data structure made up of fields

42
Q

What is a field?

(in 3.2)

A

A single item of data that you want to store inside of a record
Also known as an element

43
Q

What is Instantiation?

A

The record structure can be used multiple times
A new instance of the record structure is made for each new film

44
Q

How do you create an array of records?

A

Declare the array as the record data type (i.e. Dim DogArray() as dog)

Each index will store a single structure so 0 will contain one dog with name, age, weight, breed etc. and index 1 will be a different dog but with the same fields.

Then you must access the different dogs by iterating through the array.

45
Q

What is a Procedure?

A

A different part of the code that in separate from the sub main.
It can be used multiple times throughout the code
Values are passed to it from a Call
It DOES NOT return a value

46
Q

What is a function?

A

A different part of the code that in separate from the sub main.
It can be used multiple times throughout the code
Values are passed to it from Assignment or an Output
It DOES return a Value

47
Q

How do you tell the difference between a Procedure and Function?

A

A Procedure doesn’t return a value where as a Function does

48
Q

What is a parameter?

A

The variables that are passed to the subroutine

49
Q

What is the subroutine interface?

A

The very top line of a subroutine, it will tell you the parameters of the subroutine

50
Q

What is a Syntax error?

A

Mistakes in the source code - the code can’t execute because of something that can’t be translated
It is usually a typo
It stops the code from executing

e.g. Sim a as Decimal
Sim is the syntax error as the program does not know what you mean and how to execute it

51
Q

What is a Logical error?

A

Occurs when there is a fault in the program
The program will run but not how you expect

e.g. (the line numbers are included but are not part of the program)

1 console.writeline(a)
2 console.writeline(b)
3 console.writeline(c)
4 console.writeline(a)
5 console.writeline(e)

console.writeline(a) on line 4 is the logical error as the code will execute but it will do what isn’t expected: a should be replaced with d on line 4.

52
Q

What is the scope of a Local variable?

A

It is declared in a subroutine so it can only be ‘seen’ by that specific subroutine

53
Q

What is the scope of a Global varibale?

A

The whole program can ‘see’ the variable

54
Q

What is a shared name?

A

You can use the same variable name because of the use of subroutines (you can have a total variable in the main program and in multiple subroutines, all with different values)

55
Q

LEN

A

Calculates the number of characters in a string
(Finds the length of the string)
Returns an integer

VB - Len(password)
Pseudocode - Len(password)

56
Q

MID

A

Extracts a given number of characters from within a string from a given position
Returns a substring

VB - Mid(password, 5, 7)
Pseudocode - Substring(5, 7, Password)

57
Q

INSTR

A

Locates the start position of a string within a string
Returns an integer

VB - InStr(password, “123”)
Pseudocode - POSITION(Password, “123”)

58
Q

Right

A

Extracts a certain number of characters from the right of the string
Returns a substring

VB - Right(password, 3)
Pseudocode - Need to use substring

59
Q

Left

A

Extracts a certain number of characters from the left of the string
Returns a substring

VB - Left(password, 3)
Pseudocode - Need to use substring

60
Q

Variable(position)

A

Extracts a character from the variable at the given position
Returns a character

VB - Variable(1)
Pseudocode - Variable[1]

61
Q

Char.IsUpper

A

Checks if a single character is uppercase
Returns Boolean

VB - Char.IsUpper(password(0))
Pseudocode - Not in Pseudocode

62
Q

Char.IsLower

A

Checks if a single character is lowercase
Returns Boolean

VB - Char.IsLower(password(0))
Pseudocode - Not in Pseudocode

63
Q

Char.IsDigit

A

Checks if a single character is a digit
Returns Boolean

VB - Char.IsDigit(password(0))
Pseudocode - Not in Pseudocode

64
Q

What is authentication?

A

Checking you are an authorised user to use the systems you are trying to access

65
Q

Authentication - Something you know

A

Password or PIN

66
Q

Authentication - Something you have

A

ID card

67
Q

Authentication - Something you are

A

Biometrics (i.e. face, fingerprints)

68
Q

What is 2FA?

A

2 Factor Authentication
Gives an added level of security by combining two methods of authentication