PDA

View Full Version : Quiz


GnuVince
06-27-2002, 11:22 PM
I made this quiz for another forum. I thought you guys might want to try it:

1. What is the difference between a statement and an expression? Name
advantage or demonstrate an advantage of all-expression languages.

2. What is a garbage collector?

3. Explain some of the differences between dynamically-typed and
statically-typed languages (please don't start a flame war, as there
have been enough on that subject.) Bonus point for explaining strict
typing.

4. How does a debugger help find bugs?

5. What is a toplevel loop?

6. Name 3 differences between functional and procedural languages.

7. Find the bug in this program:

i = 0
while i < 100
print i
end


8. Explain the difference between prefix and infix operators.

9. Explain what recursion is. Bonus point for explaining tail-recursion.

10. Name 3 languages that start with the letter 'L'.

11. What was the first language to implement conditionals? Bonus point
if you tell me the name of the language designer.

12. Name a few differences between VHLL (Very-high level languages, e.g:
Python, Lisp, ML, Perl) and LLL (low level languages, e.g: Assembly,
C)

13. What adjective is used to describe code that is incomprehensible
(hint: starts with the letter 'o')

14. Associate each name with a language: Dennis Ritchie, Niklaus Wirth,
Don Woods (in association with James Lyons) and Larry Wall.

15. Which language is nicknamed the "Unix Swiss army's chainsaw"?


Bonus question: what is the name of the C compiler found on most Unix
systems and who wrote it?

Strike
06-28-2002, 09:22 AM
I'm assuming this is kind of a "do it on your own" thing, not really a "first to post answers wins" thing.

A quick comment though: on the bonus question, I am assuming you mean "true UNIX systems", and not including UNIX-like systems suchs as the BSDs and Linux (since, at the very least, those two types of systems use different compilers by default)

By the way, the answer to 13 is "Perl", which doesn't start with an "o" ;)

GnuVince
06-28-2002, 09:30 AM
Strike: Both answers accepted.

jemfinch
07-01-2002, 12:59 PM
Originally posted by GnuVince
1. What is the difference between a statement and an expression? Name
advantage or demonstrate an advantage of all-expression languages.


Expressions return values. Statements don't.


2. What is a garbage collector?


It collects unreferenced dynamically allocated data.


3. Explain some of the differences between dynamically-typed and
statically-typed languages (please don't start a flame war, as there
have been enough on that subject.) Bonus point for explaining strict
typing.


Strongly dynamically typed languages are just lazily evaluated strongly statically typed languages.


4. How does a debugger help find bugs?


It doesn't. Not for me, at least :)


5. What is a toplevel loop?


A place to input expressions. Note that you're asking a very ML-specific question: it's not called a "toplevel loop" in very many (if any) other languages. It's usually called a "REPL" -- "Read, Eval, Print Loop"


6. Name 3 differences between functional and procedural languages.


Um...Functional languages don't suck. They try not to use side effects. They tend to use immutable data structures.


7. Find the bug in this program:

i = 0
while i < 100
print i
end



You don't increment i.


8. Explain the difference between prefix and infix operators.


Prefix go before. Infix go between.

Postfix go after, but you didn't ask.


9. Explain what recursion is. Bonus point for explaining tail-recursion.


Recursion is a function calling itself. Tail recursion is a function calling itself as the last expression in the function.


10. Name 3 languages that start with the letter 'L'.


Lisp, Lua, and Logo.


11. What was the first language to implement conditionals? Bonus point
if you tell me the name of the language designer.


Lisp, and it was designed by McCarthy.


12. Name a few differences between VHLL (Very-high level languages, e.g:
Python, Lisp, ML, Perl) and LLL (low level languages, e.g: Assembly,
C)


My own personal differentiation point is memory allocation: if you have to allocate your own memory, it's a low level language.


13. What adjective is used to describe code that is incomprehensible
(hint: starts with the letter 'o')


Obfuscated.


