1. Home
  2. Explore
  3. Computer Science
  4. Programming Paradigms

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Programming Paradigms

  • 79Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Paradigm Foundations
Learning several programming languages can help separate a programming concept from the particular
used to express it.

79 questions

  1. 1
    Learning several programming languages can help separate a programming concept from the particular
    _____
    used to express it.
    Hint

    Think about what differs between languages even when they implement the same idea.

    Answer

    syntax

  2. 2
    The ability to recognize the same ideas appearing in different languages comes from understanding them at a
    _____
    level.
    Hint

    This level concerns what an idea means, rather than how it is written.

    Answer

    conceptual

  3. 3
    Conditions, collections, arithmetic, and loading and storing values are examples of ideas that recur across
    _____
    .
    Hint

    These concepts are not restricted to one programming system.

    Answer

    languages

  4. 4
    A language can be especially suitable for some problems and less suitable for others because programming languages have different
    _____
    .
    Hint

    Think about what makes one tool a better fit than another for a particular task.

    Answer

    strengths

  5. 5
    In the introductory course described, students solved the same problem in several languages to explore different programming
    _____
    .
    Hint

    These are broad approaches to organizing and expressing programs.

    Answer

    paradigms

  6. 6
    A paradigm in which instructions are generally written as one action followed by another is
    _____
    programming.
    Hint

    This style often reads like a sequence of steps.

    Answer

    procedural

  7. 7
    The idea that lets programmers apply a general concept without tying it to one language's syntax is an
    _____
    .
    Hint

    It captures an idea at a higher level than its particular implementation.

    Answer

    abstraction

  8. 8
    When a programmer can work productively in many programming languages, that person can be described as a
    _____
    .
    Hint

    The term is also used for someone who speaks many human languages.

    Answer

    polyglot

  9. 9
    In object-oriented programming, an object encapsulates
    _____
    and behavior.
    Hint

    This includes the information an object stores about itself.

    Answer

    state

  10. 10
    Fields, attributes, and instance variables are different names for data that represents an object's
    _____
    .
    Hint

    This is the information an object maintains internally.

    Answer

    state

  11. 11
    In an object, behavior is commonly implemented using
    _____
    .
    Hint

    These are operations that can be performed by or on an object.

    Answer

    methods

  12. 12
    In Ruby, an object refers to itself using the keyword
    _____
    .
    Hint

    This keyword can be used when an object modifies its own state.

    Answer

    self

  13. 13
    In Ruby, an object requests an operation from another object through
    _____
    passing.
    Hint

    The request can include a method name and arguments.

    Answer

    message

  14. 14
    An object is generally an instance of a
    _____
    .
    Hint

    This defines the structure or behavior from which objects are created.

    Answer

    class

  15. 15
    In Ruby, even the value false is an
    _____
    .
    Hint

    Ruby is described as a language in which everything belongs to this category.

    Answer

    object

  16. 16
    In the bank account example, the balance is kept as internal state so outside code cannot directly
    _____
    it.
    Hint

    The design prevents other code from assigning an arbitrary value to the balance.

    Answer

    set

  17. 17
    The Ruby declaration used to expose a read-only accessor for the bank account balance is
    _____
    .
    Hint

    Its name indicates that it provides a way to read an attribute.

    Answer

    attr_reader

  18. 18
    To avoid precision problems when representing money in code, the example stores it as an integer number of
    _____
    .
    Hint

    This represents money in whole units of the smallest common currency subdivision.

    Answer

    cents

  19. 19
    A bank account's deposit operation increases its balance, while its withdraw operation
    _____
    the balance.
    Hint

    Consider what happens to the account balance when money is taken out.

    Answer

    subtracts from

  20. 20
    Objects can model familiar things, such as a chair with a color attribute and behavior that can
    _____
    someone up.
    Hint

    This is an example of behavior associated with the real-world object.

    Answer

    hold

  21. 21
    Reusing standard-library objects such as arrays, hashes, and strings avoids repeatedly implementing common operations like array length; this is object
    _____
    .
    Hint

    The same established components can be applied in many programs.

    Answer

    reuse

  22. 22
    Object-oriented code can be tested by checking an object in isolation and then testing the
    _____
    between objects.
    Hint

    These are the points where separate components meet.

    Answer

    seams

  23. 23
    Pure functional programming avoids storing state and avoids
    _____
    the input data.
    Hint

    A function should not change the original data it receives.

    Answer

    mutating

  24. 24
    For a pure function, the output depends on the input rather than on the program's
    _____
    .
    Hint

    The same input should give the same result regardless of what happened earlier.

    Answer

    history

  25. 25
    Unlike object-oriented programming, functional programming treats data and procedures, or state and behavior, as
    _____
    .
    Hint

    They are not bundled together in a single object in the approach being described.

    Answer

    separate

  26. 26
    In Racket, an operation such as addition is written with the operator before its arguments, using
    _____
    notation.
    Hint

    The operator appears at the beginning of the expression.

    Answer

    prefix

  27. 27
    Prefix notation can apply an arithmetic operator to several arguments in one expression, rather than limiting it to
    _____
    arguments.
    Hint

    This is the number of operands typically used with an infix operator in the comparison.

    Answer

    two

  28. 28
    In nested prefix expressions, parentheses make the order of operations especially
    _____
    .
    Hint

    The grouping clearly shows which operations happen within other operations.

    Answer

    explicit

  29. 29
    In Racket, a function is declared using the keyword
    _____
    followed by its name, arguments, and body.
    Hint

    This keyword begins a definition.

    Answer

    define

  30. 30
    The Racket conditional construct used in the examples, and described as similar to Ruby's case statement, is
    _____
    .
    Hint

    Its name is short for conditional.

    Answer

    cond

  31. 31
    In Racket, the first element of a list can be obtained with
    _____
    , while the rest of the list can be obtained with cdr.
    Hint

    This traditional Lisp list operation corresponds to the head of a list.

    Answer

    car

  32. 32
    The Racket operation that combines an item with a list to form a new list is
    _____
    .
    Hint

    It can place one item at the front of an existing list.

    Answer

    cons

  33. 33
    In Racket, a quoted list is marked so the language treats it as data rather than trying to evaluate it as a
    _____
    call.
    Hint

    Without the quote, a parenthesized expression could be interpreted as an invocation.

    Answer

    function

  34. 34
    The factorial example uses recursion and returns 1 when its input is 1 or less; this is the
    _____
    case.
    Hint

    This case stops a recursive definition from continuing indefinitely.

    Answer

    base

  35. 35
    For an input greater than 1, the factorial example multiplies the input by the factorial of the input
    _____
    Hint

    Each recursive call moves toward the base case by reducing the input.

    Answer

    minus

  36. 36
    In the Fibonacci example, a positive input greater than 1 is handled by summing the previous two Fibonacci
    _____
    .
    Hint

    The recursive rule uses the results for the two immediately smaller positions.

    Answer

    numbers

  37. 37
    Because pure functional programs do not share mutable memory, they avoid many concurrency concerns such as needing to
    _____
    tables.
    Hint

    This action is often used to control access to shared mutable resources.

    Answer

    lock

  38. 38
    For a pure function, automated tests can focus on supplying input and checking output without first arranging the state of an underlying
    _____
    .
    Hint

    This is the stateful component that an object-oriented test might need to prepare.

    Answer

    object

  39. 39
    Prolog is based on formal
    _____
    , using ideas such as facts, implications, and relationships.
    Hint

    It is the field that studies valid reasoning and propositions.

    Answer

    logic

  40. 40
    Instead of describing how to solve a problem step by step, Prolog describes
    _____
    about the situation.
    Hint

    This contrasts with specifying the procedure or sequence of actions.

    Answer

    what

  41. 41
    Prolog programs are made up of facts and
    _____
    rather than conventional instruction sequences.
    Hint

    Rules are included in this category of statements.

    Answer

    clauses

  42. 42
    Prolog uses a capital initial letter to distinguish a
    _____
    from a constant.
    Hint

    It can be matched with a value that makes a rule or query true.

    Answer

    variable

  43. 43
    In the Prolog syntax described, a fact ends with a
    _____
    .
    Hint

    It is the punctuation mark used at the end of a sentence.

    Answer

    period

  44. 44
    A Prolog rule specifies a
    _____
    between facts.
    Hint

    For example, a rule can say that two places are adjacent when a border fact holds.

    Answer

    relationship

  45. 45
    Prolog tries to assign values to variables so that a query matches known facts; this process is called
    _____
    .
    Hint

    It finds values that fit a stated pattern.

    Answer

    pattern matching

  46. 46
    If Prolog knows only that Washington borders Oregon, a rule using that fact alone will not necessarily infer that Oregon borders Washington; the relationship must be made
    _____
    .
    Hint

    This property means the relationship works in both directions.

    Answer

    symmetric

  47. 47
    A Prolog query with a variable asks the system to find a value that makes the stated relationship
    _____
    .
    Hint

    The system searches for a value that satisfies the query.

    Answer

    true

  48. 48
    In the family facts example, the fact that Homer is Bart's father is written with Homer as the first argument and Bart as the
    _____
    argument.
    Hint

    The fact's argument order is father followed by child.

    Answer

    second

  49. 49
    The Prolog sibling rule requires that two people share a parent and are not the
    _____
    person.
    Hint

    This condition prevents someone from being classified as their own sibling.

    Answer

    same

  50. 50
    Prolog can answer questions in either direction, such as finding a parent from a child or finding a child from a parent; this is one of its major
    _____
    .
    Hint

    It is a capability that makes logic programs flexible.

    Answer

    strengths

  51. 51
    Prolog lists can contain different kinds of values and can also contain
    _____
    lists.
    Hint

    These are lists placed inside other lists.

    Answer

    nested

  52. 52
    In Prolog list pattern matching, bar notation separates the first element from the
    _____
    of the list.
    Hint

    This part corresponds to the cdr of a list in the Lisp terminology discussed.

    Answer

    rest

  53. 53
    In Prolog, the anonymous variable indicates that a value is unused or does not matter; it is called a “don't
    _____
    ” variable.
    Hint

    The phrase means that any value can occupy this position.

    Answer

    care

  54. 54
    The Prolog member rule checks whether an item is the first element of a list or is a member of the list's
    _____
    .
    Hint

    The recursive case searches the portion after the first element.

    Answer

    rest

  55. 55
    Unlike conventional functions, Prolog rules do not use a return statement; their inputs and results are represented through the rule's
    _____
    .
    Hint

    These are the values and variables listed in a rule's signature.

    Answer

    arguments

  56. 56
    Logic programming can solve a scheduling problem by expressing constraints on time and resources, then searching for a schedule that satisfies them; this is constraint
    _____
    .
    Hint

    It is the programming approach described alongside logic programming.

    Answer

    programming

  57. 57
    The assembly language example has two registers, A and
    _____
    .
    Hint

    This register's name comes from the word data.

    Answer

    D

  58. 58
    The D register is named for its role as the
    _____
    register.
    Hint

    Its name begins with the same letter as this function.

    Answer

    data

  59. 59
    The A register can hold a value or an address; when used to refer to the memory cell at that address, the notation
    _____
    is used.
    Hint

    This notation represents the memory location pointed to by A.

    Answer

    M

  60. 60
    The assembly example has no built-in operations for multiplication or
    _____
    .
    Hint

    This is the inverse arithmetic operation to multiplication.

    Answer

    division

  61. 61
    The assembly example supports bitwise NOT, bitwise AND, and bitwise
    _____
    .
    Hint

    This is the other common bitwise operation paired with AND.

    Answer

    OR

  62. 62
    Assembly computations can be assigned to registers or to
    _____
    .
    Hint

    This is where values can be stored beyond the two registers.

    Answer

    memory

  63. 63
    In the assembly example, the @ notation loads a constant into the
    _____
    register.
    Hint

    This register can also function as an address register.

    Answer

    A

  64. 64
    An assembly label names a program location that can be targeted by a
    _____
    .
    Hint

    This transfers execution to another point in the program.

    Answer

    jump

  65. 65
    In the example assembly, conditional jumps compare a value against
    _____
    rather than supporting arbitrary comparison values.
    Hint

    The jump conditions include greater than or equal to a fixed reference value.

    Answer

    zero

  66. 66
    The unconditional assembly jump is written
    _____
    .
    Hint

    Its name abbreviates the action of transferring program execution.

    Answer

    JMP

  67. 67
    The assembly loop sums values by storing a running total in an accumulator and repeatedly
    _____
    a counter.
    Hint

    The counter moves from five toward zero on each pass.

    Answer

    decrementing

  68. 68
    A procedural program typically expresses a sequence of actions such as doing one thing, then another, and then a final
    _____
    .
    Hint

    This describes the step-by-step structure of procedural code.

    Answer

    thing

  69. 69
    Procedural code is often easy to write because people naturally think in terms of ordered
    _____
    .
    Hint

    These are the actions in a sequence.

    Answer

    steps

  70. 70
    To make change, the cash-register algorithm subtracts the amount owed from the amount the customer
    _____
    .
    Hint

    This is the amount the customer gives the cashier.

    Answer

    tendered

  71. 71
    The change-drawer algorithms assume denominations are ordered from largest to
    _____
    .
    Hint

    The algorithm moves through the denominations in descending value.

    Answer

    smallest

  72. 72
    In the object-oriented change algorithm, the array that records which bills and coins to give the customer is the
    _____
    array.
    Hint

    Its name matches what the cashier gives back.

    Answer

    change

  73. 73
    When the current denomination is larger than the remaining change, the algorithm skips it by advancing to the next
    _____
    .
    Hint

    The next one in the ordered drawer is smaller.

    Answer

    denomination

  74. 74
    When a denomination can be used, the algorithm records it and subtracts its value from the remaining
    _____
    .
    Hint

    This is the amount of change still owed after using a bill or coin.

    Answer

    amount

  75. 75
    The Racket change function returns an empty list when the amount to make is
    _____
    .
    Hint

    No bills or coins are needed in this base case.

    Answer

    zero

  76. 76
    In the Racket change function, if no denominations remain while change is still needed, the function returns
    _____
    .
    Hint

    This result indicates that the available drawer cannot make the requested change.

    Answer

    false

  77. 77
    The Racket change function can skip a denomination that is too large by recursively trying the same amount with the
    _____
    denominations.
    Hint

    These are the denominations after the first one has been excluded.

    Answer

    remaining

  78. 78
    When the Racket change function uses a denomination, it recurses on the reduced amount while keeping the same denomination list, allowing that denomination to be used
    _____
    than once.
    Hint

    The next recursive call does not remove the selected denomination.

    Answer

    more

  79. 79
    The Prolog change rule uses three arguments: the amount, the available bills or coins, and the
    _____
    for making change.
    Hint

    This argument records which bills or coins are used.

    Answer

    result

1 of 79
Question 1 of 79

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent