1 / 10

Review for Midterm Exam

Review for Midterm Exam. CSCI 1380. Contents. 5 questions (20 points each) + 1 bonus question (20 points) Chapters 1~4 Question types Write down the output of the code Write the code Debug errors in the code Review Lecture slides Exercises (1)~(5) in class (on the course Web page)

lindley
Download Presentation

Review for Midterm Exam

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. Review for Midterm Exam CSCI 1380

  2. Contents • 5 questions (20 points each) + 1 bonus question (20 points) • Chapters 1~4 • Question types • Write down the output of the code • Write the code • Debug errors in the code • Review • Lecture slides • Exercises (1)~(5) in class (on the course Web page) • Review problems

  3. Time & Place & Event • 5:45pm ~ 7:00pm, Feb. 28, Tuesday • ENGR 1.262 • Closed-book exam • You can take a piece of cheating paper with A4 size • Write down whatever that you think is important (on both sides) with any font size

  4. Chapter 1: An Overview of Computers and Programming Languages • Computer system has hardware and software • Various kinds of languages, such as machine language, assembly, high-level • Algorithm: step-by-step problem-solving process; solution in finite amount of time • Object-oriented design (OOD): a program is a collection of interacting objects • C++ is an object-oriented programming language

  5. Chapter 2: Basic Elements of C++ • Special symbols, keywords, rules of identifiers • Basic data types • int, float, double, char, string • Operators • Arithmetic operators and their precedence • +, -, *, /, %, +=, -=, *=, /= • Increment/decrement operator • ++, -- • Declaration of variables • int first=13, second=10; • char ch=' '; • Input/Output statement • cin and cout

  6. Chapter 3: Input/Output • Declaration of input/output stream • Usage of cin and cout (as well as other istream/ostream variables) • The stream extraction operator, cin>> • Syntax and meaning of functions • cin.get(varChar); • cin.ignore(intExp, chExp); • cin.putback(ch) • cin.peek(ch) • getline(cin, str); • See examples in lecture slides

  7. Chapter 3: Input/Output (cont'd) • The stream insertion operator, cout<< • endl • setprecision, showpoint, setw, setfill • File stream • Header: fstream

  8. Chapter 4: Control Structures I (Selection) • Relational operators and precedence • Comparison operators • <, <=, >, >=, ==, != • String comparison • Logical operators • &&, | | • Evaluation of logical expression • See examples in lecture slides

  9. Chapter 4: Control Structures I (Selection, cont'd) • Syntax and usage of the selection structure • One-way selection: if () { } • Compound statements • Two-way selection: if () { } else { } • Multi-way selection: switch () { } • Nested if statement • See examples in lecture slides

  10. Good Luck! Q/A

More Related