Programing Flashcards

1
Q

how do you define a subroutine

A

def function1():

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

define a local varibable

A

A variables that is declared inside the function

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

define a global variable

A

variable that can be accessed and changed throughout the whole program, including subroutines

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

which varible is a global varibale:
SUBROUTINE add(a, b)
value ← a + b
RETURN value
ENDSUBROUTINE
new_value ← add(3, 5)
OUTPUT new_value

A

new_variable

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

which varibles are globle:
SUBROUTINE add(a, b)
value ← a + b
RETURN value
ENDSUBROUTINE
new_value ← add(3, 5)
OUTPUT new_value

A

a
b
local

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

what is decomposition

A

Breaking the problem down into smaller sub-problems, so that each sub-problem accomplishes an identifiable task, which might itself be further subdivided.

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

what is pattern recognition

A

Finding repeating patterns that could be solved quickly

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

what is abstraction

A

Removing unnecessary detail from a problem

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

how is data represented in boolean logic

A

on or off

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

what is a variable

A

a named memory address that holds a value

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

what is a constant

A

A constant is a location in memory which stores a value that does NOT change.

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

what is iteration

A

a loop that repeats certain steps

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

what is selection

A

a section of code is run only if a condition is met

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

what is IF, ELIF and ELSE and example of

A

selection and iteration

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

when shoud you use ELIF

A

if the first statement isnt true and you want to test for a second condition

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

What is the symbol for real division

A

//

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

What does “//” do

A

finds the integer of a divison
e.g 100//3 = 33

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

What is an integer

data types

A

A whole number

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

What is a real

data types

A

A fraction/ decimal number

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

What is Boolean

Data types

A

Only stores True or False

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

What is character

Data types

A

only stores strings of ASCII characters

22
Q

What is string

Data types

A

A sequence of characters

23
Q

How do you declare a variable

A

Using the = sign

24
Q

What function calculates remainder

25
What symbol means equal in python
==
26
What symbol means not equal to in python
!=
27
What symbol means greater than in python
>
28
What symbol means less than in python
<
29
What symbol mean Greater than or equal to in python
>=
30
Which symbol means Less than or equal to in python
<=
31
Why are data structures used
They allow progamers to store more than one piece of data at a time
32
What are Arrays
A type of data structure that allows programers to put data into a list
33
What type of brackets are used in arrays
Sqaure brackets []
34
How do you import an array
from array import *
35
How do you define an array
variable_name = array( data-type ,[elements])
36
How do you ouput an array
print(array_name)
37
How do you output a certain number in an array
print(array_name[no.position])
38
How do you find the length of a string
len()
39
How do you find the position of characters in a string
find()
40
What is a substring
a string of characters that exists inside a string
41
What is Concatenation
the joining together of two strings
42
What opperation is used for concertration
+
43
How do you convert String to a float | pseudo code
variable = float(variable)
44
How do you convert data types in python
new_ data _type()
45
How do you generate random numbers in python
random. randint()
46
What symbol is used for assignment in Pseudo code
47
Which way does the arrow point when assigning somthing in Pseudo code
The arrow points from the data towards the place where the data is stored Age ← USERINPUT
48
What is used for user input in Pseudo code
USERINPUT
49
What is used for output in Pseudo code
OUTPUT
50
How do you start a for loop in Pseudo code
FOR
51
How do you end a for loop in Pseudo code
ENDFOR