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
Q

What is not equal to

A

!=

26
Q

What is equal to , comparatively?

A

==

27
Q

What are subroutines?

A

A set of code within a program , that can be called any time from the man program

28
Q

What are the advantages of subroutines?

A

✅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
Q

How are subroutines done in Python and pseudocode ?

A
30
Q

What are global and local variables?

A

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
Q

What are parameters ?

A

A special variable , that passes data into the subroutine
*local scope

32
Q

1-D |rrays in python and pseudocode

A

Used to store multiple data values.
A a variable with a single identifier
*index begins at zero for both python and pseudocode

33
Q

How do you calculate the length of an array in pseudo code and python ?

A
34
Q

2D arrays

A
35
Q

How do you calculate length in arrays?

A
36
Q

How do you access all values within a 2D array?

A
37
Q

How do you write a for loop in python and pseudocode ?

A
38
Q

What are records?

A

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
Q

How do you make a record in python (dictionary) and pseudocode?

A
40
Q

What is a data structure ?

A

A format, for storing multiple data values under one variable name

41
Q

What is validation?

A

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
Q

What are the types of validation?

A

Presence check
Format check
Range check
Look up table
Length check

43
Q

What is authentication?

A

Checking the identity of a user

44
Q

What is a syntax error?

A

When the compiler/interpreter doesn’t understand something , because it doesn’t follow the rules or grammar of the programming language

45
Q

What is a logic error

A

When the compiler/ interpreters are able to run the code, but the code does something unexpected

46
Q

What are the types of data ?

A

Normal
Erroneous
Boundary/ extreme:
Boundary valid & boundary invalid

47
Q

What are some benefits of the structured approach ?

A
48
Q

what are some benefits of arrays

A

Arrays help maintain large sets of data under a single variable name to avoid confusion that can occur when using several variables

49
Q

What are the two search algorithms?

A

🟢Binary search
🟢Linear search

50
Q

What are the two sort algorithms?

A

🔵bubble sort
🔵merge sort

51
Q

describe binary search

A
52
Q

Binary search pseudocode code and python

A
53
Q

What is the pseudo code for binary search

A
54
Q

Describe merge sort

A
55
Q

Describe bubble sort

A
56
Q

What is the pseudo code for a bubble sort

A
57
Q

Merge sort advantages and disadvantages

A
58
Q

FOR loop (definite iteration )
Python V pseudocode

A
59
Q

Subroutines (procedures and functions)
Python V pseudocode

A
60
Q

Arrays (1D & 2D)
Pseudocode vs Python

A