Lecture 13 Exam 2 Review

Joseph Haugh

University of New Mexico

Exam 2 Topics: Basics

  • Variables
    • What do variables store?
    • Can they be mutated?
  • If statements
    • What is the syntax of an if statement?
    • Is the else branch mandatory?
  • Indentation
    • Does indentation effect semantics in Java?
    • Why do we care about indentation?
  • Data types
    • What are some primitive types in Java?
    • What information does a type give us?

Exam 2 Topics: Basics

Exam 2 Topics: Loops

  • While loops
    • What is the syntax of a while loop?
    • What is are the semantics of a while loop?
    • What scenarios should we us a while loop in?
  • For loops
    • What is the syntax of a for loop?
    • What is are the semantics of a for loop?
    • What scenarios should we us a for loop in?
  • Do While loops
    • What is the syntax of a do while loop?
    • What is are the semantics of a do while loop?
    • What scenarios should we us a do while loop in?

Exam 2 Topics: Functions

  • Functions
    • What is the syntax of a function?
    • Why do we use functions?
  • Return keyword
    • What does the return keyword do?
    • What happens if we forget it?

Exam 2 Topics: Strings

  • Strings
    • How do you get a character from a String?
    • Can you mutate a String?
    • What does (+) do on Strings?
    • What is 1 + 2 + "hello" + 3 * 4 evaluate to?
      • 3hello12
    • What do single quotes (' ') denote in Java?
    • What do double quotes (" ") denote in Java?
    • Should you use == or equals on Strings?

Exam 2 Topics: Switch

  • Switches
    • Switch expression vs statement
    • What is the use case of a switch?
    • What types can you switch on?
    • What does the default keyword do?
  • Switch expression
    • What is the syntax of a switch expression?
    • What are the semantics of a switch expression?
  • Switch statement
    • What is the syntax of a switch statement
    • What are the semantics of a switch statement

Exam 2 Topics: Intermediate

Exam 2 Topics: Arrays

  • Arrays
    • How do you create an array?
    • Can arrays hold different types of data?
    • Can you change the length of an array?
    • Can you change the elements inside an array?
    • What index does an array start at?
    • What index does an array end at?
    • What happens if you try to access an array with a negative index?