Programing Flashcards

You may prefer our related Brainscape-certified 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

A

MOD

25
Q

What symbol means equal in python

A

==

26
Q

What symbol means not equal to in python

A

!=

27
Q

What symbol means greater than in python

A

>

28
Q

What symbol means less than in python

A

<

29
Q

What symbol mean Greater than or equal to in python

A

> =

30
Q

Which symbol means Less than or equal to in python

A

<=

31
Q

Why are data structures used

A

They allow progamers to store more than one piece of data at a time

32
Q

What are Arrays

A

A type of data structure that allows programers to put data into a list

33
Q

What type of brackets are used in arrays

A

Sqaure brackets
[]

34
Q

How do you import an array

A

from array import *

35
Q

How do you define an array

A

variable_name = array( data-type ,[elements])

36
Q

How do you ouput an array

A

print(array_name)

37
Q

How do you output a certain number in an array

A

print(array_name[no.position])

38
Q

How do you find the length of a string

A

len()

39
Q

How do you find the position of characters in a string

A

find()

40
Q

What is a substring

A

a string of characters that exists inside a string

41
Q

What is Concatenation

A

the joining together of two strings

42
Q

What opperation is used for concertration

A

+

43
Q

How do you convert String to a float

pseudo code

A

variable = float(variable)

44
Q

How do you convert data types in python

A

new_ data _type()

45
Q

How do you generate random numbers in python

A

random. randint()

46
Q

What symbol is used for assignment in Pseudo code

A

47
Q

Which way does the arrow point when assigning somthing in Pseudo code

A

The arrow points from the data towards the place where the data is stored
Age ← USERINPUT

48
Q

What is used for user input in Pseudo code

A

USERINPUT

49
Q

What is used for output in Pseudo code

A

OUTPUT

50
Q

How do you start a for loop in Pseudo code

A

FOR

51
Q

How do you end a for loop in Pseudo code

A

ENDFOR