PKD week 2 questions

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/6

encourage image

There's no tags or description

Looks like no tags are added yet.

7 Terms

1
New cards

What are the conditions that a variant must fulfill?

Non negative integer

Decrease on every recursive call, stay non negative

2
New cards

For which functions do we specify a variant and why?

Recursive functions and loops, to show that it always terminates

3
New cards

What is the difference between a conditional expression and a conditional statement?

Conditional expressions produces a value

Conditional statements decide which block of code to run (If else…)

4
New cards

What is the difference between a higher-order function and a function that is not higher-order?

Higher-order functions manipulate functions. It takes functions as parameters or return functions. A “normal” function doesn't take functions as parameters and doesn’t return functions.

5
New cards

What is the difference between a lambda expression and a "regular" function?

A regular function has a keyword and name. A lambda function only consists of parameters, a “=>” sign and an expression that automatically returns.

6
New cards

What is the scope of a variable?

The “domain” of the variable, the blocks in which the variable can be called in.

7
New cards

Explain one strategy for isolating a bug, e.g. to create a minimal test that reproduces it.

Cutting out all other lines except the ones that lead to the problem