1 / 11

CS 2308 Exam I Review

CS 2308 Exam I Review. Exam Format. 80 Total Points 60 Points Writing Programs 15 Points Tracing Code/Algorithms and determining results 5 Points Short Answer Similar to quizzes and programming assignments. Example Programming Problem.

parkin
Télécharger la présentation

CS 2308 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. CS 2308 Exam I Review

  2. Exam Format • 80 Total Points • 60 Points Writing Programs • 15 Points Tracing Code/Algorithms and determining results • 5 Points Short Answer • Similar to quizzes and programming assignments

  3. Example Programming Problem • Write a function that accepts two parameters: an array of integers and the number of integers in the array. Return an integer representing the number of odd integers in the array.

  4. Example Tracing Problem • 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) cout << "Hello!"; else if (foo < foo2) cout << foo2; else cout << foo; cout << endl; cout << "foo2 is: " << fixed << setprecision(1) << foo2 << endl;

  5. Example Short Answer • Why would we rarely use the equality operator when comparing floating point values?

  6. Arrays • 45 points • One and two-dimensional arrays • Declaration of various types • traversing • Difference between physical and logical size • Passing arrays as parameters • Arrays of records • Understand tsuPod program • Strings • Know how to use the string functions such as length(), substr() • Know how to use a string like an array of characters • Understand BioHelp and Exam Grader programs • 2-D arrays • Understand Game of Life program

  7. Structures • 15 points • Know how to declare a structure • Know how to access the fields in a structure • Arrays of structures • Understand tsuPod program

  8. Pointers • 15 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 “new” and “delete” commands

  9. How to Study • Rewrite all the programs. • Learn by doing and recognizing patterns. • Don’t stay up late!! Get some sleep and eat a good breakfast.

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

  11. Questions

More Related