1. Why was the slowness of interpretation of programs acceptable in the early 1950s?
2. Which language is considered the ancestor of COBOL and who designed it?
3. What are two reasons why Java is safer than C++
4. What are two languages whose use was mandated by the U.S. Dept. of Defense?
5. Which language first introduced the ability to reference a cross section of an array? (e.g., view the 3rd column of a matrix as a vector)
6. What was the main application of the SNOBOL language?
7. From which three languages did PL/I borrow many of its constructs?
8. Which language had its syntax described in BNF for the first time?
9. Which functional language has a syntax close to that of an imperative language?
10. Which was the first widely used language to do away with punched cards and paper tapes and to rely on an actual terminal?
<stmt> a statement
<expr> an expression
<const_expr> a constant expression
<exp> --> <exp> + <mulexp> | <mulexp>
<mulexp> --> <mulexp> * <divexp> | <divexp>
<divexp> --> <divexp> / <rootexp> | <rootexp>
<rootexp> --> ( <exp> ) | a | b | c | d
a. (10 points) Add to G a right-associative operator '%', whose precedence is between '+' and '*', thus obtaining a new grammar G'. b. (10 points) Add to G' a unary operator '#', whose precedence is the highest, thus obtaining a new grammar G''. c. (10 points) Modify G'' so that the '*' and the '/' operators have the same precendence and are both right-associative.
a = 3 * (b - 1) - 2 { a > 3 }
if (a != 3) a = 2*a - 1; else a -= 2; ; { a > 0 }
int foo (int *i) { *i *= 3; return 1; } void main () { int x = 5; x = x + foo (&x); if ((x++) || (foo (&x))) x+=10; printf("%d\n",x); }
What is the output of this program assuming:
a. (5 points) Left-to-right operand evaluation, short-circuited boolean expressions
b. (5 points) Left-to-right operand evaluation, non-short-circuited boolean expressions
c. (5 points) Right-to-left operand evaluation, short-circuited boolean expressions
d. (5 points) Right-to-left operand evaluation, non-short-circuited boolean expressions