Wednesday, December 16, 2015

Clojure test answers of 2016.

Find Complete and recently updated Correct Question and answers of Clojure. All Answers updated regularly with new questions. Upwork Clojure test answers of 2016.



Question:* What is Clojure a dialect of?

Answer: • Lisp

Question:* True or False? Clojure is NOT an imperative language.

Answer: • True

Question:* Vars _____

Answer: • provide thread-local variable bindings

Question:* In many object-oriented languages, ________________ is a way to decouple a class from other objects upon which that class depends.

Answer: • dependency injection

Question:* True or False? Metadata is data about data, and has no effect on the 'host' data.

Answer: • True

Question:* ________ evaluates all of the expressions provided to it in order and yields the last expression's value as its value.

Answer: • do

Question:* True or False? Clojure a functional language.

Answer: • True

Question:* What is the syntax of the "if" function?

Answer: • (if condition then-expr else-expr)

Question:* Which is an example of a Clojure function call?

Answer: • (function-name arg1 arg2 arg3)

Question:* Which of the following Clojure fragments calculates (4+2)*(5-3)?

Answer: • (* (+ 4 2) (- 5 3))

Question:* What is significant about function names that end with a "!"?

Answer: • It is a convention that indicates the function mutates some state.

Question:* A function can be stored in a var or passed as an argument to other functions.

Answer: • True

Question:* In Clojure, you can create a new class using _____

Answer: • All of the above

Question:* Clojure strings are Java Strings and are represented in exactly the same way, delimited by double quotes.

Answer: • True

Question:* Which is a type of collection in Clojure?

Answer: • All of these

Question:* True or False? Sets are collections of unique items. They are better than lists and vectors when duplicates aren't allowed.

Answer: • True

Question:* Which statement best describes protocols in Clojure?

Answer: • A protocol defines an interface. But unlike Java interfaces, which must be specified when a class is created, protocols can be attached to a class at any time.

Question:* What is the function that evaluates a single argument form?

Answer: • eval

Question:* True or False? Arity is the number of arguments a function can handle.

Answer: • True

Question:* Leiningen uses _____ to locate and manage project dependencies

Answer: • Maven

Question:* Clojure documentation can be accessed

Answer: • All of the above

Question:* What does the REPL tool do?

Answer: • Read-eval-print loop

Question:* Which of the following code fragments evaluates to 5?

Answer: • All of the above

Question:* Clojure is hosted on the JVM (Java Virtual Machine) and can use any Java library.

Answer: • True

Question:* True or False? In Clojure a symbol can contain characters that most imperative languages don't allow in variable names. (Example: in Clojure you can have a symbol with the name +a-.)

Answer: • True

Question:* What does the "contains?" function work on?

Answer: • All of these

Question:* Does Clojure have a metadata system that allows for annotation of symbols and collections?

Answer: • True

Question:* True or False? Clojure programs only support some Java classes and interfaces.

Answer: • False

Question:* To calculate the average of some numbers in Clojure, your code would look like this:

Answer: • (defn average [numbers] (/ (apply + numbers) (count numbers)))

Question:* True or False? The Clojure language is homoiconic.

Answer: • True

Question:* Collections that classically support last-in, first-out (LIFO) semantics are called ____________.

Answer: • stacks

Question:* What type does the following code result in? {:a 1 "b" 2}

Answer: • Map

Question:* Which statement about Clojure macros is true?

Answer: • Macros allow programmers to specify program transformations that occur during compile time.

Question:* The reduce function is used to _____

Answer: • aggregate the elements in a collection using a given function and return the result as a single value

Question:* lib-noir, Ring, and Compojure are all examples of Clojure:

Answer: • HTTP service modules

Question:* How do you create an anonymous function?

Answer: • #(single-expression)

Question:* :foo is an example of a(n) _____

Answer: • keyword

Question:* How do you add metadata to a symbol or collection?

Answer: • ^{key-value-pairs} object

Question:* What are sequences?

Answer: • Logical views of collections

Question:* What do keywords begin with?

Answer: • :

Question:* The following code will evaluate to true? (defn +++ [n] (+ (inc n) 1)) (= (+++ 1) 3)

Answer: • True

Question:* The two comment types that are defined by the reader are:

Answer: • Single-line comments and Form-level comments

Question:* REPL stands for _____

Answer: • Read, Eval, Print, Loop

Question:* If you are already using Java or another JVM language for RDBMS work, it’s likely that you’re using ______________, easily the most popular Java object/ relational mapping library.

Answer: • Hibernate

Question:* The map function is used to _____

Answer: • apply a function to all elements in a collection and return a sequence of the results

Question:* A built-in Clojure "operation" may be implemented as a...

Answer: • All of these

Question:* STM stands for _____

Answer: • Software Transactional Memory

Question:* Stack abstraction is supported in Clojure via what three operations?

Answer: • conj, pop, peek

Question:* What are the 3 phases Clojure code is processed in?

