Program Languages

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.

Order a Similar Paper HERE Order a Different Paper HERE

1. Of the languages we studied in class(c – imperative language, c++ – object oriented language, scheme – functional language, prolog – logical language) , which would you prefer for the following? Why?

a. A system to provide engineers with a set of mathematical tools that they can combine to solve complex problems

b. A control program for an external device connected through a serial port.


c. A program that can play a game of checkers against a human, using a board displayed on a screen and using a keyboard (or mouse) to move pieces.

2. How does operator overloading affect ease of reading or writing code? Explain

3. The following is a grammar for arithmetic expressions. E stands for expression, T for 

term and F for factor, “num” is number. Is it context free? Use it to derive the 

expression 2*(3+4)


E ::= E + T | T

T ::= T * F | F

F ::= num | ( E )

4. A loop that goes on forever (for example, while( x ) { x=some-function }, such that the function always sets x true) can be an annoying and hard to debug runtime error. Could we build a feature into a language that prevented such infinite loops? Should we do this?

5. What are “side effects”? Give an example of a function with side effects (state the language in which your example happens). Why do functional languages try to avoid side effects as much as possible?

6. The first versions of BASIC (Dartmouth Basic) had loops, if statements and goto’s, 

but no way to define or call functions or procedures – so recursive procedures could not 

be written. Was Dartmouth Basic Turing complete (that is, was it as powerful as a Turing 

Machine?) Why or why not?