Program languages | Computer Science homework help

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

Don't use plagiarized sources. Get Your Custom Essay on
Program languages | Computer Science homework help
Just from $13/Page
Order Essay

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? 

Calculator

Calculate the price of your paper

Total price:$26
Our features

We've got everything to become your favourite writing service

Need a better grade?
We've got you covered.

Order your paper