Paradigms Flashcards

1
Q

What is a programming language

A

A programming language is a computer language
that is used by programmers to communicate
with computers. It is a set of instructions written
in any specific language to perform a specific
task.

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

Define the term “Programming Paradigmn”

A

A programming paradigm is the
classification, style or way of
programming. It is an approach to solving
problems by using programming
languages.

OR

A programming paradigm is a way to classify programming languages
based on their features.

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

List the features of Procedural Programming

A
  1. Local variables
  2. Global variables
  3. Modularity
  4. Top-down
    approach
  5. Predefined
    functions
  6. Parameter passing
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Explain local variables

A

A local variable is a programming variable that has a local scope of use.
This means the variable only functions in the function in which the
developer defines it. Local variables only work in this capacity, so they
can cause code to fail, leaving a task unfinished if a professional or user
attempts to use the variable in a method outside of its scope.

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

Explain global variables

A

Global variables increase functionality when local
variables are insufficient. Developers can use global
variables in nearly all functions. When defined globally, a
variable makes itself available to all methods and functions
in the code, allowing the developer to access key data
throughout the program’s many procedures.

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

Define Modularity

A

Modularity is a structure in which a developer divides the functionality of its code into a
series of smaller blocks. The programmer can then call these blocks, often called
methods or functions in procedural programming languages, in their code to access
them.

This makes important functions repeatable to create a more efficient setup code,
compared to one that requires the programmer to reuse the same code at multiple points
when including a task that they need more than once.

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

What is a Pre-defined function

A

A predefined function is a function available in a procedural
programming language from a library of available functions.
These functions allow a programmer to complete common
tasks without creating the required code themselves. This
can help a developer save time during production.

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

List atleast 3 Examples of Procedural languages

A
  1. ALGOL
    2.BASIC
    3.C
    4.COBOL
    5.Pascal
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

List and explain the advantages of procedural programming languages

A
  1. Versatility
    Procedural programming is a versatile paradigm that allows
    developers to create coding projects that accomplish
    significantly varied goals. With procedural programming
    languages designed for many different types of development
    projects, including software and web development, there’s
    likely an effective procedural programming language you can
    use to accomplish your goals.
  2. Simplicity
    Procedural programming is a relatively simple approach to
    computer programming. Therefore, many developers start working
    with procedural programming languages, as they provide a
    foundation for coding that the developer can apply as they learn
    other languages, such as object-oriented language.
  3. Accesibility
    Many popular programming languages use procedural
    programming, so there are many resources available to an
    aspiring developer hoping to learn them. This includes
    both paid courses and free online resources and
    communities you can access when you encounter
    challenges, which can help expedite your development.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

List and explain the disadvantages of procedural programming

A

Complexity:
The simplicity of procedural programming
languages can create a challenge when
you’re attempting to make complex
programs. Often, choosing a language with
an object-oriented approach may be easier
for more in-depth projects.

Trouble Shooting
The use of global data in procedural
programming languages can make it
challenging to identify the source of errors in
your code. This can cause a complex
debugging process, adding time to your
development schedule.

Strict Data types
Data in procedural programming
languages are immutable. This means
you can’t change its structure or
functionality after creation, which can be
limiting, compared to the nearby option
in other languages.

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

What is Object Oriented Programming?

A

Object-oriented programming (OOP)
is a computer programming
paradigm that organizes software
design around objects, rather than
functions and logic.

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

List and Explain the properties of Object Oriented Programming

A

Classes

Class are blueprints for
creating objects.

Attributes

Attributes store data about an
object and are defined in the
class template.

Methods

Methods are functions that
are defined inside a class
that describe the behaviors
of an object.

Objects

Objects are instances of a class
created with specifically defined
data.

Class are blueprints for
creating objects.

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

List and explain the characteristics of object oriented programming

A

Inheritance

Inheritance means classes
can gain methods and
attributes from another
classes allowing developers
to reuse code in another
part of a program or use
external libraries to gain
functionally in a program.

Encapsulation
Encapsulation is a way to
restrict the direct access to
some components of an object,
so users or other classes cannot
access state values for all of
the variables of a particular
object.

Abstraction
Objects only reveal internal
mechanisms that are relevant
for the use of other objects,
hiding any unnecessary
implementation code. The
derived class can have its
functionality extended. This
concept can help developers
more easily make additional
changes or additions over time.

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

List atleast 3 examples of OOP

A

1.Python
2. Java
3. Ruby
4. C#
5.C++

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

List and explain the advantages of OOP

A

Flexibility
Functions defined in class
can be used in many
different objects

Reusability

Code can be reused through
inheritance, meaning a team
does not have to write the
same code multiple times.

Modularity

Objects can be self-contained,
making troubleshooting and
collaborative development
easier.

Scalable

Larger teams of programmers can
work independently on system
components by braking them into
objects.

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

List and explain the Disadvantages of OOP

A

Hard to learn
For some people the
pattern of dividing code
into objects can be
difficult to get used to

Bigger Programs

Programs written with OOP
tend to have bigger file sizes
with can be a problem in
cases were space is limited.

Inefficient

For specifically small projects
this paradigm can complicate
the problem.

Slower

These programs tend to be slower
than other programs as more logic
is required to facilitate the
components.

17
Q

List and explain the various uses of OOP (Object oriented programming)

A

Game Development

Systems in games can be divided into
multiple objects that interact with
each other can be very useful.
Separating things such as the
background, foreground and player
model into objects and the interaction
between them into methods can make
the code for a game much easier to
understand and work with.

Large Projects

Large projects with teams of dozens of
programmers need to use objects
benefit greatly from breaking down
projects into objects. One such is the
google search engine with many
algorithms running simultaneously to
give you proper search results and ads.
It consists of millions of lines of code
and is consistently updated with new
lines of code

18
Q

Explain the functional programming paradigm

A

Functional programming is a programming paradigm that attempts to
bind everything in the style of pure mathematical functions. It’s a
declarative programming style. Its primary focus is on “what to
solve,” as opposed to an imperative style, which focuses on “how to
solve.” It employs phrases rather than statements.

19
Q

List and explain characteristics of functional programming paradigm

A

Lazy Evaluation-This means that the evaluation of expressions is
delayed until their values are actually needed.(Haskell)

Modularity-separating a program’s functions into independent pieces
or building blocks, each containing all the parts needed to execute a
single aspect of the functionality.

20
Q

List atleast 3 languages under the functional programming paradigm

A

Haskell
Python
Lisp
Scala
ERLANG

21
Q

List 3 advantages of the Functional Programming Paradigm

A
  1. It helps us to solve problems effectively in a simpler
    way.
  2. It improves modularity.
  3. It allows us to implement lambda calculus in our
    program to solve complex problems.
  4. It reduces complex problems into simple pieces.
  5. It improves the productivity of the developer.
  6. It helps us to debug the code quickly.
22
Q

List and explain atleast 3 disadvantages of the functional programming paradigm

A
  1. For beginners, it is difficult to understand. So it is not
    a beginner friendly paradigm approach for new
    programmers.

2.Maintenance is difficult during the coding phase
when the project size is large.

  1. Reusability in Functional programming is a tricky task
    for developers.
23
Q

What is a declarative programming paradigm

A

A Declarative Programming Paradigm is a paradigm in which the
programmer defines what needs to be accomplished by the program
without defining how it need to be implemented.

24
Q

List and explain characteristics of a declarative programming paradigm

A

Definition of Relationships - made up of sets of definitions or equations describing relations which specify what is
to be computed (not how it is to be computed).

Assignment – variables can only have one value assigned to them and this value cannot be altered during a
program’s execution, this is referred to as a non-destructive assignment.

Data Structures – when no destructive assignment is being used, explicit representations for data structures must be
used.

