CS 111 Quiz 2 Study Guide

  1. Quiz format
  2. Topics covered
  3. Revisions to this study guide


  1. Quiz format

    The quiz will be held IN RECITATION (lab) on Wednesday, Marach 4..

    The quiz will be closed-book.

    YOU MUST BRING PHOTO ID to the quiz. (Either your Queens College student ID, or some other photo ID such as a driver's licence or passport.) While taking the quiz, you must have your photo ID out on your desk. During the exam, a proctor will walk around the room checking ID's. Be ready to show the proctor the name on page 1 of your quiz, so that the proctor can compare it to the name on your photo ID.

    The quiz will consist of two sections. In the first section, you will be given a program and told to write its output. In the second section, you will be asked to write a program.


  2. Topics covered

    For the quiz, you will be expected to know all the topics covered in the tutorials for Assignments 1 and 2 and the first tutorial for assignment 3 to 3, especially the tutorials for assignments 2 and 3.

    You will be asked to write a program involving repetition and decision-making, requiring you to use a for loop and either if or if/else, possibly nested if/else.

    You will also be given a program for which you will be asked to write both a code trace and the program's output.

    For the program you write, will need to be able to recognize when each of the control structures (loop and branching) is appropriate, e.g. when to use if vs. when to use if/else.

    Also, make sure you understand these elementary programming concepts thoroughly: variables, data types, variable declarations, assignment statements, operators, and expressions with values.

    Regarding operators: Make sure you know the boolean logical operators as well as the arithmetic operators and comparison operators. Make sure you understand the difference between the assignment operator ("=") and the equality operator ("==") and what happens when you confuse the two. Make sure you understand all the arithmetic operators, including the modulus operator and the difference between integer division and floating-point division. Make sure you understand the concept of operator precedence (e.g., without parentheses, multiplication and division happen before addition and subtraction, as in algebra). Make sure you're familiar with the increment ("++") and decrement ("--") operators. Make sure you understand the difference between preincrement and postincrement, and between predecrement and postdecrement.

    Regarding characters and strings: Know the difference between C-strings and string class objects. Know the difference between the getline function and the extraction operator (">>") when reading strings, and know the difference between the get function and the extraction operator (">>") when reading characters.

    Regarding characters and their ASCII values: You are not expected to memorize the ASCII values of specific characters, but you should remember (1) that the ASCII values of the digit characters are NOT equal to their intended numeric values, (2) that the digit characters have consecutive ASCII values, in an order that corresponds to the intended numeric values of the digits, (3) that the uppercase letters have consecutive ASCII values, in alphabetical order, and (4) that the lowercase letters have consecutive ASCII values, in alphabetical order. For some examples of programs that make use of these facts (and which also illustrate the difference between the get function and the extraction operator), see classifyChar1.cpp and classifyChar2.cpp in the Assignment 2 example programs.

    Make sure you understand casting of data types, and when it is and is not valid. For example, simple data types can be cast to other simple data types, but structured types (such as strings) CANNOT be cast to simple data types, or vice versa. (Thus, in Assignment 3, we could NOT simply cast the command-line argument strings to type int, but instead needed to call a function to do the desired conversion.)

    To prepare for the quiz, the most important thing you will need is experience writing similar programs. Do the practice problems for assignment 3, and, if you have not already done them, the practice problems for assignment 2. You should also review all the examples presented in lecture and the examples on the website accomanying the tutorial material.


  3. Revisions to this study guide


Back to: