INFO I211 Review for Exam 1

Spring 2012

Version 4.4.21

General Information

Review date: February 27

Exam date: March 2

Students in the online section must either take the exam at the IU East Testing Center (see next section) or arrange for a suitable proctor (see the section after the next). Subject to the instructor's approval, they may take the exam within a few days of the scheduled date above.

This exam will count for approximately 25% of your course grade, as described in Table 1 on page 6 of the course syllabus.

Overview

Topics covered: Unix, in Unix Tutorial, parts 1–5; Java, in Lewis and Loftus, chapters 1–7, emphasizing the language; de-emphasizing libraries (APIs) and graphics.

Format: A variety of question types, including multiple choice, short answer, interpreting and writing Java statements, methods, and programs.

Learning Objectives by Chapter

Each chapter has a "Summary of Key Concepts" at the end; you should be familiar with most of them.

Answers to Self-Review Questions are given in the book, so we will not discuss them at the review session except by request.

Unix Tutorial, Parts 1–5

(See Lab 1 and Lab 3.)

Commands: You should be able to describe the effect of the commands listed below, or, given a task to perform, write the command(s) to perform the task. You should know all of the options and arguments shown below for the commands as well. Optional arguments are shown in brackets, for example, [DIRECTORY]; an ellipsis (…) means an argument may be repeated.

ls -a -l [FILE]...
mkdir DIRECTORY...
cd [DIRECTORY]
pwd
cp SOURCE DEST
mv SOURCE DEST
rm FILE...
rmdir DIRECTORY...
clear
cat FILE...
less [FILE]
head FILE
tail FILE
grep -i PATTERN FILE
wc FILE
sort
man TOPIC
chmod MODE[,MODE]... FILE...
ps
bg
fg %JOBNUMBER
jobs
kill -9 PROCESS

In addition:

Sample questions:

  1. What is the effect of ls -a? Answer: it lists the files in the working directory, including the "hidden" files whose names begin with dots.

  2. Write the command to list files that have names beginning with "abc", showing details such as file owner, permissions, size, and date modified. Answer: ls -l abc*

Chapter 1: Introduction

  1. How to compile and run a Java program.
  2. Structure of a Java program (class and main method definitions)
  3. Comments, identifiers, and reserved words

Self-review: 1.1–1.35. Answers are given in the textbook, Appendix N.

Chapter 2: Data and Expressions

  1. How to use Strings, including concatenation (+)
  2. The System.out methods print and println
  3. Declaring and using variables
  4. The Java primitive types, especially int, double, boolean, and char.
  5. Arithmetic expressions, including the operators + - * / % and ()
  6. Assignment (=) and update operators (++, --, +=, -=, *=, /=, %=)
  7. Conversion of data types, including casting, promotion
  8. Using the Scanner class for input

Self-review: SR 2.1–2.48

Programming projects: PP 2.13 fraction

Chapter 3: Using Classes and Objects

  1. Creating objects (new)
  2. References as pointers to objects
  3. The String class and its methods charAt, compareTo, equals, length, substring
  4. Packages and the import statement
  5. The Random class and its methods nextFloat, nextInt (0 or 1 arguments)
  6. The Math class and its static methods abs, floor, ceil, pow, sqrt
  7. Enumerated types
  8. Wrapper classes such as Integer and Double, their conversion methods to and from strings and primitive data, autoboxing and unboxing

Excluded: formatting output

Self-review: SR 3.1–3.24, 3.29–3.37.

Exercises: EX 3.1, 3.2, 3.6, 3.8, 3.9, 3.11, 3.12.

Chapter 4: Writing Classes

  1. Structure and content of a class definition, including fields, constructors, and methods
  2. The visibility modifiers public and private; encapsulation, with access controlled by accessor and mutator methods
  3. Methods: parameters and return values; how a method call works. The distinction between local variables and fields.
  4. The toString method and why we should have one.
  5. Constructors: parameters, and how to "call" a constructor. The default 0-argument constructor.
  6. Concept of event and listener in GUIs.

Self-review: SR 4.1–4.20, 4.24–4.25, 4.30–4.32.

Exercise: EX 4.9 randomColor method

Programming project: PP 4.7 Bulb class

Chapter 5–6: Conditionals and Loops

  1. The if statement, including if/else and nested if's.
  2. The while and for statements, including nested loops.
  3. Rules for indenting code within such statements.
  4. Use of { ... } to create a block of statements.
  5. Boolean expressions; equality and relational operators ==, !=, <, <=, >, >=; logical operators &&, ||, !; "lazy" evaluation of logical expressions.
  6. Issues involving comparison of data: inexactness of floating point data; using the equals and compareTo methods for comparing objects.
  7. The concept of an iterator, hasNext and next methods; enhance for statement ("for-each" loop).

Excluded: do and switch statements, conditional operator (a ? b : c), ArrayLists.

Self-review: SR 5.1–5.16 (conditionals), 5.17–5.23 (while), 5.24–5.25 (iterators), 6.12–6.16 (for).

Exercises: EX 5.2–5.5 (debugging); 5.7–5.8, 6.1–6.2 (interpreting code); 5.11, 6.6–6.7 (writing code).

Chapter 7: Object-Oriented Design

  1. Know the four basic activities of software development: requirements, design, implementation, testing.
  2. Given a statement of a problem, be able to suggest classes, attributes, and methods needed to solve a problem.
  3. The static modifier (for data and methods)
  4. Defining and implementing Java interfaces.
  5. Relationships between classes: dependency and aggregation
  6. The variable this
  7. Designing methods:
    1. importance of designing before coding
    2. method decomposition (top-down design)
  8. Calling a method: arguments are passed by value; what does this mean? What if the argument is a reference type?
  9. Method overloading
  10. Testing concepts and strategies: regression testing, reviews/walkthroughs, test case, black-box and white-box testing Unit tests; JUnit framework.

Excluded: borders.

Explain how each of the following layout manager positions components: FlowLayout, BorderLayout, GridLayout, BoxLayout.

Self-review: SR 7.1–7.18, 7.21–7.23, 7.25–7.31, 7.34–7.35.

Exercises: EX 7.1–7.2 (overloading)

Programming projects (at least design):


  1. Version log:
    • Version 4.4.2, 2012 Feb 27. Corrected chapter numbers.
    • Version 4.4, 2012 Feb 25. Updated for spring 2012, 7th edition changes.
    • Version 4.3, 2011 Feb 28. Added details for Unix.
    • Version 4.2, 2011 Feb 23. Revised for online course offering; needs more detail in Unix section.
    • Version 4.1, Spring 2010.