Review for Final Exam. Contents 5 questions (20 points each) + 1 bonus question (20 points) – Basic concepts in Chapters 1-4 – Chapters 5-9 – Bonus: Chapter.

Slides:



Advertisements
Similar presentations
Chapter 2: Basic Elements of C++
Advertisements

C++ Programming: Program Design Including Data Structures, Third Edition Chapter 7: User-Defined Functions II.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 7: User-Defined Functions II.
Chapter 7: User-Defined Functions II
Chapter 7 User-Defined Methods. Chapter Objectives  Understand how methods are used in Java programming  Learn about standard (predefined) methods and.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 7: User-Defined Functions II.
Chapter 7: User-Defined Functions II Instructor: Mohammad Mojaddam.
Chapter 5 Functions.
Wednesday, 12/11/02, Slide #1 CS 106 Intro to Comp. Sci. 1 Wednesday, 12/11/02  QUESTIONS??  Today: CLOSING CEREMONIES!  HW #5 – Back Monday (12/16)
1 Chapter 7 User-Defined Methods Java Programming from Thomson Course Tech, adopted by kcluk.
Wednesday, 10/9/02, Slide #1 CS 106 Intro to CS 1 Wednesday, 10/9/02  QUESTIONS ??  Today:  Discuss HW #02  Discuss test question types  Review 
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 8: User-Defined Simple Data Types, Namespaces, and the string Type.
1 Lecture 20:Arrays and Strings Introduction to Computer Science Spring 2006.
Chapter 9: Arrays and Strings
Chapter 9: Arrays and Strings
Monday, 11/18/02, Slide #1 CS 106 Intro to CS 1 Monday, 11/18/02  QUESTIONS??  Today:  Hand back, discuss HW #4  Discussion of Lab 10  Exam #2 Friday.
Chapter 9: Arrays and Strings
Java Programming: From Problem Analysis to Program Design, 4e Chapter 7 User-Defined Methods.
Chapter 13: Overloading.
Chapter 7: User-Defined Methods
Chapter 8 Arrays and Strings
Arrays. Objectives Learn about arrays Explore how to declare and manipulate data into arrays Learn about “array index out of bounds” Become familiar with.
Chapter 8 Arrays and Strings
Chapter 6: User-Defined Functions
C++ Programming: From Problem Analysis to Program Design, Fifth Edition, Fifth Edition Chapter 7: User-Defined Functions II.
Project 1 Due Date: September 25 th Quiz 4 is due September 28 th Quiz 5 is due October2th 1.
EGR 2261 Unit 8 One-dimensional Arrays  Read Malik, pages in Chapter 8.  Homework #8 and Lab #8 due next week.  Quiz next week.
EGR 2261 Unit 9 Strings and C-Strings  Read Malik, pages in Chapter 7, and pages in Chapter 8.  Homework #9 and Lab #9 due next week.
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Arrays.
CIS-165 C++ Programming I CIS-165 C++ Programming I Bergen Community College Prof. Faisal Aljamal.
Java Programming: From Problem Analysis to Program Design, 4e Chapter 2 Basic Elements of Java.
CPS120: Introduction to Computer Science Decision Making in Programs.
CS Midterm Study Guide Fall General topics Definitions and rules Technical names of things Syntax of C++ constructs Meaning of C++ constructs.
CHAPTER 7 arrays I NTRODUCTION T O C OMPUTER P ROGRAMMING (CSC425)
Chapter 6 User-Defined Functions I. Objectives Standard (predefined) functions What are they, and How to use them User-Defined Functions Value returning.
User Defined Functions Chapter 7 2 Chapter Topics Void Functions Without Parameters Void Functions With Parameters Reference Parameters Value and Reference.
1 Topic: Array Topic: Array. 2 Arrays Arrays In this chapter, we will : Learn about arrays Learn about arrays Explore how to declare and manipulate data.
CSC1201: Programming Language 2 Lecture 1 Level 2 Course Nouf Aljaffan (C) CSC 1201 Course at KSU1.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 8: User-Defined Simple Data Types, Namespaces, and the string Type.
More Array Access Examples Here is an example showing array access logic: const int MAXSTUDENTS = 100; int Test[MAXSTUDENTS]; int numStudents = 0;... //
User Defined Methods Methods are used to divide complicated programs into manageable pieces. There are predefined methods (methods that are already provided.
Liang, Introduction to C++ Programming, (c) 2007 Pearson Education, Inc. All rights reserved X 1 Chapter Array Basics.
Modular Programming – User Defined Functions. CSCE 1062 Outline  Modular programming – user defined functions  Value returning functions  return statement.
Functions Math library functions Function definition Function invocation Argument passing Scope of an variable Programming 1 DCT 1033.
1 For Loops l From Chapter 9 l A shorthand way of coding count loops.
Arrays.
Arrays Chapter 7. Arrays Hold Multiple Values Array: variable that can store multiple values of the same type Values are stored in adjacent memory locations.
Java Programming: From Problem Analysis to Program Design, Second Edition 1 Lecture 1 Objectives  Become familiar with the basic components of a Java.
Opening Input/Output Files ifstream infile; ofstream outfile; char inFileName[40]; char outFileName[40]; coutinFileName;
CPS120 Introduction to Computer Science Exam Review Lecture 18.
Arrays Declaring arrays Passing arrays to functions Searching arrays with linear search Sorting arrays with insertion sort Multidimensional arrays Programming.
SEQUENTIAL AND OBJECT ORIENTED PROGRAMMING Arrays.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 7A Arrays (Concepts)
CS 1428 Final Exam Review. Exam Format 200 Total Points – 60 Points Writing Programs – 45 Points Tracing Algorithms and determining results – 20 Points.
A FIRST BOOK OF C++ CHAPTER 7 ARRAYS. OBJECTIVES In this chapter, you will learn about: One-Dimensional Arrays Array Initialization Arrays as Arguments.
Chapter 7: User-Defined Functions II
CS Computer Science IA: Procedural Programming
Computer Programming BCT 1113
Review for Midterm Exam
Review for Final Exam.
Programming Funamental slides
CS 1428 Final Exam Review.
Review for Midterm Exam
Review for Midterm Exam
CS 1428 Final Exam Review.
Review for Final Exam.
Review for Midterm Exam
Review for Midterm Exam
Fundamental Programming
Presentation transcript:

Review for Final Exam

Contents 5 questions (20 points each) + 1 bonus question (20 points) – Basic concepts in Chapters 1-4 – Chapters 5-9 – Bonus: Chapter 5 Question types – Write down the output of the code – Write the code – Debug errors in the code Review – Lecture slides – Exercises (1)~(19) in class (on the course Web page) – Review problems for final exam (on the course Web page) 2

Time & Place & Event Time: 5:45pm - 7:30 pm, May 7 (Tuesday) Place: Science 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 3

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 4

Chapter 3: Input/Output Declaration of input/output stream Usage of cin and cout (as well as other istream/ostream variables) 5

Chapter 4: Control Structures I (Selection) Relational operators and precedence – Comparison operators, >=, ==, != String comparison – Logical operators &&, | | Evaluation of logical expression 6

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 { } 7

Chapter 5: Control Structures II (Repetition) Repetition structure – Syntax and usage of the "for" loop – The nested for loop 8

Chapters 6 & 7: User-Defined Functions Two types of user-defined functions – Value-returning functions and void functions – Differences Syntax of function heading Function prototype – Function heading without the body of the function – 9

Chapters 6 & 7: User-Defined Functions (cont'd) Function call – Use function name together with the actual parameter list Two types of formal parameters – Value parameters – Reference parameters – Differences Scope of an identifier – Local identifier – Global identifier 10

Chapters 6 & 7: User-Defined Functions (cont'd) Function overloading – several functions with the same name but different parameter lists Default parameters in function prototype – Places of default values – Default values cannot be assigned to reference parameters – See legal and illegal examples in lecture slides 11

Chapter 8: User-Defined Simple Data Types, Namespaces, and the string Type Syntax of declaring an enumeration data type Syntax of declaring a namespace String data type – Syntax of declaring and initializing a string variable string name = "William Jacob"; – Syntax of accessing characters in the string using array subscript operator [] name[0] 12

Chapter 8: User-Defined Simple Data Types, Namespaces, and the string Type (cont'd) Basic operations/methods of string data type – str = name + " Day"; – name.length() 13

Chapter 9: Arrays and Strings* Declaration and initialization of arrays – Syntax and usage – Accessing array components array subscripting operator [ ] – How to use for loops to access array elements for (i = 0; i < 100; i++) Initialization: list[i] = 0.0; read data: cin >> list[i]; Print data: cout << list[i]; Search a key item from the array find the sum, average, largest See lecture slides 14 int num[5];

Chapter 9: Arrays and Strings* (cont'd) Array initialization during the declaration – double sales[] = {12.25, 32.50, 16.90, 23, 45.68}; – int list[10] = {0}; – int list[10] = {8, 5, 12}; – int list[] = {5, 6, 3}; – int list[25]= {4, 7}; – See lecture slides Restrictions of array – Does not allow aggregate operations – Must use for loop to copy from one array to another 15

Chapter 9: Arrays and Strings* (cont'd) C-String (character array) – C-strings are null-terminated ('\0') character arrays – Declaration and initialization char name[16] = "John"; char name[] = "John"; – Access the character in the C-String name[0] ~ name[3] '\0' is not counted at the length of the C-String Parallel arrays – Two (or more) arrays holding related information in the corresponding components 2-dimensional arrays 16

Good Luck! Q/A