Posted: January 24th, 2023

Program Languages

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
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? 

Expert paper writers are just a few clicks away

Place an order in 3 easy steps. Takes less than 5 mins.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00

Order your essay today and save 20% with the discount code Newyr