• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/27

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

27 Cards in this Set

  • Front
  • Back
What is meant by the term “algorithm”?
A sequence of instructions or steps that can be followed in order to solve a relatively simple well-defined problem. Frequently there are many different known algorithms for solving a problem.
Name several problems that can be solved with just an algorithm.
Sorting an array of numbers; Finding the quickest route for going to the store; listing the first 1000 prime numbers; factoring an integer into it’s prime factors; combining many baskets of eggs into a single basket using a machine that takes two baskets as input and outputs one basket containing all of the eggs in the first two baskets combined; etc.
Name several problems that are too complicated to be solved with just a single algorithm.
Running a restaurant; a simulation of a submarine; scheduling the flights for a major airline company; predicting whether or not the economy will improve; etc.
What is a “use case”? Imagine that you are working on online banking program. Describe several “use cases” that your program should be able to deal with. (Recall that there are three parts to the description of a “use case”: the pre-conditions, the actions, and the post-conditions.)
A use case is a typical scenario that a program may encounter – it describes what factors are involved in the case, how the program handles the case, and what you can assume is true AFTER the program handles the case.

For a “banking program”, a typical “use case” is:

(Withdrawing Money from an ATM)

Pre-conditions: Customer has an account with money in it and has a valid ATM card; ATM has money in it; ATM has paper in order to print receipts.

Actions: Customer puts card into machine; ATM reads card; Customer enters withdrawal transaction; ATM spits out money; ATM spits out receipt; ATM spits out card

Post-conditions: Customer has more money; ATM has less money and less paper
If you are working on a Java project outside of eclipse, what command would you type to compile a file called “Fish.java”?
Javac Fish.java
.If you are working on a Java project outside of eclipse, what command would you type to run the main method of a bytecode file called “Fish.class”?
Java Fish
What is the purpose of the parameter “args” in the prototype for the standard main method?
It allows data to be passed to the program at the moment the program is executed.
What style of comments do you use to the right of a statement?
// This is a comment
What style of comments do you use to describe a group of several statements?
/* This is usually used for a block */
What style of comments do you use to document your API?
/** This is a javadoc comment */
If you are writing Javadoc for a class, what information should you include? What should you leave out?
A basic description of the class. You leave out a lot of small details that will be described in the documentation for the methods.
If you are writing Javadoc for a method, what information should you include? What should you leave out?
The javadoc should contain everything that the USER of the method needs to know. This includes pre-conditions and post-conditions, as well as a description of things that may go wrong. Frequently details of HOW the method works are left out, but are described in a non-javadoc style comment.
Who is going to see your Javadoc comments? (Hint: there are two very different audiences.)
The “user” of the class. (Another programmer who will be using this class in his/her project.)

Also anyone who inspects your code.
.Who is going to see your internal comments (not Javadoc?) (Hint: just one audience.)
Someone who is inspecting your code.
Which type of comments should be used for members that are “public”?
Always use javadoc; sometimes also use a non-javadoc comment for things that do not need to be mentioned in the API description.
Which type of comments should be used for members that are “private”?
Javadoc is not necessary here, just use non-javadoc comments to describe how the method works.
Does it ever make sense for an internal (non-Javadoc) comment to duplicate the code?
No.
Does it ever make sense for a Javadoc comment to duplicate the code?
Yes, since the “user” of the class typically does not get to see the code.
What is the format of the document that the Javadoc utility creates?
HTML
True/False: A java source-code file can contain more than one class.
True
True/False: A java source-code file can contain more than one public class.
False
When you use a public class inside of it’s own package do you need to use a fully qualified name?
No
Can you use a public class outside of it’s package? Do you need to use a fully qualified name?
Yes, and you MUST use the fully qualified name.
When you use a non-public class (with no visibility specified) inside of it’s own package, do you need to use a fully qualified name?
No.
Can you use a non-public class (with no visibility specified) outside of it’s package?
No.
If you write a class without specifying a particular package, which package will it become part of?
Default Package
What syntax would you use at the top of a source-code file to specify that the class belongs in a subpackage called “stuff” that is part of a larger package called “junk”?
package junk.stuff;