Module 1 Flashcards

1
Q

Language

A

a means for expressing and recording thoughts

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

Machine language

A

very rudimentary computer language

binary language (0s and 1s)

it is the language that computers understand at their core

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

Natural language

A

languages that develop organically, naturally

human language

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

What are the 4 parts of a language?

A

alphabet

lexis

syntax

semantics

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

what is a language’s 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
6
Q

what is a language’s 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
7
Q

what is a language’s syntax?

A

a set of rules used to determine if a certain string of words forms a vali sentence

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

what is a language’s 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
9
Q

instruction list

A

complete list of known commands for a computer

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

alphabet of a machine language

A

is the Instruction List - the computer’s mother tongue

these are sets of symbols that we use to give commands to a computer (through a high-level language like Python)

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

High level programming language

A

java, python, javascript, c#, etc.

a programming language designed to be easier for humans to understand and write, using syntax closer to natural language, rather than the low-level machine code of a computer

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

source code

A

a program written in a high-level programming language

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

source file

A

the file containing the source code

in other words a file containing a program written in high-level programming language

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

compilation

A

the source program is translated to machine language

This action must be repeated each time you modify the source code

This means the program can be distributed as an executable file to be run on other computers

C#, C++, Java

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

interpretation

A

the source code is read into machine code each time the program is run

the downside is that whoever is running the program must have the interpreter installed to run it

Python, JavaScript

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

computer program is actually just a …

A

pure text file (no decorations, like fonts colors embedded images, or other media)

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

interpreted languages are also known as

A

scripting languages

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

Python creator

A

Guido van Rossum

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

Guido van Rossum

A

the creator of python

20
Q

CPython

A

The default implementation of the Python language – the one that is downloaded from Python.org

The canonical version

written and maintained by the Python Software Institute (PSF) of which, Guido is president

Written in the C programing language

21
Q

Cython

A

translates python code into C

22
Q

What does the interpreter do?

A

It directly executes instructions written in a programming language.

It reads the high level programming language and translated it into low level machine code

Specifically, it reads the source code from left to right top to bottom as is common in western culture and uncovers errors as it goes.

the first error it encounters, it finishes its interpretation of the code

23
Q

Advantages of compilation

A

execution of the translated code (the code that is translated to machine language) is generally faster

only the user (the programmer) needs to have the compiler. The end-user gets the translated file

The translated code is stored as machine language, and so it is very hard to understand it, so programming tricks can remain hidden

24
Q

Disadvantages of Compilation

A

The complication is a time consuming process

you have to have as many compilers as hardware platforms you want your code to run on

Compiler catches only syntax and semantic errors while compiling. So other errors may not be found until runtime and may be hard to race at that point

25
Q

Advantages of Interpretation

A

You can run the code as soon as you complete it

The code is stored as programming language (high level language) so you do not need a compiler for each type of system in order to disburse the code
In other words, it can be run on different computers that use different types of machine language

26
Q

Disadvantages of Interpretation

A

Interpretation will take some CPU power, so an interpreted program will never be as fast or as efficient as a compiled program

Both the programmer and the end user need the interpreter in order to run the program

Not as secure as compiler because everyone can see the source code

27
Q

Python rival languages?

A

Perl
ruby - more innovative than Python

28
Q

Which Python does this course (2025) use?

29
Q

Jython

A

A Python written in Java instead of C

30
Q

PyPy and Python

A

A Python environment written in Python

31
Q

What do you need in order to work with Python?

A

Python must be installed on your computer

An editor which supports your code must be available

A console from which you can launch your code and stop it when there is a problem

A debugger which will allow you to inspect your code at each moment of execution

32
Q

negative indexing

A

Negative indexing starts at -1

So, given
thisList = [‘hat’, ‘cat’, ‘mat’]
print(thisList[-1])
console:
mat

OR

thisStr = ‘a string here this is one’
print(thisStr[-1])
console: e

no start: no stop: step = -1 (flips the string)
print(thisStr[::-1])
console: eno is siht ereh gnirts a

33
Q

Booleans

A

True
or
False

capitalized first letter
# so, true and false would result in NameErrors as Python would consider them unassigned variables

34
Q

What does “pass” do?

A

Nothing. Nothing at all. A whole lotta nothing.

35
Q

What does “continue” do?

A

Skips the current iteration of a loop and continues to the next iteration.

x = 0
while x < 8:
if x % 2 == 0:
continue
print(‘#’)

Also this wouldn’t work either, as the continue just skips the print

x = 0
while x < 8:
if x % 2 == 0:
continue
print(‘#’)

36
Q

What does the bitwise left shift operator ( &laquo_space;) do?

A

The bitwise left shift operator («) moves the bits of its first operand to the left by the number of places specified in its second operand

Shifting a single bit to the left by one place doubles its value

37
Q

name this operator: «

A

bitwise left shift operator

38
Q

What is the result?
2 &laquo_space;5

39
Q

Name this operator:&raquo_space;

A

bitwise right shift operator

40
Q

What does the bitwise right shift operator do?

A

The bitwise right shift operator (») moves the bits of its first operand to the right by the number of places specified in its second operand

Shifting a single bit to the right by one place halves its value

41
Q

What does IDLE stand for?

A

Integrated Development and Learning Environment

42
Q

What does a debugger do?

A

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

43
Q

What is the expected behavior of the following program?

prin(“Goodbye!”)

A

This program will generate an error

Specifically, a NameError (since the object “prin” is not defined

44
Q

What is a console?

A

A command-line interpreter that lets you interact with your OS and execute Python commands and scripts

45
Q

What is the best definition of a script?

A

A text file which contains instructions which make up a Python program

46
Q

What is the expected behavior of the following program?

print(“Hello!”)

A

Prints
Hello!
to the console

47
Q

What is the result of this program ? And why?

thisStr = “here it is”
print(thisStr[::-1])

A

si ti ereh

The string indexing resolves to:

[no start index : no end index : -1 step]

So it starts at the end of the string and steps backwards until the beginning