Introduction to Python and computer programming Flashcards

1
Q

What is an instruction list?

A

A complete set of know commands (commands the computer recognises) is called an instruction list.

Different types/models of computers may have different instruction lists

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

What are the four elements of a language?

A
  • Alphabet
  • Lexis
  • Syntax
  • Semantics
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is an alphabet?

A

A set of symbols used to build words of a certain language

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

What is a lexis?

A

A set of words the language offers its users (a dictionary)

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

What is syntax?

A

A set of rules used to determine if a certain string of words form a valid sentence

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

What is semantics?

A

A set of rules determining if a certain phrase makes sense

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

The alphabet of machine learning is….

A

The instruction list

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

What is a source code?

A

A program written in a high-level programming language (python)

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

What is a source file?

A

The file containing the source code

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

How do we bridge the gap between computer and human language?

A

Machine language –> programming language (source code) –> natural language

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

What are the two methods of transforming a program from high level programming language to machine language?

A

Compilation and interpretation

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

What is compilation?

A

The source program (python) is translated once by getting a file containing the machine code the file can now be distributed world wide.

translated via a complier or translator

(every time the source code is modified the source program must be translated again)

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

What is interpretation?

A

The user can translate the source program each time it has to be run

The program performing transformation is called an interpreter

Source code is distributed WITH interpreter to end user

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

What does the interpreter do?

A

The interpreter reads the source code left to right, checks the lines are correct, then executes the code (or displays error)

Line by line (with some lines repeated e.g. functions)

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

Pros and cons of compilation?

A

Pros:
- execution of translated code is usually faster
- only the user needs to have the complier (end user can use code without it )
- the translated code is stored using machine learning (hard to read therefore inventions and programming tricks kept secret)

Cons:
- the compilation itself may be a very time-consuming process
- you have to have as many compliers as hardware platforms you want your code to be run on

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

Pros and cons of Interpretation?

A

Pros:
- can run code as soon as you complete it (no additional phases of translation)
- stored using programming language (python) not machine language therefore it can be run on computers using different machine languages

Cons:
- slower
- both you and the end user have to have the interpreter to run your code

17
Q

Is python interpreted or complied language?

A

Interpreted language

if you want to program in python you’ll need the python interpreter

18
Q

What are interpreted languages often called?

A

Scripting languages

while the source code programs encoded using them are called scripts (python script)

19
Q

Who created python?

A

Guido van Rossum

20
Q

Pros of python

A

Easy to learn, teach, use understand, obtain, install and deploy

21
Q

Cons of python

A

not a speed demon
in some cases it may be resistant to some simpler testing techniques (debugging can be harder)

22
Q

What are the two main kinds of python?

A

Python 2 and 3

They are not compatible with each other

23
Q

What is CPython?

A

Canonical Pythons/Reference pythons developed by the PSF (Python Software Foundation)

Guido used C programming language to implement the very first version of python. all pythons from PSF are written in C language

This is the most influential Python among all the Pythons in the world.

The default implementation of the python programming language

24
Q

What is Cython?

A

Automatically translates the Python code (clean and clear, but not too swift) into “C” code (complicated and talkative, but agile).

25
Q

What is Jython?

A

J is for Java - python written in java instead of C

26
Q

What is PyPy and RPython?

A

Python environment written in python like language named (RPython - restricted python)

The source code of PyPy is not run in the interpretation manner, but is instead translated into the C programming language and then executed separately.

PyPy is rather a tool for people developing Python than for the rest of the users.

27
Q

What does IDLE stand for?

A

Integrated Development and Learning Environment

28
Q

What is a debugger?

A

A tool that lets you launch your code step-by-step and inspect it at each moment of execution

29
Q

Define a script

A

It’s a text file that contains instructions which make up a python program

30
Q

What is machine code?

A

A low-level programming language consisting of binary digits/bits hat the computer reads and understands