โ† All HACKERRANK Flashcard Decks

Built-in Functions and Lambdas Flashcards

7 cards from real HACKERRANK practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Built-in Functions and Lambdas flashcards as text
  1. What does `divmod(17, 5)` return?

    Answer: (3, 2)

    divmod returns a tuple of (quotient, remainder): 17 // 5 = 3 and 17 % 5 = 2.

  2. Which built-in function returns an object's memory address?

    Answer: id()

    id() returns the identity (memory address) of an object in CPython.

  3. What does `list(reversed([1,2,3,4]))` return?

    Answer: [4, 3, 2, 1]

    reversed() returns an iterator over the sequence in reverse order; list() materializes it.

  4. What is the output of `pow(2, 10)`?

    Answer: 1024

    pow(2, 10) computes 2 raised to the power 10, which is 1024.

  5. What does `hash('hello')` return in Python?

    Answer: An integer that may vary between runs

    hash() returns an integer, but Python randomizes string hashes by default, so the value may differ between runs.

  6. What does `callable(lambda x: x)` return?

    Answer: True

    callable() returns True for any object that implements __call__, including lambdas.

  7. What is the result of `list(map(lambda x: x.upper(), ['a', 'b', 'c']))`?

    Answer: ['A', 'B', 'C']

    map applies str.upper() via the lambda to each character, producing uppercase strings.