CPSC 211, Sec 201-203: Quiz 6
Feb 25, 2004

Name:________________________________________

  1. (2 pts) Consider the C program below and draw the memory diagram (heap and stack) at point A. Assume stdio.h and string.h are included.
    int main() {
      char name[10];
      char *namep;
      strcpy(name,"ketchup");
      name[0] = 'K';
      namep = "french fries";  
      /* point A */
    }
    













  2. (2 pts) A palindrome is a string of characters that is equal to its reverse. For example, "ABLEWASIEREISAWELBA" is a palindrome. Describe an algorithm that, when given an input string and its length, determines whether or not the string is a palindrome by using a stack. Pseudocode is fine, or if you prefer, you can use C or Java.












  3. (1 pt) What is an advantage of postfix notation over infix?