InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
How Do I Fetch Web Pages And Make Http Requests? |
|
Answer» For the simple case of GETing a document into a string you can simply pass a URL to clojure.contrib.duck-streams/SLURP*: (use 'clojure.contrib.duck-streams) (slurp* "http://www.example.org/") ;; ⇒ "<HTML>rn<HEAD>rn <TITLE>Example WEB Page</TITLE> For more advanced usage, including other request types like POST you MAY find the clojure-http-client LIBRARY useful. FINALLY you can of course use (.openConnection) on a Java URL object directly. For the simple case of GETing a document into a string you can simply pass a URL to clojure.contrib.duck-streams/slurp*: (use 'clojure.contrib.duck-streams) (slurp* "http://www.example.org/") ;; ⇒ "<HTML>rn<HEAD>rn <TITLE>Example Web Page</TITLE> For more advanced usage, including other request types like POST you may find the clojure-http-client library useful. Finally you can of course use (.openConnection) on a Java URL object directly. |
|
| 2. |
Where Does Swank-clojure (slime) Look For Clojure's Jars? |
|
Answer» When you start it with M-x slime, it will ADD all jars under CHECK ~/.clojure and ~/.swank-clojure to your CLASSPATH. You will need at LEAST clojure.jar, clojure-contrib.jar and swank-clojure.jar. You can DOWNLOAD pre-built Clojure and Contrib jars from build.clojure.org and swank-clojure.jar from Clojars. When you start it with M-x slime, it will add all jars under check ~/.clojure and ~/.swank-clojure to your classpath. You will need at least clojure.jar, clojure-contrib.jar and swank-clojure.jar. You can download pre-built Clojure and Contrib jars from build.clojure.org and swank-clojure.jar from Clojars. |
|
| 3. |
What Versions Of Java Are Supported? |
|
Answer» CLOJURE currently TARGETS JAVA 5 (and later versions). Clojure currently targets Java 5 (and later versions). |
|
| 4. |
What Versions Of Java Have Been Tested? |
|
Answer» Clojure 1.0 and 1.1 are both routinely used by many people on VARIOUS VERSIONS of: OpenJDK 1.5.0 and 1.6.0 IBM J9 It is also known to run on: JamVM with Classpath Clojure 1.0 and 1.1 are both routinely used by many people on various versions of: Sun's JRE 1.5.0 and 1.6.0 OpenJDK 1.5.0 and 1.6.0 IBM J9 It is also known to run on: JamVM with Classpath |
|
| 5. |
How To Create Your First Project? |
|
Answer» Create your first Clojure program and looks like- lein NEW app my-proj CD my-proj # Have a look at the "-main" FUNCTION in src/my proj/core.clj. lein RUN Create your first Clojure program and looks like- lein new app my-proj cd my-proj # Have a look at the "-main" function in src/my proj/core.clj. lein run |
|
| 6. |
Does It Have A Build Automation System? |
|
Answer» It helps DEVELOPERS to scaffold new projects, RESOLVE DEPENDENCIES, RUN tests, etc. It helps developers to scaffold new projects, resolve dependencies, run tests, etc. |
|
| 7. |
How Do I Create A Clojure Project? |
|
Answer» You can USE Leiningen to generate the SCAFFOLDING of a new Clojure application- lein new APP project_name Generating a project called “project-name” and it’s based on the “app” TEMPLATE. You can use Leiningen to generate the scaffolding of a new Clojure application- lein new app project_name Generating a project called “project-name” and it’s based on the “app” template. |
|
| 8. |
How To Run Clojure? |
|
Answer» Local build - GIT clone https://github.com/clojure/clojure.git cd clojure ./antsetup.sh ANT local Then start the REPL with the local JAR - java -jar clojure.jar Try Clojure online - Provides a BROWSER based Clojure repl for INTERACTIVE exploration. Local build - git clone https://github.com/clojure/clojure.git cd clojure ./antsetup.sh ant local Then start the REPL with the local jar - java -jar clojure.jar Try Clojure online - Provides a browser based Clojure repl for interactive exploration. |
|
| 9. |
What Are The Languages Fundamentals? |
| Answer» | |
| 10. |
Why Clojure? |
|
Answer» CLOJURE is open SOURCE, DYNAMIC type SYSTEM and general PURPOSE programming language. Clojure is open source, dynamic type system and general purpose programming language. |
|
| 11. |
What Is Clojure? |
|
Answer» Clojure is a Lisp family LANGUAGE, open source, dynamic type system and general purpose PROGRAMMING language developed for the Java Virtual Machine (JVM) and created by RICH Hickey. Clojure is a compiled language. Clojure is a dialect of Lisp and a POWERFUL macro system. Clojure is a wonderfully simple language and I HOPE you love it. Clojure is a Lisp family language, open source, dynamic type system and general purpose programming language developed for the Java Virtual Machine (JVM) and created by Rich Hickey. Clojure is a compiled language. Clojure is a dialect of Lisp and a powerful macro system. Clojure is a wonderfully simple language and I hope you love it. |
|