Study Guide - Language Fundamentals
Thomas J. Kennedy
1 Overview
Every semester… students ask for some guidance on how to review the topics covered in previous courses. This document exists because this type of question is both common and important.
2 Study Guides
Near the end of the Fall 2023 Semester… a student asked me for some in guidance with preparing for CS 330 for the next semester (i.e., the Spring 2024 Semester). The C++ review guide in this section is the result of that discussion (and a few iterations).
I have included Java and Python guides… since the same topics are a good start in any language.
2.1 C++ Guide
main
function- Write something along the lines of “Hello World!”
- Declare, initialize, and output (to standard out,
cout
, with<<
) the following variable types: int
double
char
bool
(boolean)std::string
- Keyboard Input with
cin
- Prompt for user input (
cout
) - Read the data into a variable with the stream extraction operator (
>>
) - Print that data
- Prompt for user input (
- Functions
- Call built-in functions and store the result
- Write a non-value returning (
void
/None
) function - Call (invoke) a custom function
- Write a value returning function (e.g.,
int
,double
,char
, orstring
)
- Basic Conditional Blocks
- Write an if to check a condition
- Write an if-else to check a condition
- Write an if-else-if-else
- Basic Loops
- Write a for loop to repeat something
n
times - Write a while loop that runs until some condition is met (e.g., until a user types “quit”)
- Write a for loop to repeat something
- Separate modules (compilation units)
- Move a custom function to a separate
h
/cpp
file and invoke it frommain
- Move a custom function to a separate
- File Input
- Work with
ifstream
- Work with
- File Output
- Work with
ofstream
- Work with
- Basic Structs
- Write a Default Constructor
- Write a Non-Default Constructor
- Review the notion of
public
(both mechanically and conceptually)
- Basic Classes
- Review
private
vspublic
vsprotected
protected
is covered in CS 330- Review member functions
- Review
- Arrays
- Declare an array
- Traverse an array
- Output an array
- Intermediate Classes
- Review operator overloading (e.g.,
==
,<
,<<
) - Review aggregation and composition
- Review operator overloading (e.g.,
2.2 Java Guide
main
function- Write something along the lines of “Hello World!”
- Declare, initialize, and output (to standard out, with
System.out.println
, andSystem.out.printf
) the following variable types: int
double
char
boolean
String
- Keyboard Input with
BufferedReader
(and/orScanner
)- Prompt for user input (
System.out.print
) - Read the data into a variable with the
BufferedReader
orScanner
(with appropriate conversion) - Print that data
- Prompt for user input (
- Functions
- Call built-in functions and store the result
- Write a non-value returning (
void
/None
) function - Call (invoke) a custom function
- Write a value returning function (e.g.,
int
,double
,char
, orString
)
- Basic Conditional Blocks
- Write an if to check a condition
- Write an if-else to check a condition
- Write an if-else-if-else
- Basic Loops
- Write a for loop to repeat something
n
times - Write a while loop that runs until some condition is met (e.g., until a user types “quit”)
- Write a for loop to repeat something
- Separate modules (compilation units)
- Move a custom function to a separate
java
file and invoke it frommain
- Move a custom function to a separate
- File Input
- Work with a
FileReader
wrapped in aBufferedReader
- Work with a
- File Output
- Work with a
FileWriter
wrapped in aBufferedWriter
- Work with a
- Basic Classes
- Write a Default Constructor
- Write a Non-Default Constructor
- Review the notion of
public
(both mechanically and conceptually) - Review
private
vspublic
vsprotected
protected
is covered in CS 330- Review member functions
- Arrays
- Declare an array
- Traverse an array
- Output an array
- Intermediate Classes
- Review (pseudo) operator overloading (e.g.,
equals
,hashCode
,toString
) - Review aggregation and composition
- Review (pseudo) operator overloading (e.g.,
2.3 Python Guide
main
function- Write something along the lines of “Hello World!”
- Declare, initialize, and output (to standard out, with
print
and f-strings) the following variable types: int
float
bool
(boolean)str
- Keyboard Input with
input
- Prompt for user input with
input
- Store the data into a variable after converting it to a
float
orint
- Print that data
- Prompt for user input with
- Functions
- Call built-in functions and store the result
- Write a non-value returning (
void
/None
) function - Call (invoke) a custom function
- Write a value returning function (e.g.,
int
,float
, orstr
)
- Basic Conditional Blocks
- Write an if to check a condition
- Write an if-else to check a condition
- Write an if-
elif
-else
- Basic Loops
- Write a for loop to repeat something
n
times - Write a while loop that runs until some condition is met (e.g., until a user types “quit”)
- Write a for loop to repeat something
- Separate modules (compilation units)
- Move a custom function to a separate
py
file and invoke it frommain
- Move a custom function to a separate
- File Input
- Work with
open(..., "r")
- Use
open(..., "r")
with a Context Manager
- Work with
- File Output
- Work with
open(..., "w")
- Use
open(..., "w")
with a Context Manager
- Work with
- Basic Classes
- Write a Constructor
- Review the notion of
public
(both mechanically and conceptually) - Review name mangling (its actually purpose) and how Python does not have a true
public
vsprivate
mechanic - Review member functions
Arrayslist
and (Possibly)np.array
- Declare a
list
- Traverse a
list
- Output a
list
- Declare a
- Intermediate Classes
- Review operator overloading (e.g.,
__eq__
,__lt__
,__str__
,__repr__
) - Review aggregation and composition
- Review operator overloading (e.g.,