Unit 1 Flashcards

1
Q

What are the five deep questions in computing identified by Jeannette Wing?

A
  1. What is computable?
  2. P = NP?
  3. What is intelligence?
  4. What is information?
  5. How can we build complex systems simply?
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are measures of goodness in computational thinking?

A
  • Usability
  • Modifiability
  • Maintainability
  • Cost
  • Beauty
  • Elegance
  • Correctness
  • Efficiency
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What defines a computational problem?

A

A problem is computational if it can be expressed sufficiently precisely that it is possible to attempt to build an algorithm to solve it.

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

What defines a computational thinker?

A

A computational thinker has the skills to:

  1. Formulate a problem as a computational problem
  2. Construct a good computational solution for the problem, or explain why there is no such solution
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the drivers of computing?

A
  1. Technology
  2. Society
  3. Science
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What would be the result of typing the following into a Python interactive shell?

>>> a = [1, 2, 3, 4, 5]

>>> b = [‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’]

>>> x = a[:3]

>>> y = b[4:]

>>> z = b[::2]

A

x references [1, 2, 3]

y references [‘e’, ‘f’]

z references [‘a’, ‘c’, ‘e’]

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

True or False:

A trade-off between resources such as memory and execution time is often necessary when deciding which algorithm is best for a given task.

A

True

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

What are important factors when designing algorithms?

A
  • Simplicity
  • Correctness
  • Speed
  • Accuracy
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Complete this computational thinking diagram:

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

Complete this computational thinking diagram:

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

What is an algorithm?

A

An algorithm consists of a precisely stated, step-by-step list of instructions.

A problem is computable if it is possible to build an algorithm which solves any instance of the problem in a finite number of steps.

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

What is an effective procedure?

A

An effective procedure must terminate and must also solve every instance of that problem.

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

What is encapsulation?

A

Encapsulation is about hiding details of an implementation from users to manage complexity.

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

In computing, will a hierarchy of layers always eventually bottom out at a layer consisting of electronic components?

A

No.

Electronic components are not the only physical substrate from which computers can be built.

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

What are the two kinds of abstraction, and how are they different?

A

Abstraction as modelling is the relationship between a part of reality and a model which represents the interest of this reality.

Abstraction as encapsulation is the relationship between a layer that implements the model (the implementation) and a layer through which users interact with the model (the interface).

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

Rules of Blackjack:

  • Blackjack is played with a dealer and one player
  • Aim of the game is to get a higher hand than the dealer without going over 21 (going bust)
  • The player can ask repeatedly for another card to be dealt until they either go bust or decide to stop.
  • If the player goes bust, the dealer wins.
  • If the player does not go bust, the dealer must deal themselves cards until the value of their hand is more than 17, at which point the dealer stops dealing.
  • If the dealer goes bust, the player wins.
  • If the dealer does not go bust, whomever has the highest value wins.
  • If both the dealer and the player have the same value, the dealer wins.
  • You can assume the pack contains 52 cards, which will not run out, and that both dealer and player have been dealt 2 cards each at the start of the algorithm.
  • The algorithm should continue dealing cards until the dealer or the player wins the game.

Complete the following algorithm template for dealing out and playing a hand of Blackjack:

  1. if __________
  2. then
  3. deal the player a card
  4. if __________
  5. then
  6. finish: the dealer wins
  7. __________
  8. if the dealer’s hand value is
  9. then
  10. deal the dealer a card
  11. if the dealer’s hand value is > 21
  12. then
  13. __________
  14. __________
  15. if __________
  16. then
  17. finish: the dealer wins
  18. else
  19. finish: the player wins

Use the following phrases to fill in the blanks:

  • finish: the dealer wins
  • finish: the player wins
  • go back to step 1
  • go back to step 8
  • the player asks for a card
  • the dealer’s hand value is > 21
  • the player’s hand value is > 21
  • the dealer’s hand value is >= the player’s hand value
A
  1. if the player asks for a card
  2. then
  3. deal the player a card
  4. if the player’s hand value is > 21
  5. then
  6. finish: the dealer wins
  7. go back to step 1
  8. if the dealer’s hand value is
  9. then
  10. deal the dealer a card
  11. if the dealer’s hand value is > 21
  12. then
  13. finish: the player wins
  14. go back to step 8
  15. if the dealer’s hand value is >= player’s hand value
  16. then
  17. finish: the dealer wins
  18. else
  19. finish: the player wins
17
Q

When is a problem computable?

What is a computational problem?

A

A problem is computable if it is possible to build an algorithm that solves every instance of the problem that might arise in a finite number of steps.

A computational problem is one that is expressed sufficiently precisely that it is possible to attempt to build an algorithm to solve it.

18
Q

What is a computational problem?

When is a problem computable?

A

A computational problem is one that is expressed sufficiently precisely that it is possible to attempt to build an algorithm to solve it.

A problem is computable if it is possible to build an algorithm that solves every instance of the problem that might arise in a finite number of steps.

19
Q

What is an abstract data type (ADT)?

A

An abstract data type (ADT) is a logical description of the data used to solve a problem.

The ADT provides an encapsulation of the data by providing an interface with which the user interacts.

The ADT allows us to develop an algorithm without being concerned with the particular implementation of the underlying data structure.

20
Q

What is a data structure?

A

A data structure provides the physical description of the data being used (a list, a table, etc.).

The data structure is encapsulated by an ADT, which defines a set of operations which can be carried out on the data.

21
Q

What is a decision problem?

A

A decision problem is a problem stated in a formal language (usually logic or mathematics) for which the answer is yes or no.

22
Q

What is a decidable problem?

A

A decidable problem is a decision problem that is computable.

23
Q

What is an algorithm?

A

An algorithm is a finite process consisting of a step-by-step list of instructions that should solve any instance of the problem that might arise.

24
Q

What is computational thinking?

A

Computational thinking is the skill of understanding and reasoning about algorithms and data structures.

25
Q

What are the measures of goodness in computational thinking?

A
  1. Cost
  2. Efficiency
  3. Maintainability
  4. Correctness
  5. Elegance
  6. Modifiability
  7. Usability
  8. Beauty
26
Q

What does iteration mean?

A

Iteration (also called looping or repitition) means the algorithm repeats a group of steps (the body of the loop) some number of times depending on a condition which is tested before each repitition.

27
Q

What does selection mean?

A

Selection (also known as branching) is when part of an algorithm follows different paths depending on some condition.

28
Q

Complete this diagrammatic representation of abstraction as modelling:

A
29
Q

Complete this diagrammatic representation of abstraction as modelling:

A
30
Q

Complete this diagrammatic representation of abstraction as encapsulation:

A
31
Q

Complete this diagrammatic representation of abstraction as encapsulation:

A