Past Exam for CSC 256 - Machine Structures with Hsu at San Francisco State (SFSU)

Exam Information

Material Type:Mid-Term
Class:CSC 256 - Machine Structures
University:San Francisco State University
Term:Spring 2009
  • Conventions
  • Specifications
  • Following Statements
  • Syntax Errors
  • Partial Credit
Login / Sign Up to View Document
Preview Page 1Preview Page 2Preview Page 3Preview Page 4

Sample Document Text

file:///C|/Converter/Input/wKLo2cBWEe.txt[3/10/2011 10:15:34 PM] NAME: 3/11/2009 1. Given the C++ function prototype and variable declarations: int func(int *arg0, int arg1); int *ptr, x, y[10]; which of the following statements will cause syntax errors or warnings about type mismatch/missing cast? For each case, write either BAD (error or warning), or OK (no error or warning), and circle also the argument/variable that has the type mismatch. No points will be awarded for a statement if there is a syntax error and you circle the wrong argument/variable. (10 points) x = func(&y[*ptr], *ptr); OK y[x] = func(*ptr, x); BAD (*ptr is not an int pointer) *ptr = func(y, x + ptr); BAD (x + ptr is not an int) 2. Translate the C++ function upR() into MAL. (You don't have to write a main program, ...
155, "/var/app/current/tmp/"