Final exam review Java

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Identify the false statement. a. The first element in any array has a subscript of 0, no matter what data type is stored. b. In Java, you can use a variable as well as a constant to declare an array's size. c. The statement int[] idNums = new int[35]; reserves enough memory for exactly 34 integers.

c. The statement int[] idNums = new int[35]; reserves enough memory for exactly 34 integers.

A ____ translates high-level language statements into machine code.

compiler

After you write and save a Java application file, you ____ and then ____ it.

d. compile, interpret

A loop that never ends is a(n) _____ loop.

d. infinite

The command to execute a compiled Java application is ____.

java

A(n) ____ is a program module that contains a series of statements that carry out a task.

method

To allocate the needed memory for an object, you must use the ____ operator.

new

Envisioning program components as objects that are similar to concrete objects in the real world is the hallmark of ____.

object-oriented programming

All method declarations contain ____.

paraentheses

Arguments to methods always appear within ____.

parentheses

A(n) _____ is the first input statement prior to a loop that will execute subsequent input statements for the same variable.

priming read

The individual operations used in a computer program are often grouped into logical units called ____.

procedures

The Scanner class contains methods that retrieve values, referred to as ____, from an input device.

tokens

The prefix ++ is a _____ operator.

unary

You reserve memory locations for an array when you _____.

use the keyword new

To construct a loop that works correctly, you should initialize a loop control _____.

variable

Named computer memory locations are called ____.

variables

Assuming a variable f has been initialized to 5, which of the following statements sets g to 0? a. All of the above statements set g to 0 b. if(f > 6 || f == 5) g = 0; c. if(f < 3 || f > 4) g = 0; d. if(f >= 0 || f < 2) g = 0;

all of the above

Identify the false statement. a. A variable declaration is a statement that reserves a named memory location and includes a data type, an identifier, an optional assignment operator and assigned value, and an ending semicolon. b. An item's data type determines what legal identifiers can be used to describe variables and whether the variables can occupy memory. c. A variable is a named memory location that you can use to store a value; it can hold only one value at a time, but the value it holds can change.

b. An item's data type determines what legal identifiers can be used to describe variables and whether the variables can occupy memory.

Which of the following is not an option that can be displayed with a confirm dialog box?

b. Try Again

Identify the false statement. a. An object name is a reference; it holds a memory address. b. When you declare an object, you give it a name and set aside enough memory for the object to be stored. c. When you don't write a constructor for a class, Java creates one for you; the name of the constructor is always the same as the name of its class.

b. When you declare an object, you give it a name and set aside enough memory for the object to be stored.

A boolean variable can hold ____.

b. the value true or false

The modulus operator ( % ) is a _____ operator.

binary

You can use the _____ statement to terminate a switch structure.

break

Which of the following data types can store a value in the least amount of memory?

byte

If g = 5, then after h = ++g, the value of h is _____.

6

All Java programming statements must end with a ____.

All Java programming statements must end with a ____.

An array is a list of data items that _____.

all have the same type

When you pass an array element to a method, the method receives _____.

c. a copy of the value in the element

In Java, you can declare an array of 12 elements and initialize _____

c. all of them

A value that stops a loop is a _____.

sentinel

When you pass an array to a method, the method receives _____.

a. the address of the array

The Java ____ contains information about how to use every prewritten Java class, including lists of all the methods you can use with the classes.

d. API

Which of the following will not help improve loop performance?

d. Making a comparison to -1.

If a class is named Student, the class constructor name is____.

d. Student()

To create interactive programs that accept input from a user, you can use ____.

d. System.in

The method public static boolean testValue(int response) returns ____.

d. a boolean value

The _____ allows you to cycle through an array without specifying the starting and ending points for the loop control variable.

d. enhanced for loop

The remainder operator ____.

d. is also called the modulus operator

The most basic circuitry-level computer language, which consists of on and off switches, is ____.

d. machine language

An if statement is sometimes called a _____.

d. single-alternative selection

Which of the following is a floating-point data type that Java supports?

double

In Java, the value of (4 > 7) is _____.

false

A variable that holds a value as an indicator of whether some condition has been met is known as a(n) _____.

flag

Loop _____ is the technique of combining two loops into one.

fusion

A parallel array is one that _____.

holds values that correspond to those in another array

Using a(n) ____ statement, Java allows you to access built-in classes that are contained in a group of classes called a package.

import

The principle used in creating private access is sometimes called ____ and is an important component of object-oriented programs.

information hiding

An object is a(n) ____ of a class, or one tangible example of a class.

instantation

The method with the declaration public static int aMethod() has a method type of ____.

int

Java does not execute instructions on a computer directly, but rather on the ____.

java virtual machine

Java is architecturally ____.

neutral

Unicode value '\u0000' is also known as _____.

null

Providing values for all the elements in an array is called _____.

populating an array

When incrementing the loop control variable in a for statement, using the _____ operator produces a faster loop.

prefix increment

Most class data fields are ____.

private

A(n) _____ of an object is an instance variable or field.

property

A _____ is a series of statements that determine to which of several consecutive series of values another value falls.

range check

A method's ____ is the combination of the method name and the number, types, and order of arguments.

signature

If total = 100 and amt = 200, then after the statement total += amt, _____.

total is equal to 300

When you must make a series of decisions in a program, it is most efficient to first ask the question that is most likely to be _____.

true

You must always include _____ in a for loop's parentheses.

two semicolons

You use a ____ to explicitly override an implicit type.

type cast

Identify the false statement. a. Polymorphism is the ability to create classes that share the attributes and methods of existing classes, but with more specific features. b. An instance of a class is a created object that possesses the attributes and methods described in the class definition. c. Encapsulation protects data by hiding it within an object.

a. Polymorphism is the ability to create classes that share the attributes and methods of existing classes, but with more specific features.

Identify the false statement. a. To compile a file named MyProgram.java, you type java MyProgram, but to execute the program you type java MyProgram.java. b. When you compile a program, sometimes one error in syntax causes multiple error messages. c. In Java, if a class is public, you must save the class in a file with exactly the same name and a .java extension.

a. To compile a file named MyProgram.java, you type java MyProgram, but to execute the program you type java MyProgram.java.

Identify the false statement. a. When one if statement follows another, the first else clause encountered is paired with the first if that occurred before it. b. Statements in which an if structure is contained inside another if structure commonly are called nested if statements. c. A complete nested if...else structure always fits entirely within either the if portion or the else portion of its outer if...else statement.

a. When one if statement follows another, the first else clause encountered is paired with the first if that occurred before it.

Identify the false statement. a. You pass an array to a method using its name followed by a pair of brackets; arrays are passed by value. b. When a method returns an array reference, you include square brackets with the return type in the method header. c. You pass a single array element to a method using its name, and the method must be prepared to receive the appropriate data type.

a. You pass an array to a method using its name followed by a pair of brackets; arrays are passed by value.

When you perform arithmetic with values of diverse types, Java ____.

a. implicitly converts the values to a unifying type

An instance of a class is a(n) ____.

a. object

Identify the false statement. a. Static methods are instance methods. b. The keyword static is used with classwide methods, but not for methods that "belong" to objects. c. When you create a class from which objects will be instantiated, most methods are nonstatic because they are associated with individual objects.

a. static methods are instance methods

Using a method name to contain or encapsulate a series of statements is an example of ____.

abstraction

Identify the false statement. a. A well-written while loop contains an initialized loop control variable that is tested in the while expression and then altered in the loop body. b. A finite loop executes a specific number of times; an indefinite loop is one that never ends. c. In an indefinite loop, you don't know how many times the loop will occur.

b. A finite loop executes a specific number of times; an indefinite loop is one that never ends.

dentify the false statement. a. Any class can contain an unlimited number of methods. b. A method is usually written within another method. c. During one program execution, a method might be called any number of times.

b. A method is usually written within another method.

Identify the false statement. a. Assume p, q, and r are all Boolean variables that have been assigned the value true. After the following statement executes, the value of p is still true. p = !(!q && !r); b. Assume p, q, and r are all Boolean variables that have been assigned the value true. After the following statement executes, the value of p is still true. p = !(q || !r); c. Assume p, q, and r are all Boolean variables that have been assigned the value true. After the following statement executes, the value of p is still true. p = !q || r;

b. Assume p, q, and r are all Boolean variables that have been assigned the value true. After the following statement executes, the value of p is still true. p = !(q || !r);

Identify the false statement. a. In the method header public static void main(String[] args), the word static means that a method is accessible and usable, even though no objects of the class exist. b. In the method header public static void main(String[] args), the word void means that the main() method is an empty method. c. In the method header public static void main(String[] args), the word public is an access specifier.

b. In the method header public static void main(String[] args), the word void means that the main() method is an empty method.

Identify the false statement. a. A Boolean variable can hold only one of two values—true or false. b. Java supports six relational operators that are used to make comparisons: =, <, >, =<, =>, and =! c. An expression that contains a relational operator has a Boolean value.

b. Java supports six relational operators that are used to make comparisons: =, <, >, =<, =>, and =!

Identify the false statement. a. Java programs that are embedded in a Web page are called applets, while stand-alone programs are called Java applications. b. Java was developed to be architecturally neutral, which means that anyone can build an application without extensive study. c. After you write a Java program, the compiler converts the source code into a binary program of bytecode.

b. Java was developed to be architecturally neutral, which means that anyone can build an application without extensive study.

Identify the false statement. a. Javadoc comments begin with a forward slash and two asterisks ( /** ) and end with an asterisk and a forward slash ( */ ); they are used to generate documentation with a program named javadoc. b. Line comments start with two forward slashes ( // ) and end with two backslashes ( \\ ); they can extend across as many lines as needed. c. Block comments start with a forward slash and an asterisk ( /* ) and end with an asterisk and a forward slash ( */ ); they can extend across as many lines as needed.

b. Line comments start with two forward slashes ( // ) and end with two backslashes ( \\ ); they can extend across as many lines as needed.

In each Two Truths and a Lie, two of the given statements are true, and one is false. Identify the false statement. a. Unlike a low-level programming language, a high-level programming language allows you to use a vocabulary of reasonable terms instead of the sequences of on and off switches that perform the corresponding tasks. b. Logic errors are fairly easy to find because the software that translates a program finds all the logic errors for you. c. A syntax error occurs when you misuse a language; locating and repairing all syntax errors is part of the process of debugging a program.

b. Logic errors are fairly easy to find because the software that translates a program finds all the logic errors for you.

Check My Work Identify the false statement. a. In Java, operator precedence dictates that multiplication, division, and remainder always take place prior to addition or subtraction in an expression. b. The arithmetic operators are examples of unary operators, which are so named because they perform one operation at a time. c. Floating-point arithmetic might produce imprecise results.

b. The arithmetic operators are examples of unary operators, which are so named because they perform one operation at a time.

Check My Work Identify the false statement. a. When the statements in a loop body must execute at least one time, it is convenient to use a do...while loop. b. The do...while loop checks the value of the loop control variable at the top of the loop prior to loop execution. c. When the body of a do...while loop contains a single statement, you do not need to use curly braces to block the statement.

b. The do...while loop checks the value of the loop control variable at the top of the loop prior to loop execution.

Identify the false statement. a. A loop is a structure that allows repeated execution of a block of statements as long as a tested expression is true. b. When the Boolean evaluation tested in a loop becomes false, the loop body executes one last time. c. If a loop's tested Boolean expression is true, a block of statements called the loop body executes before the Boolean expression is evaluated again.

b. When the Boolean evaluation tested in a loop becomes false, the loop body executes one last time.

Identify the false statement. a. A variable of type int can hold any whole number value from approximately negative two billion to positive two billion. b. You can use the data types byte or short to hold larger values than can be accommodated by an int. c. When you assign a value to an int variable, you do not type any commas; you type only digits and an optional plus or minus sign to indicate a positive or negative integer.

b. You can use the data types byte or short to hold larger values than can be accommodated by an int.

To construct an array of objects using a default constructor, you must call the constructor using the keyword new for_____.

b. each declared array element

If you attempt to add a float, an int, and a byte, the result will be a(n) ____.

b. float

When loops are nested, each pair contains a(n) _____ loop and a(n) _____ loop.

b. inner, outer

Java supports three types of comments: ____, ____, and javadoc.

b. line, block

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

b. loop

If you use the automatically-supplied default constructor when you create an object, ____.

b. numeric fields are set to 0 (zero)

Identify the false statement. . An escape sequence always begins with a backslash followed by a character; the pair represents a single character. b. To store a string of characters, you use a data structure called a Text; string constants are written between parentheses. c. You use the char data type to hold any single character; you place constant character values within single quotation marks.

b. to store a string of characters, you use a data structure called a Text; string constants are written between parentheses.

A single array element of a primitive type is passed to a method by _____.

b. value

Identify the false statement. a. A class header contains an optional access specifier, the keyword class, and an Identifier. b. When you instantiate objects, each has its own copy of each static data field in the class. c. Most fields in a class are private, and most methods are public.

b. when you instantiate objects, each has its own copy of each static data field in the class.

An escape sequence always begins with a(n) ____.

backslash

Identify the false statement. a. You can create an input dialog box using the showInputDialog() method; the method returns a String that represents a user's response. b. You can use methods from the Java classes Integer and Double when you want to convert a dialog box's returned values to numbers. c. A confirm dialog box can be created using the showConfirmDialog() method in the JOptionPane class; a confirm dialog box displays the options Accept, Reject, and Escape.

c. A confirm dialog box can be created using the showConfirmDialog() method in the JOptionPane class; a confirm dialog box displays the options Accept, Reject, and Escape.

Identify the false statement. a. When a method is declared with public access, methods in other classes can call it. b. Not all methods return a value, but every method requires a return type. c. A method header is also called an implementation

c. A method header is also called an implementation

Identify the false statement. a. Syntax errors are compile-time errors. b. When you compile a class, you create a new file with the same name as the original file but with a .class extension. c. After you write and save an application, you can compile the bytecode to create source code.

c. After you write and save an application, you can compile the bytecode to create source code.

Identify the false statement. a. Assume that x = 4 and y = 5. The value of ++y + ++x is 11. b. Assume that x = 4 and y = 5. The value of y += x is 9. c. Assume that x = 4 and y = 5. The value of y == x++ is true.

c. Assume that x = 4 and y = 5. The value of y == x++ is true.

Identify the false statement. a. In a Java if statement, the keyword if is followed by a Boolean expression within parentheses. b. When determining equivalency in Java, you use a double equal sign. c. In a Java if statement, a semicolon follows the Boolean expression.

c. In a Java if statement, a semicolon follows the Boolean expression.

Identify the false statement. a. To execute more than one statement that depends on the evaluation of a Boolean expression, you use a pair of curly braces to place the dependent statements within a block. b. When you declare a variable within a block, it is local to that block. c. Indentation can be used to cause statements following an if statement to depend on the evaluation of the Boolean expression.

c. Indentation can be used to cause statements following an if statement to depend on the evaluation of the Boolean expression.

Check My Work Identify the false statement. a. System.in refers to the standard input device, which normally is the keyboard. b. When a user types data followed by the Enter key, the Enter key character is left in the keyboard buffer after Scanner class methods retrieve the other keystrokes. c. System.in is more flexible than System.out because it can read all the basic Java data types.

c. System.in is more flexible than System.out because it can read all the basic Java data types.

Check My Work Identify the false statement. a. To use a method that belongs to an object that is part of an array, you insert the appropriate subscript notation after the array name and before the dot that precedes the method name. b. The following statement declares an array named students that holds 10 Student objects: Student[] students = new Student[10]; c. When a class has a default constructor and you create an array of objects from the class, you do not need to call the constructor explicitly.

c. When a class has a default constructor and you create an array of objects from the class, you do not need to call the constructor explicitly.

Check My Work Identify the false statement. a. The switch statement is useful when you need to test a single variable against a series of exact integer or character values. b. A break statement bypasses the rest of its switch structure, and execution continues with any statement after the closing curly brace of the switch structure. c. When you must make more decisions than Java can support, you use a switch statement instead of nested if...else statements.

c. When you must make more decisions than Java can support, you use a switch statement instead of nested if...else statements.

Identify the false statement. a. Summing a double, int, and float results in a double. b. You can explicitly override the unifying type imposed by Java by performing a type cast; type casting forces a value of one data type to be used as a value of another type. c. When you perform arithmetic operations with operands of unlike types, you must make an explicit conversion to a unifying type.

c. When you perform arithmetic operations with operands of unlike types, you must make an explicit conversion to a unifying type.

Check My Work Identify the false statement. a. When you use the && and || operators, you must include a complete Boolean expression on each side. b. The AND operator is written as two ampersands ( && ), and the OR operator is written as two pipes ( || ). c. When you use an && or || operator, each Boolean expression that surrounds the operator is always tested in order from left to right.

c. When you use an && or || operator, each Boolean expression that surrounds the operator is always tested in order from left to right.

Identify the false statement. a. A for loop always must contain two semicolons within its parentheses. b. The body of a for loop might never execute. c. Within the parentheses of a for loop, the last section must alter the loop control variable.

c. Within the parentheses of a for loop, the last section must alter the loop control variable.

Identify the false statement. a. You can improve loop performance by making sure the loop does not include unnecessary operations in the body of the loop. b. You can improve the performance of a loop by making sure the loop does not include unnecessary operations in the tested expression. c. You can improve loop performance when two conditions must both be true by testing for the most likely occurrence first.

c. You can improve loop performance when two conditions must both be true by testing for the most likely occurrence first.

Identify the false statement. a. An inner nested loop must be entirely contained within its outer loop. b. The body of the following loop executes 20 times: for(int x = 0; x < 4; ++x) for(int y = 0; y < 5; ++y) System.out.println("Hi"); c. You can place a while loop within a while loop or a for loop within a for loop, but you cannot mix loop types.

c. You can place a while loop within a while loop or a for loop within a for loop, but you cannot mix loop types.

When you initialize an array by giving it values upon creation, you _____.

c. do not explicitly give the array a size

Which of the following can be used as an array subscript? a. double b. character c. int d. String

c. int

When you execute an if...else statement, _____ takes place depending on the evaluation of the Boolean expression.

c. only one of the resulting actions

A method is declared as public static void showResults(double d, int i). Which of the following is a correct method call?

c. showResults(12.2, 67);

Which of the following shows the correct syntax for the conditional operator?

c. testExpression ? trueResult : falseResult;

If you want to take more than one action following the evaluation of a Boolean expression within an if statement, you use a pair of _____ to place the dependent statements within a block.

curly braces

The _____ field contains the number of elements in the array.

length

In a _____, you commonly compare a value to the low or high endpoint of each of a series of numerical ranges, but not to the midpoint.

range match

When you run your program you don't see evidence of the changes you just made to it. You realize that you forgot to ____ the program.

recompile

A(n) ____ statement causes a method to end and the program's logic to return to the calling method.

return

Which of the following could be the last legally coded line of a method declared as public static int getVal(double sum)?

return 77;

The logical structure in which one instruction occurs after another with no branching is a _____.

sequence

The term ____ refers to the mathematical accuracy of a value.

significant digits

When you declare an array, _____.

you might reserve memory for it in the same statement

When data cannot be changed while a program is running, the data is ____.

constant

If j = 5 and k = 6, then the value of j++ == k is _____.

b. false

If a method should return an array to its calling method _____.

b. the return type in the method header is followed by square brackets

One execution of any loop is called a(n) _____.

c. iteration

Which of the following groups has the lowest operator precedence? a. equality b. addition c. logical OR d. relationa

c. logical OR

Check My Work Identify the false statement. a. As with integers, you can perform the mathematical operations of addition, subtraction, multiplication, and division with floating-point numbers. b. Java supports two floating-point data types: float and double. The double data type requires more memory and can hold more significant digits. c. A floating-point constant, such as 5.6, is a float by default.

a floating point constant, such as 5.6, is a float by default

If m = 9, then after n = m++, the value of n is _____.

a. 9

Identify the false statement. a. A method header always contains a return type, an identifier, and a parameter list within parentheses. b. Arguments are used in method calls; they are passed to parameters in method headers. c. A class can contain any number of methods, and each method can be called any number of times.

a. A method header always contains a return type, an identifier, and a parameter list within parentheses.

Identify the false statement. a. Pseudocode and flowcharts are both tools that are used to check the syntax of computer programs. b. In a sequence structure, one step follows another unconditionally. c. In a decision structure, alternative courses of action are chosen based on a Boolean value.

a. Pseudocode and flowcharts are both tools that are used to check the syntax of computer programs.

Identify the false statement. a. The conditional operator is used as an abbreviated version of the if...else structure and requires two expressions separated with an exclamation point. b. The value of any false expression becomes true when preceded by the NOT operator. c. The NOT operator is written as the exclamation point ( ! ).

a. The conditional operator is used as an abbreviated version of the if...else structure and requires two expressions separated with an exclamation point.

The loop that performs its conditional check at the bottom of the loop is a _____ loop

a. do...while

When you declare a variable within a block, it _____.

a. is local to that block

The _____ feature is one in which expressions on each side of the && and || operators are evaluated only as far as necessary to determine whether the entire expression is true or false.

a. short-circuit evaluation

A(n) ____ data type is a type whose implementation is hidden and accessed through its public methods.

abstract

Identify the false statement. a. An application or class that instantiates objects of another prewritten class is a class client. b. A class is an instantiation of many objects. c. Objects gain their attributes and methods from their classes.

b. A class is an instantiation of many objects.

Identify the false statement. a. When you write a constructor, it must have the same name as the class it constructs, and it cannot have a return type. b. In Java, you cannot write a default constructor; it must be supplied for you automatically. c. The automatically supplied default constructor sets all numeric fields to 0, character fields to Unicode '\u0000', Boolean fields to false, and fields that are object references to null.

b. In Java, you cannot write a default constructor; it must be supplied for you automatically.

Identify the false statement. a. When searching an array, it is usually most efficient to abandon the search as soon as the sought-after element is found. b. In a range match, you commonly compare a value to the midpoint of each of a series of numerical ranges. c. A parallel array is one with the same number of elements as another and for which the values in corresponding elements are related.

b. In a range match, you commonly compare a value to the midpoint of each of a series of numerical ranges.

Identify the false statement. a. When you must make a series of decisions in a program, it is most efficient to first ask the question that is most likely to be true. b. The statement if(payRate < 6.00 && payRate > 50.00) can be used to select payRate values that are higher or lower than the specified limits. c. A range check is a series of statements that determine within which of a set of ranges a value f

b. The statement if(payRate < 6.00 && payRate > 50.00) can be used to select payRate values that are higher or lower than the specified limits.

Identify the false statement. a. When you declare a primitive variable or instantiate an object from a class, you provide both a type and an identifier. b. Unlike a primitive variable, an instantiated object cannot be passed into or returned from a method. c. The address of an instantiated object can be assigned to a declared reference of the same type.

b. Unlike a primitive variable, an instantiated object cannot be passed into or returned from a method.

Identify the false statement. a. When you declare int[] idNums = new int[35];, each element of the array has a value of 0. b. When you declare int[] scores = {100, 90, 80};, the first three elements of the array are assigned the values listed, but all the remaining elements are assigned 0. c. When you declare double[] salaries = new double[10];, each element of the array has a value of 0.0.

b. When you declare int[] scores = {100, 90, 80};, the first three elements of the array are assigned the values listed, but all the remaining elements are assigned 0.

In which of the following situations would setting up parallel arrays be most useful? a. You need to calculate interest earned on a savings account balance. b. You need to look up an employee's ID number to find the employee's last name. c. You need to determine the shortest distance between two points on a map.

b. You need to look up an employee's ID number to find the employee's last name.

Identify the false statement. a. A dialog box is a GUI object resembling a window in which you can place messages you want to display. b. You use an append statement when you want to access a built-in Java class that is contained in a group of classes called a package. c. Different methods can require different numbers of arguments.

b. You use an append statement when you want to access a built-in Java class that is contained in a group of classes called a package.

Which of the following is a correct call to a method declared as public static void aMethod(char code)?

b. aMethod('Q');

Which of the following elements is not required in a variable declaration?

b. an assigned value

Assuming you have declared balance to be a variable of type int, which of the following is a valid assignment statement in Java?

b. balance = 9000;

Which of the following is typically used in a flowchart to indicate a decision?

b. diamond

You save text files containing Java source code using the file extension ____.

c. .java

The assignment operator in Java is ____.

c. =

The "equal to" relational operator is ____.

c. ==

Identify the false statement. a. The return type for a method can be any type used in Java, including int, double, and void. b. You cannot place a method within another method, but you can call a method from within another method. c. A method's declared return type must match the type of the value used in the parameter list.

c. A method's declared return type must match the type of the value used in the parameter list.

Identify the false statement. a. When an application contains an array, it is common to perform loops that vary the loop control variable from 0 to one less than the size of the array. b. The enhanced for loop allows you to cycle through an array without specifying the starting and ending points for the loop control variable. c. An array's length field contains the highest value that can be used as the array's subscript.

c. An array's length field contains the highest value that can be used as the array's subscript.

Which assignment is correct in Java?

c. char aChar = '*';

A program or class that instantiates objects of another prewritten class is a(n) ____.

c. class client

Non-executing program statements that provide documentation are called program ____.

comments

An expression that combines Boolean tests into a single expression using the logical AND and OR operators are known as a(n) _____ condition.

compound

The operator that combines two conditions into a single Boolean value that is true only when both of the conditions are true, but is false otherwise, is _____.

d. &&

To prevent a while loop from executing infinitely, which of the following actions must not occur? a. A loop control variable is initialized to a starting value. b. The loop control variable is tested in the while statement. c. The loop control variable is altered within the body of the loop. d. The loop control variable is reset to its starting value during each iteration of the loop.

d. The loop control variable is reset to its starting value during each iteration of the loop.

The switch statement is useful when you need to test a single variable against a series of any of the following values except a(n) _____.

double

A(n) _____ loop is an indefinite loop in which the number of executions is determined by user actions.

event-controlled

Assuming a variable y has been assigned the value 6, the value of !(y < 7) is _____.

false

Objects contain methods and data items, which are also known as ____.

feilds

Methods that set or change field values are called ____ methods.

mutator

Statements in which an if statement is contained inside another if statement commonly are called _____ if statements.

nested

Which of the following is not a primitive data type in Java? a. byte b. int c. boolean d. sector

sector

The values of an object's attributes also are known as its ____.

state

According to the rules of operator precedence, when division occurs in the same arithmetic statement as ____, the division operation always takes place first.

subtraction

The rules of a programming language constitute its ____.

syntax

The operator that combines two conditions into a single Boolean value that is true when at least one of the conditions is true is _____.

||


Ensembles d'études connexes

Health policy provisions, clauses, and riders

View Set

Real Estate Exam 6 (law and practice)

View Set

StatQuest Linear Regression , Gradient Descent

View Set

Complétez les phrases en utilisant "c'était", "il y avait" ou "il faisait".

View Set

Chapter 16 Biogeochemical Cycles

View Set

Chapter 40 Care of Patients with Acute Coronary Syndromes

View Set

The Five Practices of Exemplary Leadership

View Set

Learning: Module 1: Sections 1_01-1_02

View Set