Order of Execution – program statements are true independent of the computational context, meaning values
associated with variable names cannot be changed. Thus, the order in which definitions or equations are called does
not matter.

Expressions and Definitions as Values – relationships may construct new relationships and pass them on to other
relationships as arguments. Thus, declarative languages allow definitions or expressions to be treated in the same
manner as more standard parameter data items.

Control - control is transferred to the language and hence is no longer the programmers responsibility.

25
Q

List and explain disadvantages of Declarative programming

A

It is sometimes difficult to interpret by outside users; especially
beginners.

Declarative programming tools are more complex to operate.
Sometimes a simple problem has to be solved using a feature that
doesn’t exist in the tool.

It is less customizable. Declarative programming has a complex
syntax. Thus, it is considerably hard to modify the programs.

Some declarative programs require you to be more specific to
carry out complicated algorithms and functions.

26
Q

Provide examples of declarative programming languages

A

HTML - is defined as the standard markup language
for documents designed to be displayed in a web
browser.

SQL - is a domain-specific language used in
programming, managing and communicating with a
database.

CSS - is used to style and layout web pages (HTML
documents).

27
Q

Define the term: Assembler

A

Assembler: is a program that takes basic computer
instructions and converts them into a pattern of bits that the
computer’s processor can use to perform its basic operations.

An example of an assembler is x86. It’s used to convert any
program running on an Intel or AMD processor to machine
code.

28
Q

Define the terms: compiler

A

Compiler: is a special program that translates a programming
language’s source code into machine code, bytecode or another
programming language.

An example of an compiler is C Compiler

29
Q

Define the term interpreter

A

Interpreter: is a computer program that directly executes
instructions written in a programming or scripting language,
without requiring them previously to have been compiled into
a machine language program.

An example of a Interpreter is the Python Interpreter.

30
Q

Define the term virtual machine

A

Virtual Machine: a computer system created using software
on one physical computer in order to emulate the functionality
of another separate physical computer.

An example of Virtual Machine in programming is Java
Virtual Machine (JVM). It allows Java code to run on multiple
operating systems.

31
Q

Explain the two main categories of programming languages

A

Low Level Languages

A low-level language is a programming language that
provides little or no abstraction of programming
concepts and is very close to writing actual machine
instructions.

AND

High Level Languages

High level Language is a computer programming
language that not only allow the use of symbolic
operators to signify operations and of symbolic names to
represent data and data structures, but are also structured
with syntax and semantics to describe the computing
algorithm.

32
Q

Explain the first generation of computer languages

A

Machine Language (1st Generation)

This language is the native language of the
computer (binary). Machine language utilizes
binary digits ONLY. The earliest computers
were programmed using machine language or
machine code. 1st generation languages are
procedural languages.

33
Q

Describe the second generation of computer languages

A

Is a symbolic form of machine code for a particular computer.
Assembly language was developed because of the disadvantages of
machine language. Instead of using binary digits, assembly typically
uses more meaningful symbols.

For example “SUB” for subtraction.

Assembly programs need to be translated to machine language before
execution can take place. 2nd GL are procedural languages.

34
Q

Describe the third generation of programming languages

A

This language utilizes a series of English like words and
arithmetic symbols, which simplify the program development
process.

Third generation language are procedural language meaning that
the programmer provides instructions that tells the computer how
to accomplish a task.

35
Q

Describe fourth generation languages

A

This programming language is similar to 3GL, however it is
closer to human language. It is a non-procedural language,
therefore the programmer only specifies what the program
must accomplish without providing the steps. 4GL’s have a
built in knowledge base of all the possible methods that can be
used to achieve a certain goals.

36
Q

Describe 5th generation languages

A

This programming language provides a visual or
graphical interface for creating the source code.
5GL’s also have the ability to convert source code to
machine language using 3GL or a 4GL compiler.

It is the most user-friendly programming language.