Answer: • Read-time, compile-time, run-time

Question:* Clojure provides several "persistent" data structures. Objects of these classes are _____

Answer: • immutable

Question:* Clojure is primarily an imperative language.

Answer: • False

Question:* How would you want to create a new Atom with an initial value <value>?

Answer: • (atom <value>)

Question:* What type does the following code result in? [1 2 3 4]

Answer: • Vector

Question:* A(n) ________ is a named Emacs object that represents something editable, usually a file in your filesystem, but also the Clojure REPL or debugger, for example.

Answer: • Buffer

Question:* What is the literal syntax for maps?

Answer: • {:a 1 :b 2}

Question:* True or False? A lazy-sequence can hold all the possible calculations of the Fibonacci sequence.

Answer: • True

Question:* A multimethod is created using a ________form, and implementations of a multimethod are provided by ___________ form.

Answer: • defmulti, defmethod

Question:* We can use _____________ to create a table with a specific name and define columns.

Answer: • create-table

Question:* Which statement about -> and comp is true?

Answer: • -> is a macro while comp is a higher order function

Question:* What is generally the first step in deploying your Clojure web application?

Answer: • Installing and configuring Leiningen or setting up and configuring an app server.

Question:* What is the conventional first and last character used to name vars intended to be bound to new, thread-local values?

Answer: • *

Question:* What's a difference between quote (') and syntax-quote (`) macro characters?

Answer: • Syntax-quote (`) fully qualifies symbols, while quote (') doesn't

Question:* (= (map + '(1 2 3)) 3)

Answer: • False

Question:* True or False? Function definitions must appear before they're first used.

Answer: • True

Question:* Which statement regarding Clojure "forms" is true?

Answer: • Every function call is a form, but not every form is a function call.

Question:* ________ is a very low-level looping and recursion operation that is usually not necessary.

Answer: • recur

Question:* Locks _____

Answer: • are a low-level construct that should be avoided in most cases

Question:* In Clojure >= 1.3, which of these follows the naming conventions for dynamic objects? (def ^:dynamic *d* (atom [])) (def ^:dynamic d (atom []))

Answer: • *d*, but not d

Question:* To represent a boxed decimal in Clojure, you would use ____________.

Answer: • java.lang.Double

Question:* To represent a boxed decimal in Clojure, you would use ____________.

Answer: • java.lang.Double

Question:* In Clojure, tail-call optimization is _____

Answer: • not supported natively by the compiler, but could be simulated using thunks, trampolines, and macros.

Question:* You can use ___________ whenever you like if you need a unique symbol, but its primary role is in helping us write hygienic macros.

Answer: • gensym

Question:* For the following code to evaluate without error, what needs to be added? (def regex "<a>(.*)</a>") (re-seq regex "<a>Ryan Kelker</a>")

Answer: • # symbol before the string in regex

Question:* let is a _____

Answer: • Special Form

Question:* Suppose you want to implement a set of mutually-recursive functions. Which approach might you take?

Answer: • Define the functions using letfn

Question:* True or False? (reset!) is used to set the value of an atom.

Answer: • True

Question:* Agents _____

Answer: • manage independent, asynchronous changes to a single location

Question:* What provides synchronous changes to a single piece of shared data?

Answer: • Atoms

Question:* What provides synchronous changes to a single, thread-local value?

Answer: • Var

Question:* True or False? In functional oriented languages, you can't manipulate objects like in object oriented languages.

Answer: • False

Question:* (.split "Java String" " ") returns

Answer: • A Java array of strings

Question:* If you want to create class that extends another class, you must use _____

Answer: • gen-class

Question:* The application of advice or other aspect transformations is often called __________.

Answer: • weaving

Question:* A "dynamic" var _____

Answer: • has a value that is related to the call stack, and can be used to pass contextual information between functions that do not call each other directly

Question:* Atoms _____

Answer: • manage independent, synchronous changes to a single location

Question:* A _______ is a construct that suspends some body of code, evaluating it upon demand, when it is "deref"erenced.

Answer: • delay

Question:* Refs _____

Answer: • provide thread-isolated transactions

Question:* The Clojure reader can be extended using _____

Answer: • tagged literals

Question:* What is the Closure equivalent to ClassName.class in Java?

Answer: • ClassName

Question:* What's the value returned by... (let [[x y [z]] [2 4 [8 9]]] (list x y z))

Answer: • (2 4 8)

Question:* A Clojure sequence is a Java

Answer: • Iterator

Question:* How many ways can you safely share mutable data using Clojure?

Answer: • 3

Question:* (letfn [ (t [] (true? (some true? ["false"])))] (t))

Answer: • False because the string "false" is not the value true



No comments:

HTML5 Upwork (oDesk) TEST ANSWERS 2022

HTML5 Upwork (oDesk) TEST ANSWERS 2022 Question: Which of the following is the best method to detect HTML5 Canvas support in web br...

Disqus for upwork test answers