Download presentation
Presentation is loading. Please wait.
1
EE 312 Exam I Review
2
Exam Format 115 Total Points
60 Points Writing Programs 30 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.
5
What will the EXACT output of the following program be?
int foo = 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 Game of Life program
7
Pointers Relationship between arrays and pointers 20 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 25 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 15 Points Operations Know how to use in a problem and implement
makeStack Push Pop isEmpty isFull Know how to use in a problem and implement Understand the Stack Fun! assignment
11
Linux 6 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 15 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
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.