Picat Cheat Sheet 2026

The 30 highest-yield Picat facts, distilled from real exam questions. Print it, save it as a PDF, or study it here — free, no sign-up.

145 questions
165 min time limit
31% to pass
  1. What does `spy(Predicate)` do in Picat? Sets a breakpoint on a specific predicate
  2. Silicon chips are mostly utilized in integrated circuits
  3. What predicate writes a term followed by a newline to standard output in Picat? writeln(T)
  4. Friendly most of the time Friendly
  5. Which predicate reads a full line from standard input in Picat? read_line(L)
  6. What does the second argument in `error(ErrorTerm, Context)` provide in Picat? Context information about where the error occurred
  7. A Picat script needs to be executed from the command line with several arguments. How can the script access these arguments? By calling `sys:get_args()`
  8. How do you generate the 7-times multiplication table (7×1 through 7×10) as a list using a Picat list comprehension? [7*X : X in 1..10]
  9. Which operator concatenates two strings or lists in Picat? S1 ++ S2
  10. To execute an external command-line program (e.g., `ls -l` or `dir`) from within a Picat script and capture its output, which predicate is most suitable? os:shell(Command, Output)
  11. How does Picat handle a call to a function for which no pattern-matching rule applies? The call raises an exception and terminates the program.
  12. What is the correct Picat syntax for a list comprehension that collects all elements X from list L where X > 0? [X : X in L, X > 0]
  13. How many elements does [X : X in 1..5, Y in 1..5, X =:= Y] produce in Picat? 5 (one element for each pair where X equals Y)
  14. Of the following, which one is NOT a fruit? Carrots
  15. Which of the following imperative constructs in Picat is used to mark the end of a block for loops (`while`, `foreach`) and conditionals (`if-then-else`)? end
  16. Ascorbic acid is referred to as Vitamin A
  17. How do you close a file stream after I/O operations in Picat? close(Stream)
  18. Which of the following Picat code snippets will result in an instantiation error? main => while (N > 0) N := N - 1 end, println(N).
  19. What is the core mechanism within Picat's planner module that prevents infinite loops when searching a state space that contains cycles? The automatic tabling of every state encountered during the search.
  20. Any celestial body revolving around a massive body is referred to as A satellite
  21. How do you re-throw a caught exception from inside a handler in Picat? throw(Error)
  22. A developer needs to read the entire content of a text file named `config.txt` into a single string. Which function from the `io` module should be used? io:read_file_to_string("config.txt")
  23. How can you write a catch clause that matches any exception regardless of type in Picat? catch(Goal, _, Handler)
  24. What an anemometer measures Wind Speed
  25. Which of the following demonstrates using a Picat list comprehension with a built-in aggregate operation? sum([X : X in 1..100, X mod 2 =:= 0]) computes the sum of all even numbers from 1 to 100
  26. A vector can be used to represent force. A vector is indicative of Magnitude and Direction
  27. What happens if no `catch` clause matches a thrown exception in Picat? The exception propagates up the call stack
  28. Parity almost exactly entails Equality
  29. How does Picat handle multiple generators in [X+Y : X in [1,2], Y in [10,20]]? It computes the Cartesian product, yielding [11, 21, 12, 22]
  30. What does `split(Str, Sep)` return in Picat? A list of substrings split by Sep
Turn these facts into recall: