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
What does Dim achieve in VB?
Declares a variable.
26
What does Const achieve in VB?
Declares a constant
27
What is string handling?
It is used to check and manipulate strings
28
What are the 2 main methods of putting variables/constants in the output statements?
Interpolation Console.writeline($"{num1} + {num2} = {ans}") Braces Console.writeline("{0} + {1} = {2}", num1, num2, ans)
29
What is Case?
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
How do you convert a character into ASCII?
Asc(variable)
31
How do you convert ASCII into a character?
Chr(variable)
32
How do you do Random number generation (RNG) in VB?
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
What is an array?
An array is a data structure which can hold multiple values
34
What is an advantage of using an array?
It is more efficient than using multiple variables as it can hold multiple values under it's indexes
35
What is a disadvantage of using an array?
It can only hold data type
36
How do you access different values in an array?
Each value has an index and you can access them through iteration.
37
What is a parallel array?
2 1D arrays that have related information (e.g. Student names and test score)
38
What is a 2D array?
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
How do you find values in a 2D array?
You have to use nested iteration
40
What is the limitation of a variables, 1D and 2D arrays?
They can only be 1 data type
41
What is a record?
A data structure made up of fields
42
What is a field? | (in 3.2)
A single item of data that you want to store inside of a record Also known as an element
43
What is Instantiation?
The record structure can be used multiple times A new instance of the record structure is made for each new film
44
How do you create an array of records?
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
What is a Procedure?
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
What is a function?
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
How do you tell the difference between a Procedure and Function?
A Procedure doesn't return a value where as a Function does
48
What is a parameter?
The variables that are passed to the subroutine
49
What is the subroutine interface?
The very top line of a subroutine, it will tell you the parameters of the subroutine
50
What is a Syntax error?
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
What is a Logical error?
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
What is the scope of a Local variable?
It is declared in a subroutine so it can only be 'seen' by that specific subroutine
53
What is the scope of a Global varibale?
The whole program can 'see' the variable
54
What is a shared name?
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
LEN
Calculates the number of characters in a string (Finds the length of the string) Returns an integer VB - Len(password) Pseudocode - Len(password)
56
MID
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
INSTR
Locates the start position of a string within a string Returns an integer VB - InStr(password, "123") Pseudocode - POSITION(Password, "123")
58
Right
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
Left
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
Variable(position)
Extracts a character from the variable at the given position Returns a character VB - Variable(1) Pseudocode - Variable[1]
61
Char.IsUpper
Checks if a single character is uppercase Returns Boolean VB - Char.IsUpper(password(0)) Pseudocode - Not in Pseudocode
62
Char.IsLower
Checks if a single character is lowercase Returns Boolean VB - Char.IsLower(password(0)) Pseudocode - Not in Pseudocode
63
Char.IsDigit
Checks if a single character is a digit Returns Boolean VB - Char.IsDigit(password(0)) Pseudocode - Not in Pseudocode
64
What is authentication?
Checking you are an authorised user to use the systems you are trying to access
65
Authentication - Something you know
Password or PIN
66
Authentication - Something you have
ID card
67
Authentication - Something you are
Biometrics (i.e. face, fingerprints)
68
What is 2FA?
2 Factor Authentication Gives an added level of security by combining two methods of authentication