โ† All B.S.W.E. Bachelor of Software Engineering Flashcard Decks

Programming Languages & Paradigms Flashcards

7 cards from real B.S.W.E. Bachelor of Software Engineering practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Programming Languages & Paradigms flashcards as text
  1. What is polymorphism in object-oriented programming?

    Answer: The ability of different objects to respond to the same interface in different ways

    Polymorphism allows objects of different types to be treated through a common interface, with each type providing its own implementation of the expected behavior.

  2. What is tail call optimization (TCO)?

    Answer: An optimization that reuses the current stack frame for a call in tail position

    TCO allows the runtime to reuse the current stack frame when a function call is in tail position, preventing stack overflow in deeply recursive programs.

  3. Which language feature allows algorithms and data structures to be written in a type-independent manner?

    Answer: Generics (parametric polymorphism)

    Generics let programmers write type-independent code that can operate on any specified type, as seen in Java's ArrayList or C++ templates.

  4. What is a higher-order function?

    Answer: A function that takes other functions as arguments or returns a function as a result

    Higher-order functions treat functions as first-class values, enabling them to accept functions as parameters or return functions as output.

  5. What is the key distinction between pass-by-value and pass-by-reference parameter passing?

    Answer: Pass-by-value passes a copy of the data; pass-by-reference passes the memory address of the data

    Pass-by-value gives the function a copy of the data so the original is unaffected, while pass-by-reference passes the address so the function can modify the original variable.

  6. In logic programming languages such as Prolog, what is the primary computational mechanism?

    Answer: Unification and backtracking over logical facts and rules

    Logic programming computes by unifying terms against a database of facts and rules, using backtracking to explore alternative solution paths when one path fails.

  7. What is 'duck typing' as used in dynamically typed languages?

    Answer: An approach where an object's suitability is determined by its methods and properties rather than its declared type

    Duck typing determines an object's compatibility based on whether it possesses the required methods or attributes, not based on its explicit type or class hierarchy.