






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Does Python provide object-oriented programming? - correct answer ✔✔Yes (Python) Object creation syntax - correct answer ✔✔my Foo = Foo() (Python) What are the permissions associated with variables defined outside a class - correct answer ✔✔Can be accessed by any object of class. Essentially class variables. (Python) What is the constructor for a class - correct answer ✔✔init (Python) How to create local variables for a class object? - correct answer ✔✔Declare inside the constructor as self.variable_name (Python) How to call parent constructor? - correct answer ✔✔Parent_name.init(self) (Python) What will class Foo (Baz) inherit? - correct answer ✔✔Methods and class variables (Python) How to inherit instance variables from parent class? - correct answer ✔✔child init must call parent init (Python) Can class/structure definitions be modified at run-time? - correct answer ✔✔Yes (Python) How do you declare something as private/protected? - correct answer ✔✔Trick question. You can't (Python) What is the "convention" for indicating a variable is meant to be used privately? - correct answer ✔✔preface variable name with leading underscore
What happens if dynamic memory allocation is not reclaimed? - correct answer ✔✔Memory leak How does the "Mark and Sweep" algorithm work - correct answer ✔✔Start with the "root set" of live or active objects, consisting of global variables and variables/references on current call stack.
What does REPL stand for? - correct answer ✔✔Read Evaluate Print Loop How to print in Clojure - correct answer ✔✔(println content) (Clojure) What does a print statement return? - correct answer ✔✔nil Variable types in Clojure - correct answer ✔✔Integer, Float, String, Boolean, nil (=NULL) (Clojure) Bind name to value - correct answer ✔✔(def name value) Values are ___ to current namespace - correct answer ✔✔local (Clojure) Trivial Function - correct answer ✔✔(fn [paramlist] body) (Clojure) Named Function - correct answer ✔✔(defn name [paramlist] body) (Clojure) Where is the return value of a function located? - correct answer ✔✔last line of the function (Clojure) If form - correct answer ✔✔(if boolean-form then-form optional-else-form) (Clojure) What does Do do? (lol) - correct answer ✔✔allows a sequence of expressions to be defined in an if statement (Clojure) What does When do? - correct answer ✔✔combines if-do (Clojure) What are falsey values? - correct answer ✔✔nil and false (Clojure) What are truthy values - correct answer ✔✔everything except nil and false
(Clojure) What are the types of composite data structures? - correct answer ✔✔map, vector, list, set (Clojure) Map declaration - correct answer ✔✔-{"John" "professor" "Sue" "doctor" "Ahmed" "astronaut"}
(require [test.bar :as bar]) or (:require [test.bar :as bar :refer myFunc])) When was Erlang developed? - correct answer ✔✔1980s-1990s What relevant framework is based on the Erlang language? - correct answer ✔✔Akka concurrency framework How does Erlang run? - correct answer ✔✔Runs on top of BEAM virtual machine, run through command line shell Eshell (Erlang) What basic data types are there? - correct answer ✔✔int, float, strings What notation does Erlang use for expressions? - correct answer ✔✔infix (Erlang) Variables can only be assigned ___ and begin with what? - correct answer ✔✔once, begin with an uppercase letter (Erlang) When is a comma used? - correct answer ✔✔between function arguments and expressions in a function body (Erlang) When is a semi-colon used? - correct answer ✔✔between alternate forms or arities of a function (Erlang) When is a period used? - correct answer ✔✔terminate a complete expression (Erlang) What are the composite data types? - correct answer ✔✔Tuple, Lists, Records, Maps (Erlang) How to define a tuple? - correct answer ✔✔{person, "John Smith", 43}
{person, "John Smith", 43} {person, _ , Age What is Age now? - correct answer ✔✔ 43 (Erlang) How to define a list? - correct answer ✔✔[13, 25, {person, "john", 43}] (Erlang) What is the head and tail of a list - correct answer ✔✔head: first element tail: everything else (Erlang) What is a record? - correct answer ✔✔like a tuple but has labels associated with values (Erlang) How to declare a record? - correct answer ✔✔-record (name, { key1=val1, key2=val2, ... key3, ... }). (Erlang) How to import a record? - correct answer ✔✔-include("person.hrl"). (Erlang) How to declare a map? - correct answer ✔✔M1 = #{man => "joe", woman => "sue") (Erlang) How to declare a function? - correct answer ✔✔func_name (parm1, parm2, ...parmN) -> expression_1, expression_2, ... expression_N.
What are critical regions? - correct answer ✔✔block of code in which an update to shared data is made (Concurrency) What is a lock? - correct answer ✔✔variable that can be set to open/closed What is the modern CPU "test and swap" instruction? - correct answer ✔✔"wrapper" function for this instruction so language libraries can provide reliable application locks (Concurrency) Deadlock - correct answer ✔✔thread A is waiting for a lock held by thread B while thread B is waiting on a lock held by thread A (application spends forever in this state) (Concurrency) Livelock - correct answer ✔✔threads spend a lot of time releasing locks to make them available for the other but in the meantime don't get much work done Message passing is ____, and it appends the message to the ____ which can be ____ at any time - correct answer ✔✔Message passing is asynchronous, simply appends the message to the queue which can be checked at any time (Erlang) What are the three elements of message passing? - correct answer ✔✔send, spawn, receive (Erlang) Spawn function syntax - correct answer ✔✔Pid = spawn (Mod, Func, Args) (Erlang) Send function syntax - correct answer ✔✔Pid! Message (Erlang) Receive function syntax? How does it work? - correct answer ✔✔listen() -> receive {dog, Name} -> "Mr" ++ Name; {cat, Name} -> "Ms" ++ Name end. recieve function that includes one or more patterns that can be matched against the message(s) that arrive in the process queue
(Erlang) What happens if a message is received but no match is found? - correct answer ✔✔message goes into "save" queue and can be checked again later (Erlang) How to do two-way communication? - correct answer ✔✔include the sender's process ID with the message so the sender can send a message back (Clojure) What are the reference data types? What do they do? - correct answer ✔✔atoms, agents, refs. They allow mutable state to be changed in a safe manner (Clojure) What is a Future? - correct answer ✔✔block of code that Clojure will schedule and run in a separate thread (Clojure) What is special about an Atom? - correct answer ✔✔modification is guaranteed to complete before any other process can access/update the same value. It is a BLOCKING operation. (Clojure) How to change value in an Atom? - correct answer ✔✔(swap! Atom update_function) or (reset! Atom new_value) (Clojure) What is an Agent? - correct answer ✔✔atomic references that are set and dereferenced with standard syntax but they are NON BLOCKING (Clojure) What is a transaction? - correct answer ✔✔set of related operations (multiple update queries processed simultaneously) (Closure) What is software transactional memory - correct answer ✔✔A concept borrowed from transactions. Defines a set of updates that must be performed atomically. Logically, this is a critical region protected by a lock. (Clojure) STM uses ____ protocol and what does it mean? - correct answer ✔✔· Uses optimistic protocol. Transactions do not wait to obtain a lock. Proceed directly, preform updates, and then when they are ready to commit, Clojure checks if any of their reference values have changed since the transaction began.