14. Associate each name with a language: Dennis Ritchie, Niklaus Wirth,
Don Woods (in association with James Lyons) and Larry Wall.


C, Pascal/Modula, (don't know), Perl.


15. Which language is nicknamed the "Unix Swiss army's chainsaw"?


Perl, and it's only named that because so many people chainsaw off their limbs using it.


Bonus question: what is the name of the C compiler found on most Unix
systems and who wrote it?

CC. And in all likelihood, it's not the same compiler written by Kernighan.

Jeremy, "yes, all those answers came from off the top of my head" Fincher.

jemfinch
07-01-2002, 01:01 PM
Originally posted by Strike
A quick comment though: on the bonus question, I am assuming you mean "true UNIX systems", and not including UNIX-like systems suchs as the BSDs and Linux (since, at the very least, those two types of systems use different compilers by default)


BSD has more claim to be called "True UNIX" than almost any other *nix out there.

Jeremy

GnuVince
07-01-2002, 01:59 PM
Originally posted by jemfinch


Perl, and it's only named that because so many people chainsaw off their limbs using it.



Hahahahahaha!!!! :tu: Very good one!!!

By the way, Don Woods and James Lyons wrote Intercal

Dru Lee Parsec
07-01-2002, 02:26 PM
Associate each name with a language: ... Niklaus Wirth

I once read a coment by an author who was not very pleased with the Pascal language. It went something like this:

Q. How do you pronounce that name? Is it 'Nik-Oh-Las Wirth'? Or is it 'Nickles Worth'?

A. "I suppose it depends on if you're passing by reference, or passing by value"

</subtle humor>

vomjom
07-03-2002, 07:34 PM
6. Name 3 differences between functional and procedural languages.

It's never been very clear what the differences were outside of:
Procedural languages are written as a list of statements.
Everything in functional languages express a value.

They also have different names, but that's only two differences.

Functional languages often make use of rules and pattern matching, but it's not a requirement that FLs do so.


7. Find the bug in this program:

i = 0
while i < 100
print i
end


There is no bug. The intention of the program is quite unclear. I mean, you wouldn't be trying to print the numbers 0-99, because we all know an O'Caml fiend like yourself would do it tail-recursively :)

8. Explain the difference between prefix and infix operators.

Strike did enlighten me on the advantage of infix: the reader can follow along left-to-right. With prefix, if you forget the operation, you have to roll your eyes to find it. This is quite an important point, as the purpose of most functional languages is to be as expressive and easy-to-read as possible.


12. Name a few differences between VHLL (Very-high level languages, e.g:
Python, Lisp, ML, Perl) and LLL (low level languages, e.g: Assembly,
C)

Well, the most important difference IMHO is that the LLLs are very painful to program in. If you have ever experienced VHDL, you would know why I never program in sorta-LLLs anymore.


13. What adjective is used to describe code that is incomprehensible
(hint: starts with the letter 'o')

Objective, as in the objective in O'Caml

Just kidding :)

Dru Lee Parsec
07-03-2002, 07:58 PM
Also, in LLL (Low Level Languages) you need to understand the architecture of the CPU. For example, to code in assembler you need to know how many registers there are, how big are they, and so on. So in LLL you are seriously manipulating the CPU whereas in high level languages you can concern yourself with solving the problem.

x86 Assembler:

mov ax,4
mov bx,5
add ax,bx

high level language
x = 4 + 5;

[yes, this is a simplification but the point is still valid]

Strike
07-04-2002, 05:25 AM
Originally posted by jemfinch


BSD has more claim to be called "True UNIX" than almost any other *nix out there.

Jeremy

Actually, I'd say Tru64 Unix:
http://www.tru64unix.compaq.com/

phonetically, anyway.

Fighting pedantism with pedantism ;)

stuka
07-05-2002, 11:06 AM
Boy, I needed that laugh! And vomjom, I don't know WHAT you don't like about VHDL!