Final Flashcards

1
Q

Imperative programming languages are based on a:

paradigm but functional programming languages are based on:

A

statement-at-a-time

mathematical functions

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

What Greek letter is often used to denote Scheme ? Why?

A

Greek letter L(lambda)

Essentially a lambda is a block of code that can be passed as an argument to a function call

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

Define referential transparency.

A

the evaluation of a function always produces the same result given the same parameters

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

Who developed LISP and when?

A

late 50s by John McCarthy

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

What data types were parts of the original LISP?

A

atoms and lists

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

What does the abbreviation REPL stand for?

A

read-evaluate-print loop

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

Is Scheme statically or dynamically scoped?

A

statically scoped

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

If Scheme were a pure functional language, could it include PRINT? Why or why not?

A

No, because there is no state change, it will return the same expression

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

What is tail recursion?

A

No operation to perform after recursive function. Returns recursive call directly

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

Imperative languages vs functional languages

A

imperative languages:
based on the von Neumann architecture In an imperative language, operations are done and the results are stored in variables for later use

functional languages:
based on mathematical functions variables are not necessary, as is the case in mathematics

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

Logic languages are declarative and imperative languages are procedural. Explain the difference between declarative ( nonprocedural ) and procedural

A

declarative: A computer language that does not require writing traditional programming logic
procedural: the use of code in a step-wise procedure to develop applications

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

Imperative languages are based on: paradigmfunctional languages are based on:
logic languages are based on:

A

statement-at-a-time

mathematical functions

formal logic

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

Resolution:

A

an inference principle that allows inferred propositions to be computed from given propositions

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

Unification:

A

finding values for variables in propositions that allows matching process to succeed

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

Instantiation:

A

assigning temporary values to variables to allow unification to succeed

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

Backtracking:

A

Begin search where previous search left offCan take lots of time and space because may find all possible proofs to every subgoal

17
Q

What are the forms of Horn clauses?

A

Headed: single atomic proposition on left side

Headless : empty left side (used to state facts)

18
Q

Antecedent:
Consequent:

A

the first half of a hypothetical proposition, whenever the if-clause precedes the then-clause

the second half of a hypothetical propositionIn the standard form of such a proposition, it is the part that follows then

19
Q

Another name for a query is a?

A

goal

20
Q

The process of proving a goal is called:

A

matching, satisfying or resolution

21
Q

forward chaining:

backward chaining:

A

Begin with facts and rules of database and attempt to find sequence that leads to goal. Works well with a large set of possibly correct answers

Begin with goal and attempt to find sequence that leads to set of facts in database. Works well with a small set of possibly correct answers

22
Q

Prolog implementations use _________ chaining

A

backward

23
Q

Explain the difference between a depth-first and a breadth-first search when discussing how multiple goals are satisfied.

Which approach does Prolog use?

A

Depth first: searchfind a complete proof for the first subgoal before working on others
Breadth-first search : work on all subgoals in parallel

Prolog uses depth-first search

24
Q

Explain what is wrong with the Prolog statement K is K + 1

A

The problem is that unification is not assignment is K + 1 will always fail for integers

25
Q

What is a list in Prolog?

A

simply a collection of terms

26
Q

What is an anonymous variable?

A

the underscore character means an anonymous variable- it means we do not care what instantiation it might get from unification

27
Q

What are the two ways a Prolog programmer can control the order of pattern matching during resolution

A

placement of rules in a database and by using the cut operator

28
Q

Explain the closed-world assumption used by Prolog

A

The only knowledge is what is in the database

29
Q

Explain the negation problem with Prolog

A

Negation in Prolog is implemented based on the use of cut. Actually , negation in Prolog is the so-called negation as failure , which means that to negate p one tries to prove p (just executing it), and if p is proved then its negation , not(p) , fails.

30
Q

Language domains:

A
Scientific 
Business 
Education
Artificial 
Intelligence 
Web
31
Q

Language paradigms:

A
Imperative 
Functional 
Declarative 
Object oriented 
Procedural 
Logic 
Symbolic
32
Q

Language implementation

A

Compiled
Interpreted
Hybrid