Misc Flashcards

1
Q

What is a global variable?

A

— A global variable is one which can be used anywhere in a program

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

What is a local variable?

A

— A local variable is one which is defined and can only be used within one part of a program (usually a function or procedure)

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

Give three reasons why a modular approach to coding is a good idea

A

— It allows the task of coding to be split between a team of people

— it allows code to be reused (thus shortening the amount of code and thus the time needed to produce it)

— it is easier to maintain as the code is in one place and reused not repeated throughout the program

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

What is a module?

A

— A block of code that is reused

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

What is a procedure?

A

— A module of code that may or may not take parameters but which does not return a value

— The procedure should carry out one task or action that is clearly indicated by its name

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

What is a function?

A

— A module of code that may or may not take parameters and which returns a value. The function should carry out one task or action that is clearly indicated by its name

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

Stack vs Heap

A

Stack

— neue Daten immer nur oben drauf gelegt werden können => LIFO

— kann, bedingt durch seine Struktur, sehr effizient verwaltet werden, weshalb Stack-Operationen sehr schnell sind

— jeder Thread eines Programmes erhält für den Stack einen eigenen Speicherbereich mit fixer Größe zugewiesen

Darauf werden Informationen zum Programmablauf (z.B. Funktionsparameter) und lokale Variablen gespeichert

— the stack grows and shrinks as functions push and pop local variables

— there is no need to manage the memory yourself, variables are allocated and freed automatically

— the stack has size limits

— stack variables only exist while the function that created them, is running

— very fast access

Heap

— eine zumeist auf Bäumen basierende abstrakte Datenstruktur

— variables can be accessed globally

— no limit on memory size

— (relatively) slower access

— no guaranteed efficient use of space, memory may become fragmented over time as blocks of memory are allocated, then freed

— you must manage memory (you’re in charge of allocating and freeing variables)

— variables can be resized using realloc()

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

Declarative vs Programmatic UI

A

Declarative UI

— You say what you want without having to say how to do it

— You do not have to specify the exact steps to get the result

— You just set the command or order, and let it be up to the system how to complete that order

— For example, SQL is more declarative than procedural, because the queries don’t specify steps to produce the result

— You adapt a markup language like HTML or XML, possibly in combination with a layout language like CSS, to define the identity and basic placement of widgets and controls

— You traverse your declared UI using a real programming language like Javascript in order to add functionality and advanced UI features

Programmatic UI

— You define the whole process and provide the steps how to do it

— You create and lay-out the elements of the UI directly in a programming language

— While you may still achieve separation of concerns by delegating UI creation and layout to a dedicated “View” object, all actions necessary to construct the UI are programmatically guided instead of declaratively specified

— All older UIs used this approach, and it is commonly used today to construct UIs for a vast variety of desktop frameworks and can also be used to manipulate the web DOM

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

What makes Python special?

A

— It is an interpreted, object-oriented, high-level programming language with dynamic semantics

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

Functional vs Procedural Programming

A

— Functional programming focuses on expressions

— Procedural programming focuses on statements

— In computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data

— It emphasizes the application of functions, in contrast with the procedural programming style that emphasizes changes in state

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