Review Problems for CS 125 Exam 1

These are review problems for the first exam. The problems from the in class exam will be very similar. Try to do these problems without the use of Maple, since you will not have Maple available to use during the in class exam.

You can print these problems out by using the "File -> Print..." menu of Netscape.

Problem 1:
How many different values can the following expressions take on if parentheses are added?
2*3+4/5
2^3^4+5

Problem 2:
In Maple, what are the results of the following commands?
> Digits:=3:
> 1010 + 3;
> 1010 + 3.0;
> 51.3 + 1.05;

Problem 3:
In Maple, what is the output of the following command?
> a := 'a': subs( x=2, a*x+3*x^2 ); # those are right-quotes

Problem 4:
Exactly what commands would you type into Maple in order to find out how many terms are in the polynomial (x^4 + x^2 + 1 )^250? Briefly explain what steps your commands perform.

Problem 5:
In Maple, enter the commands
> x := 2: y := 3:
> z := 'x' + y: # Those are right-quotes.
> x := 4:
> z;
What is the output from the last command?

Problem 6:
Part (a): In Maple, what is the value of y if
> y := `2+2` + 2; # Those are left-quotes.
Part (b): In Maple, what is the value of y if
> y := '2+2' + 2; # Those are right-quotes.
Part (c): In Maple, what is the value of y if
> a := 2; b := 2: y := 'a+b' + 2; # Those are right-quotes.

Problem 7:
In Maple, what is the output of the following two commands?
> x := [ 1, [2, 3, 4], [5, [6,7]], 8, [9]]:
> op(2, op(3,x));

Problem 8:
In Maple, what is the output for each of the following commands?
> nops( [1, 2, [3, [4, 5]], 6, [7]] );
> nops( x^2-3*x+2 );

Problem 9:
In Maple, what is the output of the following command? Briefly explain what the command is doing.
> op( 2, op( 2, x^2+2*x^3+z ) );

Problem 10:
In Maple, if x is a list, describe what the following command does, and how it does it.
> x := [ seq( op(i,x), i=2 .. nops(x) ), op(1,x) ];

Problem 11:
In Maple, what is the output of the following command?
> seq( seq( i+j, i=1..2), j=3..4);

Problem 12:
Let f be the mathematical function defined by f(x,y) = (3y^2-5x)/(x+y).
Part (a): How would you define f to Maple as a Maple expression named g?
Part (b): How would you define f to Maple as a Maple function named h?
Part (c): How would you define f to Maple as a Maple procedure named k?

Problem 13:
Draw the expression tree for the Maple expression (x+y)/(3*y^2-5*x). What is op(2,op(1,op(1,op(2,(x+y)/(3*y^2-5*x)))))?

Problem 14:
The following substitution command in Maple does not produce the same result that a substitution in an algebra or calculus class would produce. What result does the Maple command produce and why?
> subs( x+y = 5*z, x+y+5*z*sin(x+y)*(x+y)^(-2) );

Problem 15:
Compare the following two Maple procedures.
> f := proc( x::numeric )
>      if x < 0 then
>        0
>      else
>        x
>      fi
> end;
and
> g := proc( x::numeric )
>      if x < 0 then
>        if x > 0 then 0 fi
>      else
>        x
>      fi
> end;

Problem 16:
The following conditional statement can be simplified. Try to simplify it as much as possible. (Hint: You don't need nested conditional statements here.)
> if x < 0 then
>   -x^2
> else
>   if x >= 0 then
>     x^2
>   fi
> fi

Problem 17:
What is the output from each of the following for-loops?
Part (a):
> for i from -9 to 9 by 2 do i od;
Part (b):
> for counter from 100 to 400 do
>   if frac(sqrt(counter)) = 0 then
>     print(counter, sqrt(counter))
>   fi
> od;


Return to the Maple homework page.
Return to the main Maple page.
Return to the CS 125 home page.


compliments and criticisms