CSCE A201 Midterm Exam Topics
The CSCE A201 exams are all closed book and closed computer. You are allowed to bring in a single 8.5x11 (or smaller) page of notes.
You can put whatever you want on the paper and can use the front and the back. You will have a variety of questions on the exam. There will
be a small number of short-answer questions. There will be more
questions where you will be asked to write some code, or you will be
given some code and asked to produce what the output of the code
will be when executed or to find the error in some code. The topics that will be covered are listed
below:
Computer Programming Overview
- What is happening when you compile and run a Java program
- How Java achieves (or attempts to achieve) platform independence
assembler
- General layout of a Java Program
- e.g main, where import goes, when to use { }, how whitespace is
handled
- How to use comments and when to use comments
- Know how to enter, compile, and execute your program
in DrJava and NetBeans
Input and Output
- How to use System.out.println to output variables,
text
- How to use Scanner for input of Strings, numbers
- Know about the escape characters for output
Identifiers and Variables
- Valid/Invalid identifiers
- Data Types
- Understand the concept of a data type
- Know char, int, float, boolean, long, double, and String
- Variables
- What they are, how to define them
- Assigning values to variables, initialization
- Shorthand notations for assignment, e.g. ++, --, +=, *=
...
Strings
- Use of the dotted notation to invoke string methods
- equals, length methods
Expressions and Operators
- Basic operators of +, -, *, /, %
- Operator precedence
- Assignment operator
- Type casting
- Issues in going from float to integer, vice versa
- Boolean Expressions
- ==, != <, >, <=, >=
- Combining with && and || and ! to produce complex logical
expressions
- Precedence in relation to other operators
- Problem with using == with strings
- Using the Random class, be able to generate a random number within a specific range, what a pseudo-random number is
Flow Control
- If-then statement along with if-then-else
- Nested if-statements
- When to use {}
- Short circuit evaluation
- While Loops
- Looping criteria
- Nested loops
- Count-based vs. Event-based loops
- Infinite loops
- Do-while loops
- Concept that the loop body will always be executed
- Break, Continue
- For loops
- Conversion
- Given code written in one type of loop, you should be able to convert it
to another type of loop
- Switch statement
- Subtleties with using break; and what happens without
break;
Misc
-
Common
bugs
-
== with strings, == with floats or doubles,
mixing next() or nextInt() with nextLine() and getting an empty string,
off by one with
Random