Programming fundamentals Flashcards

1
Q

what is a string

A

a group of characters

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

what is quotient (DIV)

A

does the division but cuts off the decimal

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

what is modulus(mod)

A

gives the remainder of the

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

for a and Boolean to work what has to take place

A

both sides need to be true

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

what is the code for substring

A

.substring(start, how many )

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

what are variables

A

identifiers that hold value that can be changed

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

what are constants

A

identifiers that hold value and connot be changed

const PI = 3.142

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

what is user input always

A

a string

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

what are the 3 fundamental programming constructs

A

sequence
selection
iteration

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

what is selection and what code do you use

A

process of making a decision
if - always checked
elseif - only checked if previous conditions were false
else - no conditions and only checked if all previous conditions were false

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

during a switch case statement what do you use

A

switch == if
case
default =else
endswitch

option = input (“select option 1 or 2.”)

switch option:
case “1”:
print(“Welcome to the program.”)
lauchprogram()
case “2”:
settings()
default:
print(“goodbye”)
endswitch

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

when are switch case useful

A

where a variable determines the selection

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

what are count controlled loops

A

repeaats a set number of time
FOR loop

FOR i = 0 to 5 THEN
print (i)
next i

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

what is iteration

A

where code repreats

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

what is a condition controlled loop

A

WHILE loop - repeats until a condition is broken
DO UNTIL repeats until a condition is met

password = input(“PW: “)

while password != “123”
password = (“PW: “)
endwhile

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

what is a subprogram

A

out of line block of code

17
Q

what must you do to a sub program

A

call it so it can be executed

procedure add(num1,num2)
sum = num1 + num 2
print(sum)
endprocedure

print(sum)
endprocedure

print(“welcome”)
add(10,15)

18
Q

what must you do in a function

A

must return it
function add(num1,num2)
sum = num1 + num 2
print(sum)
return sum
endfunction

print(sum)
endfunction

print(“welcome”)
add(10,15)

19
Q

what is a local variable

A

only exist when the sub program is executing
only accessible inside the subprogram

20
Q

what is the difference between a function and a procedure

A

Procedure is a named set of instructions that be can be called upon throughout the code

A function is a procedure that returns a value

21
Q

Give 4 ways to keep code maintainable

A

consistent naming convention
many subprograms
consistent indentation
use comments

22
Q

what is a procedure

A

a sequence of instruction named by an identifier which can be called anywhere in the program

23
Q

give two examples of substring handlaing

A

.substring(start, how many)
concatenation(+)

24
Q

What are the similarities between a function and a procedure

A

They both take parameters