Chapter 1 Flashcards

(37 cards)

1
Q

Natural Languages

A

Languages that people speak (like English) which are not designed by people but evolved naturally

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

Formal Languages

A

Languages that are designed by people for specific applications (like music score or programming languages)

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

For which application did people design programming languages as a formal language?

A

To express computations

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

How are formal languages’ syntax rules like?

A

They have strict syntax rules that govern the structure of statements. For eg - 3 + 3 = 6 has a correct syntax in Math but 3+ =5–$8 hasn’t.

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

Syntax Rule Flavors - how many and what are they?

A

Two, tokens and structure

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

What are tokens in a formal language?

A

Basic elements of the language, such as words, numbers and chemical elements (for chemistry). For eg, + is a token in Maths and Fe is a token in chemistry (for iron).

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

Token syntax rule in a formal language

A

Have to contain only valid tokens in a statement. For example, $ is not a valid token in Maths, but + is.

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

Structure syntax rule in a formal language

A

Tokens has to be combined in a correct way. For eg - 3 + / 3 is incorrect because although + and / are correct tokens in Maths, they can’t be immediately after one another.

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

Parsing

A

A process of analyzing a string of symbols, either in natural or formal languages, conforming to the rules of a formal grammar of the language by breaking it into parts

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

Difference between natural and formal language: Ambiguity

A

Natural -> Full of ambiguity, people deal with this by using contextual clues and other info
Formal -> Nearly or completely unambiguous, any statements has exactly one meaning regardless of context

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

Difference between natural and formal language: Redundancy

A

Natural -> Lots of redundancy and verbose because of ambiguity and to reduce misunderstandings
Formal -> Less redundant and more concise

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

Difference between natural and formal language: Literalness

A

Natural -> Full of idiom and metaphor, for eg - under the weather
Formal -> Mean exactly what they say

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

How can a computer program be understood and why?

A

Because the meaning of a computer program is unambiguous and literal, it can be understood entirely by analysis of the tokens and structure.

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

Difference between natural and formal language: Errors

A

Small errors in spelling and punctuation, which can be ok in a natural language, can make a big difference in a formal language.

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

What is a value in a program?

A

One of the basic things a program works with, like integer 39 or string “Hello”

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

What are types in a programming language?

A

A type is a category of values, like type ‘int’ for whole numbers (integers).

17
Q

What is exponentiation and what is the operator in python?

A

Raising a number to a power, like 2 to the power of 3 and in python, it is **.

18
Q

What is a program?

A

A sequence of instructions that specifies how to perform a computation

19
Q

Three types of computation

A

Mathematical, Symbolic and Graphical

20
Q

Example of Symbolic Computation

A

Searching and replacing text in a document

21
Q

Basic instructions of programming languages

A

Input, Output, Math, Conditional Execution, Repetition

22
Q

Examples of Input instruction

A

Get data from the keyboard, a file, the network, or some other device

23
Q

Examples of output instruction

A

Display data on the screen, save it in a file, send it over the network, etc.

24
Q

Examples of Math instruction

A

Perform basic mathematical operations like addition and multiplication

25
Examples of Conditional Execution instruction
Check for certain conditions and run the appropriate code
26
Examples of Repetition instruction
Perform some action repeatedly, usually with some variation
27
Is every program, including super complex ones, made up of only basic instructions? Explain.
Yes. You can think of programming as the process of breaking a large, complex task into smaller and smaller subtasks until the subtasks are simple enough to be performed with one of these basic instructions.
28
Meaning of Problem Solving
The ability to formulate problems, think creatively about solutions, and express a solution clearly and accurately
29
Thinking like a computer scientist is a combination of what?
It combines some of the best features of mathematics, engineering, and natural science.
30
Like mathematicians, what computer scientists do?
Like mathematicians, computer scientists use formal languages to denote ideas (specifically computations).
31
Like Engineers, what computer scientists do?
Like engineers, they design things, assembling components into systems and evaluating tradeoffs among alternatives.
32
Like Scientists, what computer scientists do?
Like scientists, they observe the behavior of complex systems, form hypotheses, and test predictions.
33
What is debugging?
Process of tracking down (and fixing) programming errors which are called bugs.
34
What is a operator?
A special symbol that represents a simple computation like addition, multiplication, or string concatenation
35
What is a prompt?
Characters displayed by the interpreter to indicate that it is ready to take input from the user
36
What is protability?
A property of a program that can run on more than one kind of computer
37
What is syntax?
The rules that govern the structure of a program