Programming Flashcards

1
Q

What is a data type?

A

Specification is what type of value a variable has.

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

What are the five data types?

A

Integer
Real/float
Character
String
Boolean

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

What is an integer?

A

A numerical data type for whole numbers
2/4 bytes

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

What is a real/float ?

A

A numerical data type for decimal numbers
4/8 bytes

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

What is a character?

A

A single alphanumerical symbol
1 byte

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

What is a string?

A

A data type for one or more alphanumerical characters.
* can be a number or string
1 byte for each character

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

What is a Boolean?

A

A data type that can only take one of two values - TRUE or FALSE
1 bit-1 byte

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

What is the difference between constants and variables?

A

Variables can be changed throughout out the program.

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

What is iteration?

A

Loops controlled by conditions

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

What are types of indefinite iteration?

A

Only rely on a condition(can be infinite):
Repeat until- condition at end, run at least once
While- condition at the start of loop
Do while

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

What is selection?

A

Causes the program to make a choice and flow in a given direction

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

What is a variable?

A

A named piece of memory that holds a value , can change as the program is running

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

What is a constant?

A

A named piece of memory where the value cannot be changed while a program runs

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

What is a type of selection?

A

An if else statement

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

What is definite iteration?

A

A loop that repeats a set number of times - usually a for loop

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

What is a nested statement ?

A

An iteration or selection made up of multiple statements inside each other

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

What is the need for meaningful identifiers?

A

Suitable names for variables, makes it easier for the next person to work on the code to understand

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

How do you find the length of a string?

A

LEN(string)
*starts from 1
🐍len(string)

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

How do you find the position of a string?

A

POSITION(string,character)
*includes the 0
🐍 string.index(‘x’)

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

How do you take a certain part of the string?

A

SUBSTRING(x ,y ,string)
*includes the 0
*does include last number
🐍string[x : y]
*does not include last number

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

How do you concatenate strings?

A

+
Does not include spaces
Normally done with variables
🐍everything has to be a string

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

How do you change one data type to another?

A

STRING_TO_INT (“your mom”)
STRING_TO_REAL (“your mom “)
INT_TO_STRING (69)
REAL_TO_STRING (9.58)
🐍
str()
int()
float()

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

How do you get the quotient (whole number)?

A

DIV
🐍//

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

How do you get the remainder?

A

MOD
🐍%

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What is not equal to
!=
26
What is equal to , comparatively?
==
27
What are subroutines?
A set of code within a program , that can be called any time from the man program
28
What are the advantages of subroutines?
✅can be tested individually, making it easier to debug ✅can be used throughout the program repeatedly, however code only has to be written once = shorter programs ✅can be saved separately as modules , and reused in other programs = saving time
29
How are subroutines done in Python and pseudocode ?
30
What are global and local variables?
Global = can be used throughout the program , at any time Local = can only be used within the structure they are declared in *less memory
31
What are parameters ?
A special variable , that passes data into the subroutine *local scope
32
1-D |rrays in python and pseudocode
Used to store multiple data values. A a variable with a single identifier *index begins at zero for both python and pseudocode
33
How do you calculate the length of an array in pseudo code and python ?
34
2D arrays
35
How do you calculate length in arrays?
36
How do you access all values within a 2D array?
37
How do you write a for loop in python and pseudocode ?
38
What are records?
Basically an array , that can store items with different data types Each record is an individual list in the list of lists 9rows’0 Columns are known as fields, each field is declared with a variable
39
How do you make a record in python (dictionary) and pseudocode?
40
What is a data structure ?
A format, for storing multiple data values under one variable name
41
What is validation?
Checking that data meets certain criterias before passing the program. It reduces the data entry errors , and prevents the ro gram from crashing if inalienable data is input
42
What are the types of validation?
Presence check Format check Range check Look up table Length check
43
What is authentication?
Checking the identity of a user
44
What is a syntax error?
When the compiler/interpreter doesn’t understand something , because it doesn’t follow the rules or grammar of the programming language
45
What is a logic error
When the compiler/ interpreters are able to run the code, but the code does something unexpected
46
What are the types of data ?
Normal Erroneous Boundary/ extreme: Boundary valid & boundary invalid
47
What are some benefits of the structured approach ?
48
what are some benefits of arrays
Arrays help maintain large sets of data under a single variable name to avoid confusion that can occur when using several variables
49
What are the two search algorithms?
🟢Binary search 🟢Linear search
50
What are the two sort algorithms?
🔵bubble sort 🔵merge sort
51
describe binary search
52
Binary search pseudocode code and python
53
What is the pseudo code for binary search
54
Describe merge sort
55
Describe bubble sort
56
What is the pseudo code for a bubble sort
57
Merge sort advantages and disadvantages
58
FOR loop (definite iteration ) Python V pseudocode
59
Subroutines (procedures and functions) Python V pseudocode
60
Arrays (1D & 2D) Pseudocode vs Python