Level 9 Level 11
Level 10

[Quiz] Basics II


97 words 0 ignored

Ready to learn       Ready to review

Ignore words

Check the boxes below to ignore/unignore words, then click save at the bottom. Ignored words will never appear in any learning session.

All None

Ignore?
public static void main(String[] args)
What is the correct signature of the main method?
states and behaviors
What two characteristics do objects have?
inheritance
allows a class to be a subclass of a superclass and thereby inherit public and protected variables and methods of the superclass. A parent/child relationship.
extends
What keyword at the beginning of a class creates a subclass?
interface
What is a group of related methods with empty bodies?
implements
What keyword at the beginning of a class groups with an interface?
package
What is a namespace containing an organized set of related classes and interfaces?
field
A software object's state is stored in a
method
A software object's behavior is exposed through a
encapsulation
helps hide implementation behind an interface or API
class
All Java methods must be contained in a ...
Application Programming Interface
What does the term API stand for?
true
True or false: 'true' is a reserved word in Java
byte
eight bits
short
16 bits long. 16 bit integer (-32K - 32K)
long
64 bits long 64 bit intiger
float
32 bits long. 32bit FLOATING POINT
literal
What is the source code representation of a fixed value?
non-static fields
The term 'instance variable' is another name for
static fields
The term 'class variable' is another name for
parameter
Methods can have parameters to provide additional information for a task.
java.lang.String
Character strings are represented by the class
array
public Polygon polygonFrom(Point... corners) {
what is a primitive data type? list them all
A data type that's predefined by the language and named by a reserved keyword. They are: int, char, byte, long, short, double, float and boolean
which data type is immutable? What does this mean?
the String data type is immutable, which means that once it's given a value, that value can't be changed
what is a literal? Give examples
The source code representation of a fixed value.L for long type, F for float
static field
The term "class variable" is another name for _______
what's the difference between instant variables, class variables and local variables?
Instant variables are fields declared without the static modifier. Class variables are fields declared with the static modifier. Local variables hold temporary state of a method.
int (integers a.k.a. whole numbers) like 43,-8,0
name, describe and give examples of the fundamental primitive types
what is an expression?
a simple value or set of operations that proces a value
evaluation
the process of obtaining the value of an expression
difference between integer, floating point literals
integer literal is a sequence of digits with or without a leading sign.
the purpose of the mod operator examples
testing whether a number is odd or even
name the types of operators
unary (+,-), multiplicative (*,/,%), additive (-,+)
how to evaluate a complex expression with multiple operators?
evaluate the multiplicative operators first in the order of left to right, then the additive operators in the order of left to right
what's the difference between ++x and x++?
++x immediately increments x, x++ increments on the next round
if you use a for loop and include 2 statements without curly brackets, what's the result?
The first statement will be considered part of the for loop and will comply with the pre-established rules. The second statement will execute only once.
roundoff number
a numerical error that occurs because floating point numbers are stored as approximations rather than as exact values.
primitive type, object
char is a _______ and String is a _______
letter will store 'c'
what is the result of char letter = 'a' + 2; ?
Values of type char are really integers
why can you use relational operators like >= with chars?
getNumericValue, isDigit, isLetter
name some methods from the Character class
Char is a primitive type, not an object
Explain why you can or cannot use dot notation with char
formatted
what does the "f" in printf stand for?
What is ASCII
American Standard Code for Informational Exchange. ASCII is an encoding scheme
what is unicode?
A new standard for encoding characters, having identified over 100,000 characters already
precondition vs postcondition
a condition that must be true before a method executes in order to guarantee that the method can perform its task
Actual parameter list
The arguments specified in a particular method call.
Applet
A program written in the Java programming language to run within a web browser compatible with the Java platform, such as HotJava or Netscape Navigator.
Argument
A statement of the meaning or main point of a literary work
Classpath
A classpath is an environmental variable which tells the Java virtual machine and Java technology-based applications (for example, the tools located in the JDK 1.1.X\bin directory) where to find the class libraries, including user-defined class libraries.
Comment
In a program, explanatory text that is ignored by the compiler. In programs written in the Java programming language, comments are delimited using // or /*...*/.
Compilation unit
The smallest unit of source code that can be compiled. In the current implementation of the Java platform, the compilation unit is a file.
Compiler
Converts source code to machine-readable form
Declaration
int x;
Definition
A declaration that reserves storage (for data) or provides implementation (for methods).
Executable content
An application that runs from within an HTML file.
finalize() method
The finalize() method is defined in the Object class. Classes override this method to perform a cleanup operation prior to garbage collection. An object's finalize() method can be invoked only once by the garbage collec…
Formal parameter list
The parameters specified in the definition of a particular method.
Hexadecimal
These digits operate on a base-16 number These numbers use the letters A, B, C, D, E, and F along with the numbers 0 to 9 to create their 16 different digits, where A repres…
import
A Java programming language keyword used at the beginning of a source file that can specify classes or entire packages to be referred to later without including their package names in the reference.
instance
An object of a particular class. In programs written in the Java programming language, an instance of a class is created using the new operator followed by the class name.
Internet
a network of networks
JAR file format
JAR (Java Archive) is a platform-independent file format that aggregates many files into one. Multiple applets written in the Java programming language, and their requisite components (.class files, images, sounds and other resource files)…
JDK
Java Development Kit software. A software development environment for writing applets and application in the Java programming language.
Keyword
A reserved word used by the compiler to parse programs. You cannot use keywords, like public, class and void as variable names.
Member
A field or method of a class. Unless specified otherwise, a member is not static.
return
Ends execution of a method and possibly returns a value to the calling code.
Varargs
The varargs must be the last of a method's parameters. A method can declare a parameter that accepts from zero to many arguments, a so-called varargs method.
Virtual machine
An abstract specification for a computing device that can be implemented in different ways, in software or hardware. You compile to the instruction set of a virtual machine much like you'd compile to the instruc…
void
Every method should have a return type. If it doesn't return anything what is the return type?
True.
In Java, Exceptions are objects. True or false?
Throwing exceptions
Name an example of defensive programming
what is cohesion?
a desirable quality in which the responsibilities of a method or process are closely related to each other
What is coupling?
An undesirable state in which two methods or processes rigidly depend on each other
Chaining
an undesirable design in which a chain of several methods call each other without returning the overall flow of control to main
What's the difference between the for loop and while loop?
The incremental variable is declared inside the loop for a for loop. The opposite is true for the while loop
What are pseudorandom numbers?
numbers that, although they are derived from predictable and well-defined algorithms, mimic the properties of numbers chosen at random
Fencepost loop
to put up a fence that's 100 yard long, with a post being installed every 10 yards, you need 11 posts. The meaning is: a fencepost loop executes a loop-and-a-half by executing part …
sentinel
a value that signals when the end of a list of values has been reached (307,310)
short-circuited evaluation
The property of the logical operators && and || that prevents the second operand from being evaluated if the overall result is obvious from the value of the first operand
what is random?
A method from the Math class and a class from the java.util package
nextInt(), nextint(max), nextDouble(),nextBoolean()
name some methods from Random objects
what does it mean to prime a loop?
to initialize variables before a loop to guarantee that the loop is entered
List the Java Operator Precedence
unary, multiplicative, additive, relational, equality, logical AND, logical OR, assignment
what is a robust program?
a program that can execute even when presented with illegal data
how to solve a "fencepost problem?"
put the initial prompt before the loop and change the order of operations within the loop
what is an assertion?
a declarative sentence that's either true or false
provable assertion
an assertion that can be proven to be true at a particular point in program exectution
the scanner uses a method called hasInt()
How can a scanner determine whether the value it's reading is of int type
flags
what's another term for boolean varaibles?
program verification
a field of computer science that involves reasoning about the formal properties of programs to prove the correctness of a program
what is a file?
a file as a collection of information that is styored on a computer and assigned a particular name
We call on new to construct a file object to create an actual file: true or false?
False; the file object is an internal object that allows us to access files that already exist on the computer.
scanner object analogy
a scanner object is like a faucet that can be attached to a pipe that has water flowing through it. the water can come from various sources.
checked
an exception that must be caught or specifically declared in the header of the method that might generate it is called a _______ exception
throws clause
this declaration that a method won't attempt to handle a particular type of exception: