โ† All Picat Flashcard Decks

Data Structures and Types Flashcards

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

Read the first 7 Data Structures and Types flashcards as text
  1. What does `number(3.14)` return in Picat?

    Answer: true

    `number/1` succeeds for both integers and floats; 3.14 is a float and therefore a number.

  2. What does `integer(3.0)` evaluate to in Picat?

    Answer: false

    `integer/1` checks the type precisely; 3.0 is a float even though its value is whole, so it returns false.

  3. What does `round(3.7)` return in Picat?

    Answer: 4

    `round/1` rounds to the nearest integer; 3.7 rounds up to 4.

  4. What is the result of `X is 7 // 2` in Picat?

    Answer: 3

    The `//` operator performs integer division truncating toward zero; 7 // 2 = 3.

  5. Which function converts a number to its string representation in Picat?

    Answer: to_string(N)

    `to_string(N)` converts any Picat term, including numbers, to its string representation.

  6. What does `var(X)` return immediately before X is bound to any value?

    Answer: true

    `var/1` succeeds (returns true) when its argument is an unbound logic variable.

  7. In Picat, what does `nonvar(42)` return?

    Answer: true

    `nonvar(X)` succeeds when X is not an unbound variable; the integer 42 is fully bound, so it returns true.