CS 111 Exam 1 Study Guide
- Exam format
The exam will be held IN LECTURE on Monday, March 20. It will consist of the following:
- Ten multiple choice questions.
- One program-writing problem.
- One output problem (in which you'll be asked to write everything displayed at the console by a given program or program segment).
YOU MUST BRING PHOTO ID to the exam. (Either your Queens College student ID, or some other photo ID such as a driver's license or passport.) While taking the exam, you must have your photo ID out on your desk. During the exam, one of the proctors will walk around the room checking ID's. Be ready to show the proctor the name on page 1 of your exam, so that the proctor can compare it to the name on your photo ID.
- Topics covered
The exam will cover all the topics covered in Assignment 1 up to Assignment 4, with emphasis on Assignment 4.
Both the programming problem and the output problem will likely involve both repetition and decision-making, requiring you to use a while loop and either if or if/else, possibly nested if/else.. Most likely, one of the problems will probably involve processing characters in a C-string and the other will probably involve processing numbers.
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 3 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.
Make sure you understand and can recognize various kinds of repetition, e.g. count-controlled, sentinel-controlled, flag-controlled.
Make sure you understand how to use the error state of cin.
To help you prepare, do both the practice problems and the assigned problems for Assignment 4.
In addition to reading the tutorials and the textbook, you should review the examples accompanying the tutorials, plus the examples covered both in lecture and in recitation. Note that, on most topics, the textbook is somewhat more advanced than the tutorials, so it is recommended that you read the tutorials first.
- Revisions to this study guide
- No revisions yet.
Back to: