midterm02 : Midterm 2

num ready? description assigned due
midterm02 true Midterm 2 Wed 11/16 10:00AM

The midterm will be conducted during the lecture time for each section (10:00am and 1:00pm)

Study guide for midterm 2

The midterm is cumulative but will focus more on topics covered after midterm 1. Be sure to thoroughly review material from Weeks 3 -7

  1. Pointers:
    • Declarion and initialization for pointers to different data types, address and indirection operators
    • Pointers and arrays (similarities and differences)
    • Pointer arithmetic
    • Pointers to pointers
    • Pointers to structs
    • Debugging exercises with pointers
  2. Arrays and Structs
    • Declaration, initialization
    • Passing arrays to functions
    • Basic data structures that use structs, array lists
    • Debugging exercises involving arrays and structs (implications of out of bound array access)
  3. Program and data representation in memory
    • Program layout- text, data, bss, heap and stack
    • Data layout in memory: pointers, structs, arrays of chars, shorts, ints, pointers, structs
    • Byte ordering (little and big endian)
  4. Dynamic memory allocation
    • malloc, calloc, realloc, free
    • Identifying the causes for segfaults, memory leaks, dangling pointers and data corruption
    • Debugging exercises
  5. File IO
    • Streams
    • Functions to interact with files: fopen, fputc, fgetc, fread, fwrite, fclose, feof
    • Data representation in files
  6. Hand compiling C code to ARM with emphasis on the following ARM instructions
    • ARM Data transfer instructions for interaction with memory
    • ARM Control transfer instructions (if , if else, while, do ..while)
    • Conditional execution of ARM instructions using condition codes
    • Function call mechanics and the ARM Procedure call standard
    • Nested functions

Resources

To prepare for the midterm, please go through quiz 1-6, lecture slides AND review pa2 and pa3

Here are the quiz questions with solutions

Exam paper and solutions

Regrade policy

Please note that we have thoroughly checked the solutions to the midterm and believe they are correct. If you think otherwise, please communicate the same to us via Piazza and not as a regrade request. You may submit a regrade request only if you are sure of a grading error. You may not submit regrades to inquire about where you went wrong. We hope this is something you can figure out by looking at the provided solutions at the above link. To discourage unnecessary regrade requests, there is a one point deduction for invalid regrade requests i.e. requests that contend the rubric, ask for more points on incorrect solutions or are looking to clarification on solutions. We recommend that you direct such queries to Piazza.