Programming Flashcards

1
Q

Imperative programming

A

(C, Python)

  • Also called ‘procedural programming’
  • Focusses on procedures with statements of small instructions being directly executable on the underlying hardware
  • Statements can have side effects on global state
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The 3 pillars of OOP

A
  • Encapsulation
  • Inheritance
  • Polymorphism
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The 3 programming paradigms

A
  • Imperative programming
  • Declarative programming
  • Object-oriented programming
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is encapsulation?

A

Two definitions:

  • A construct that facilitates bundeling of data with methods (like a ‘class’)
  • A mechanism for restricting access to components (like ‘private’)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Python sequences

A
  • List: An ordered sequence with objects of any type. Enclosed within square brackets:
    [ ‘abc’, 1, 4.5 ]
  • Tuple: An immutable array. Can be enclosed within parentheses:
    ( 1, 4, 5.6, ‘a’ )
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Python: Reserved keywords

A
and     assert    break     class     continue
def     del       elif      else      except
exec    finally   for       from      global
if      import    in        is        lambda
not     or        pass      print     raise
return  try       while  float int string
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Declarative programming

A
  • Is characterized by descriptions of a problem instead of how to solve it in small statements

Two forms:
> Functional programming (Lisp, Haskell)
- Everything is inside functions
- There is no global state, nor side-effects
> Logic programming (SQL, Prolog)
- The compiler/interpreter knows facts and rules
- It can be asked questions

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