1 / 16

EE 312 Exam I Review

EE 312 Exam I Review. Exam Format. 100 Total Points 50 Points Writing Programs 25 Points Short Answer 25 Points of Tracing Code Similar to programming assignments and labs All point values are approximations. Example Programming Problems.

bassettc
Download Presentation

EE 312 Exam I Review

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. EE 312 Exam I Review

  2. Exam Format • 100 Total Points • 50 Points Writing Programs • 25 Points Short Answer • 25 Points of Tracing Code • Similar to programming assignments and labs • All point values are approximations

  3. Example Programming Problems • Given a 2D array of characters, write a short piece of code that will count the number of cells that are directly above the letter ‘Q’ and have the value ‘Y’. • Given a file of strings, write a program that will read each line into a linked list node such that the lines are in the correct order (insert at the end) and each insert is a O(1) operation. Then traverse the linked list and print out the lines to the screen.

  4. Example Short Answer • Explain why traversing a linked list of nodes is an O(n) operation. • What is the order in Big O notiation of the following operation: The pop operation for a stack implemented as a linked list.

  5. What will the EXACT output of the following program be? intfoo = 9; int *ptr = &foo; float foo2 = 5.7; *ptr = 2; foo2 = foo - foo2; if (foo > foo2) printf("Hello!\n“); else if (foo < foo2) printf(“%f\n”, foo2); else printf(“%d\n”, foo); printf(“\n”); printf (“foo2 is %f\n”, foo2);

  6. Fundamentals of C • ?? Points • Declaration of variables and functions • Looping and conditional statements • While, for, if • One and two dimensional arrays • Simple I/O • Printf, scanf, fscanf, fgets • Strings and string functions • Understand the Code Camp and Game of Life programs

  7. Pointers • 25 Points • A pointer is a variable that holds the address of a memory location • Declaration • int *ptr; • Assignment • ptr = &foo; //& is the address function • Dereferencing • *ptr = 54; //same as foo=54; • You can point to any kind of data type • Relationship between arrays and pointers • Understand the “malloc” and “free” commands • Returning a pointer from a function

  8. Structures • 15 Points • Declaration • Assignment • Use of the “.” operator • Pointers to structures • (*ptr).field • ptr->field • Structures used in Linked Lists

  9. Linked Lists • 20 Points • Declaring a linked list • Adding a node to a linked list • Removing a node from a linked list • Traversing a linked list • What is the order of magnitude of each of the above operations? • Understand the Stack312_ll code and the linked list code from class.

  10. Stacks • 20 Points • Operations • makeStack • Push • Pop • isEmpty • isFull • Know how to use in a problem and implement • Understand the Stack Fun! assignment

  11. Linux • 8 Points • Know the basic commands you needed to complete a program in Linux • Know how to edit a file in Linux • Know how to compile and run a C program in Linux • Know how to create directories and move around the Linux file system

  12. Command Line arguments • 12 Points • Make sure you understand how to use argc and argv • Understand the use of atoi(char *)

  13. Algorithm Analysis • 20 Points • Understand what Big O notation is • Be able to look at an algorithm or piece of code and determine how much work it has to do (and then the Big(O) analysis of the code) • Understand the relative speed of the Big O orders. • Which is faster? O(1) or O(n)

  14. How to Study • Rewrite all the programs. • Don’t memorize C! Code syntax will be on the exam. • Learn by doing and recognizing patterns. • Don’t stay up late!! Get some sleep and eat a good breakfast.

  15. What to bring • Pencils and erasers • We will provide scratch paper • No calculators

  16. Questions

More Related