FAQ (frequently asked questions) for Assignment 2
Last updated Tue Apr 24 13:50:34 HKT 2001
 
 
 

Q.  Do I need to check for errors and/or print error messages?
A.  No
 
 

Q.  Can a polynomial have negative exponents, e.g., 5x^(-2)
A.  No.  You may assume that all of the exponents of  a polynomial
are greater than or equal to zero.

Q.  The sample output  it wrote  x^1  instead of x but in the assignment
description it staes we should write x instead of x^1.  Which is correct?
A. You should write  x and not x^1.  The sample output had a bug in it
which has since been corrected.
 
 
 

Q.  What should we write when the polynomial is always 0, i.e., P(x)=0
for all x?  0 or leave the line blank?
A.  This was unclear in the assignment definition.  You should
write 0.
 

Q.  Does the assignment operator have to handle the case  of self assignment,
i.e.,  P=P?
A.   No.  We will not test this situation.

Q.  Will we penalized if our code causes memory leakage?
A.  Yes
 

Q.  (April 24) How should we handle negative coefficients?
A.  You should write -c x^k  instead of   + -c x^k,   i.e.,
5x- 3x^2  + 1 instead of  5x+ -3x^2 +1.
In the case that k=1 you should write -cx;  in the case k=0,
write -c.  As an example    write 5x^2 - 3x - 4   instead of
5x^2 + -3x  + -4.
 

Q.   (April 24) The overloaded  operator= in NewListP.cpp looks as if it causes
memory leakage.  Does it and,  if it does, do we need to worry about this
problem in our code?
A.  Due to a bug the operator= in NewListP.cpp did cause memory leakage.
This bug has now been fixed and code in NewListP.cpp is correct and
does not cause memory leakage (that is the only function in NewListP.cpp
that has been changed).
If you are using a modified form of NewListP.cpp in your code you
should fix it so that it does not cause memory leakage.