cs-2336 quiz 1

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

The logical NOT operator

!

relational operator

> or <

data file

A collection of related records

absolute path

A complete path

passed by value

A copy of the value is made and used within the receiving method

type-safe

A data type for which only appropriate behaviors are allowed.

equality

A double equal sign

reference type

A nonprimitive object

int

A primitive type

return

A statement used to return an array from a method

jagged array

A two-dimensional array that has rows of different lengths

add() method

Adds an item to the end of an ArrayList

enhanced for loop

Allows you to cycle through an array without specifying the starting and ending elements

static import feature

Allows you to use static constants without their class name

set() method

Alters an item at a specified ArrayList location

switch statement

An alternative to using a series of nested if statements

length

An array field

foreach loop

An enhanced for loop

subscript

An integer that specifies an array element

side effect

Anything a method does other than altering a local variable or returning a value

multidimensional array

Arrays with more than one dimension

fill() method

Assigns the specified value to each element of the specified array

one-dimensional array

Can be pictured as a column of values

flushing

Clears any bytes that have been sent to a buffer for output but have not yet been output to a hardware device

range match

Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.

array variable

Declared in the same way you declare any simple variable, but with square brackets

wrapped

Encompassed

A catch block is a method that can be called directly and takes an argument that is some type of exception.

False

Although it is possible to block statements that depend on an if, you cannot likewise block statements that depend on an else.

False

The StringBuffer class is more efficient than the StringBuilder class because it can execute multiple threads during program execution.

False

The methods islowerCase() and toLowerCase() perform the same tasks.

False

You can declare an array variable by placing curly brackets after the array name.

False

stream

Functions as a pipeline or channel between a Java program and an input device

ternary operator

Has three operands

reference types

Hold memory addresses where values are stored

batch processing

Involves performing the same tasks with many records

elements

Numbered beginning with 0

InputStream and OutputStream are subclasses of the ____ class.

Object

sequence structure

One step follows another unconditionally

seekable

Operations can start at any specified position

ascending order

Placing objects in order beginning with the lowest value

Java object names

Represent computer memory addresses

System.getProperty("line.separator")

Returns the default line separator for a system

instant access files

Same as random access files

conditional operator

Separated with a question mark and a colon

flowchart

Sequence of steps written in diagram form

volatile storage

Temporary storage

| |

The logical OR operator

root

The main directory of your storage device

buffer

The memory location where bytes are held after they are logically output but before they are sent to the output device

dynamically resizable

The size can change during program execution

close the files

To make files no longer available to your application

pseudocode

Tool that helps plan a program's logic by writing down steps in plain English

In a compareTo() method, programmers often do not need specific return values but want to determine if a value is positive or negative.

True

Since the ArrayList class is part of the java.util package, you can use the java.util.*; import statement to access it.

True

When array elements are passed by value, a copy of the value is made and used within the receiving method.

True

logical AND operator

Two ampersands

parallel arrays

Two or more arrays in which the values in corresponding elements are related

dual-alternative

Two possible courses of action

matrix

Two-dimensional array

static methods

Use them with the class name without instantiating an object

pipes

Used in the OR operator

out of bounds

Using a subscript that is too small (that is, negative) or too large for an array,

BufferedWriter

Writes text to an output stream, buffering the characters

What is the output of the following code: ​ for (loop = 1; loop <3; ++loop) System.out.print(1); for (loop2 = 1; loop2<3; ++loop2) System.out.print(2); ​

a. 122122

Which of the following correctly declares and initializes a String object?

a. String greeting = "Hello";

Which of the following println statements will display the last myScores element in an array of 10?

a. System.out.println(vals[9]);

A ____ is a structure that allows repeated execution of a block of statements.

a. loop

String oneStr = "Welcome Jim" String twoStr = "Welcome Joe" Given the lines of code above, which of the following regionMatches() expressions will result in a value of true?

a. oneStr.regionMatches(0, twoStr, 0, 7)

Consider the statement: int anInt = Integer.parseInt("649"); You can tell that parseInt() is a(n) ____ method because you use it with the class name and not with an object.

a. static

The ____ option must be used when running a program in order to see the results of assert statements.

b. -ea

The memory location known as the ____ is where the computer stores the list of method locations to which the system must return.

b. call stack

When mathematicians use a two-dimensional array, they often call it a ____.

b. matrix

Assume d and x are integers: d = 5; x = 2 * ++d; What is the value of x?

c. 12

When a method returns an array reference, you include ____ with the return type in the method header.

c. [ ]

The AND operator is written as two ____.

c. ampersands

A literal string is called a(n) ____.

c. anonymous object

A(n) ____ is a Java language feature that can help you detect logic errors that do not cause a program to terminate, but nevertheless produce incorrect results.

c. assertion

System.out.println("Your name is " + yourName); The above statement is an example of ____, which is used to join Strings.

c. concatenation

A for loop provides a convenient way to create a(n) ____ loop.

c. counter-controlled

What kind of loop is this: response = keyboard.nextInt(); while (response == 1) { System.out.print ("Enter 1 to continue; 0 to stop"); response = keyboard.nextInt(); }

c. event-driven

How would you create an array named someNumbers that holds three rows and four columns?

c. int[][] someNumbers = new int[3][4];

A logical structure called a(n) ____ structure is when one step follows another unconditionally.

c. sequence

When you declare int[] someNums = new int[10]; , each element of someNums has a value of ____.

d. 0

How many times will outputLabel be called?for(customer = 1; customer <= 20; ++customer)for(color = 1; color <= 3; ++color) outputLabel();

d. 60

Which operator has the highest precedence?

d. NOT (!)

____ is an abstract class for reading character streams.

d. Reader

A StringBuilder object contains a memory block called a _____, which might or might not contain a string.

d. buffer

The disadvantage to using the conditional operator is that it ____.

d. can be difficult to read

An ArrayList's ____ is the number of items it can hold without having to increase its size.

d. capacity

The ____ method requires an integer argument that indicates the position of the character at that position, starting at 0.

d. charAt()

A(n) ____ is a kind of indefinite loop.

d. event-controlled

After you create a FileSystem object, you can define a Path using the ____ method with it.

d. getPath()

With a two-dimensional array, the ____ field holds the number of rows in the array.

d. length

If a class has only a default constructor, you must call the constructor using the keyword ____ for each declared array element.

d. new

A data file can be used as a(n) ____ file when each record is accessed one after another in the order in which it was stored.

d. sequential access

When working with logical operators, you can always use ____ to change precedence.

parentheses

The Java compiler does not require that you catch or specify ____ exceptions.

runtime

Boolean values

true and false

Any ____ block might throw an Exception for which you did not provide a catch block.

try


Kaugnay na mga set ng pag-aaral

Patho Chapter 16 Disorders of the Immune Response

View Set

AP Psychology Conditioning, Learning, and Retention

View Set

Business Finance Ch 2 Reading assignment

View Set

Anatomy: Chapter 7 and 8 Homework

View Set

Language Learning Materials Development

View Set