CSCI 123 Exam 3 Study Guide - F23
CSCI 123 Exam 3 Study Guide - F23
Permitted Materials:
Topics
◦ Declaration statements
▪ initialization of variables within a declaration statement
◦ Assignment statements
◦ Arithmetic expressions
◦ Boolean expressions
◦ Precedence of arithmetic and boolean operators
◦ Evaluation and use of expressions in statements
◦ Use of function calls in expressions (see Chapter 4)
◦ if
◦ else-if
▪ add else-if to select from multiple options
◦ switch
▪ alternative to if/else-if
▪ use of break and default keywords
◦ for
▪ initialization of dedicated loop variable
▪ iterate an arbitrary number of times
▪ different ways to iterate through loop (i++, i--, i = i+2)
▪ nested for loops
◦ <cmath>
▪ pow()
▪ sqrt()
▪ ceil()
▪ floor()
◦ <cstdlib>
▪ srand()
▪ rand()
▪ understand the need for a unique seed per program execution
◦ <ctime>
▪ time()
• Scope – (Chapter 4)
◦ Call-by-value parameters
▪ A copy of an argument's value passed in during a function call
▪ Allows literals as arguments
◦ Call-by-reference parameters
▪ A reference to the memory address of an argument passed in during a function call
▪ In other words, a function will directly manipulate an argument's value
▪ Forbids literals as arguments
◦ Function overloading
▪ Know how to write an overloaded function
▪ Minimum requirements for overloading
▪ .open()
▪ .close()
◦ Declaration
◦ Initialization
◦ Upper and lower bounds
◦ Access and modification of individual elements via indexing
◦ Arrays as function parameters – pass array and size
◦ Limitations of compile-time arrays
• Strings – (Chapter 8)
• Vectors – (Chapter 8)
◦ Member functions:
▪ .size()
▪ .at() - compare with traditional array indexing
▪ .push_back()
▪ .pop_back()
• Pointers – (Chapter 9)
▪ arrays
▪ accessing an array through a pointer
◦ Use of new keyword to dynamically allocate variables and arrays (using [])
Page 5 of 6
◦ [TO BE DETERMINED]
◦ Constructor functions
▪ how to include a default constructor in your class definition
▪ initialization section syntax (p. 584) - <member data>(<constructor parameter>)
◦ Access modifiers
▪ public vs. private
▪ when you can and cannot use a private member
▪ encapsulation – Savitch 566
◦ Destructor function
◦ Friend functions
◦ Constant parameters within member functions
◦ Constant member functions
◦ Binary Operator Overloading (+, -, <<, >>)