programming techniques?? Flashcards

(104 cards)

1
Q

Imperative programming

A

uses a series of instructions telling comp what to do w/ input in order to solve problem

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

Procedural programming

A

an imperative language
Gives a series of instructions in a (logical)
order

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

Structured programming

A

a kind of procedural programming which uses constructs: selection, sequence, iteration + recurssion rather than ‘go to’ stattements.

Modular techniques used to split large program intoo manageable chunks

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

Declarative programming

A

statements describe prolem to be solved.
language implementation then finds best way of solving it
used to create, amend + query databases

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

Logic programming

A

form of declarative programming.
is a paradigm expressing logic of computation w/o expressing control flow
consist of logical statements
code defines a set of facts and rules

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

What is an inportant feature of declarative programming

A

backtracking

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

whats used to find answers to problems in logic programming

A

queries

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

what uses procedural programming

A

python, basic, pascal, c#

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

what uses oop

A

java, c++, visual basic.NET, python

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

what uses declarative programming

A

sql, prolog

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

what uses functional programming

A

haskell, javascript, logo

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

define backtracking

A

going back to a previously found successful match

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

3 important things in declarative programming

A

facts and rules and goal

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

facts in declarative programming

A

a predicate which may have arguments + is something unconditionally true

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

rules in declarative programming

A

used to define a relationship b/w facts.

stored in the knowledge base.

true depending on given condition

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

goals in declarative programming

A

query to b solved

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

def instantiation

A

process of creating a new object from a class

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

advantages imperative programming

A

Very simple to implement
It contains loops, variables

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

disavantage imperative progrmaming

A

Complex problem cannot be solved
Less efficient and less productive
Parallel programming (parallel processing) is not possible

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

Imperative programming is divided into three broad categories which are?

A

Procedural, OOP and parallel processing

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

oop is

A

a collection of classes and object which are meant for communication.

The smallest and basic entity is object and all kind of computation is performed on the objects only.

More emphasis is on data rather procedure. ??

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

oop advantages

A

Data security
Inheritance
Code reusability
Flexible and abstraction is also present

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

declaative programming divided into?

A

logic, functional, database

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

what does the paradigm used depend on

A

problem to be solved

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
abstraction in declarative programming
how the data is obtained is abstracted from user
25
can procedural programming solve all problems
no or is inefficient
26
is abstraction used in oop
ya
27
what is code in oop designed for
reusability + easy maintenance
28
how is oop reusable
templates are used to create instances of objects
29
what do classes in oop have
attributes and methods
30
how is oop easy to maintain
if an error in the methods, easy to locate where error is
31
what d objects have
data - attributes operations on that data - methods
32
all processing in oop is used on
objects
33
def class
blueprint of an object defines attributes + methods that capture common characteristics + behaviours of the object
34
whats a constructor
a special method creating an object based on the class exist in every class new(attributes)
35
encapsulation def
Is the process of data hiding by keeping an object’s attributes private so their values can only be directly accessed and changed via public methods defined for the class and not from outside the class. This means that objects only interact in the way intended and prevents unexpected changes to attributes, maintaining data integrity
36
inheritance def
Is when a derived class inherits all the methods and attributes of its parent class/superclass. The inheriting class may override some of these methods and attributes and may also have additional extra methods and attributes of its own.
37
'is a' rule
is obj a an obj b used to determine if inheritance appropritate
38
Polymorphism def
allows objects of different classes to be treated as objects of a common superclass or interface
39
parameter exam board def
an item of data That is passed to a subroutine (when it is called)… …is used as a variable within the subroutine
40
describe use of local variables
Defined within one module and accessible only in that module Can be used as parameters Data is lost at end of module(when module is executed) Same variable name can be used in other modules without overwriting values/causing errors Can overwrite global variables (with the same name)
41
diff b/w global and local variables
Defined at start of program Exists throughout program / in all modules Allows data to be shared by modules
42
explain scope
A range of statements/procedure/function/method that a variable is valid for A local variable takes precedence over a global variable of the same name
43
Explain the term ‘scope’ in relation to variables within a program that calls several different procedures
Global variables are (usually) defined at the start of a program + can be used everywhere in the program Local variables can only be used in a subroutine in which they are declared Local variables cease to exist once the sub routine they are in is finished Local variables with the same name as global variables will take precedence over the values in the global variable Local variables within two different procedures will not interfere with one another
44
pros of modular programming
Work is easier to divide between a team each team member just needs to know what values go into their subroutine and the expected functionality Saves time as work takes place in parallel each team member can work on their area of expertise. Breaks problems into smaller areas. Easier to test each subroutine can be tested before integration. Code can be reused
45
features ofIDE
text editor w/ built in compiler/interpreter autocomplete autoformatting syntax highlighting Auto line numbering Syntax checking - check for syntax error Runtime environment to see how code runs A break point adds a pause to your program to stop the flow of execution at a place defined by the user. A memory inspector will help to debug problems with memory allocation by your program. It shows the contents of memory so that you can see how it is being used by the program. Threading Version control - see code version history Stepping - run one line at a time and check result Variable watch window - check values of variables and how they change during execution Error diagnostics - locate + give details on errors
46
What is threading
In programming terms, a thread is a single sequence of code being executed. Threading refers to multiple threads being executed concurrently. If there is a bug in your code and you are using multiple threads, it can be difficult to spot the error. Some IDEs have a thread inspector, which allows you to suspend, resume, and see the status of each thread being executed by your program.
47
def function
Named section of a program that performs a specific task. Returns a value.
48
def procedure
Named section of a program that performs a specific task. Doesnt return a value.
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103