CS 232: Final

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

The import statement import java.util. ; imports the Scanner class and any other java.util classes as well.

*

The statement count _ 1; is identical in meaning to count = count + 1.

+=

______are pieces of information that are sent into, or passed to, a method, usually because the method requires the information to perform its task or carry out its purpose.

Arguments

A relational operator compares two items; an expression containing a comparison operator has a(n)______value.

Boolean

______variables are variables that are shared by every instantiation of a class.

Class

True or False: A variable comes into existence, or goes out of scope, when you declare it.

False

True or False: Each class you develop should only have one parameterized constructor.

False

True or False: If you create your own constructor, the automatically created constructor still exists.

False

True or False: In Java, if a class is public (that is, if you use the public access modifier before the class name), you must save the class in a file with exactly the same name and a .class extension.

False

True or False: In a Java if statement, the Boolean expression, such as (someVariable == 10), does not have to appear within parentheses.

False

True or False: Java will not promote types in a method call.

False

True or False: Object-oriented programming is a style of programming in which sets of operations are executed one after another in sequence.

False

True or False: String objects can be directly compared.

False

True or False: The cast type is the type to which all operands in an expression are converted so that they are compatible with each other.

False

True or False: The following code illustrates a valid condition to check whether your age is at least 21. if(age > 21)

False

True or False: Under some circumstances, the following println() statement will execute. if (payRate < 5.65 && payRate > 60) System.out.println("Error in pay rate");

False

True or False: When you declare variables in a class, you most often declare static instance variables.

False

True or False: When you use a loop within a loop, you should always think of the inner loop as the all-encompassing loop.

False

True or False: Within a looping structure, a floating-point expression is evaluated.

False

True or False: You can pass multiple arguments to a method by listing the arguments within the call to the method and separating them with colons.

False

True or False: You declare an array variable in the same way you declare any simple variable, but you insert a pair of curly brackets after the type.

False

True or False: if statements cannot be in a class's set method.

False

What is the value of the result in the following program code? char aChar = 'C'; Boolean result = Character.isWhitespace(aChar);

False

______True or False: Polymorphism refers to the hiding of data and methods within an object.

False

Which operator has the highest precedence?

Logical NOT

What is the fully qualified identifier of a method named displayName() declared within the Mailing class?

Mailing.displayName()

You use the______, which is written as the exclamation point ( ! ), to negate the result of any Boolean expression.

NOT operator

______if statements are particularly useful when two conditions must be met before some action is taken.

Nested

What is wrong with the following condition? Correct it. if (grade > 70 || grade <= 80)

The condition is true for every number. if (grade > 70 && grade <= 80)

True or False: A character that is a digit is represented in computer memory differently from a numeric value represented by the same digit.

True

True or False: A variable declaration is a statement that reserves a named memory location.

True

True or False: Expressing an is-a relationship is correct only when you refer to the object and the class in the proper order.

True

True or False: Just as you can block statements to depend on an if, you can also block statements to depend on an else.

True

True or False: The class String is defined in java.lang.String, which is automatically imported into every program you write.

True

True or False: The method declaration is the first line, or header, of a method.

True

True or False: The return type for a method can be any type used in Java.

True

True or False: Whether you decide to use a while, for, or do...while loop in an application, you can improve loop performance by making sure the loop does not include unnecessary operations or statements.

True

True or False: You are never required to use a switch structure; you can always achieve the same results with nested if statements.

True

True or False: You can change the length of a String in a StringBuilder object with the setLength() method.

True

True or False: You can write your own constructor method, and you often do so when you want to ensure that fields within classes are initialized to some appropriate default value.

True

______True or False: Not all classes have a main() method.

True

______casting forces a value of one data type to be used as a value of another type.

Type

A(n)______situation is one where the compiler cannot determine which version of a method to call.

ambiguous

______Stand-alone programs are called Java______.

applications

The______types are all variations of the integer type.

byte, short, and long

Given the following method declaration, write a valid method call. public static void calcArea(String roomName, int length, int width)

calcArea("Room 116", 23, 43);

In a switch statement,______is followed by one of the possible values for the test expression and a colon.

case

The______method requires an integer argument that indicates the position of the character that the method returns.

charAt()

Using a custom class as a class variable can be accomplished through______or______.

composition, nesting

The + sign in the following expression refers to the______operation. System.out.println("My age: " + ageVar);

concatenation

A variable or data field may be a(n)______; that is, it should not be changed during the execution of a program.

constant

The______is called when a class is instantiated.

constructor

An item's______describes the type of data that can be stored there, how much memory the item occupies, and what types of operations can be performed on the data.

data type

A(n)______structure involves choosing between alternative courses of action based on some value within a program.

decision

A(n)______constructor is one that requires no arguments.

default

A(n)______is a GUI object resembling a window in which you can place messages you want to display.

dialog box

The String class______method evaluates the contents of two String objects to determine if they are equivalent.

equals()

Public classes are accessible by all objects, which means that public classes can be ______, or used as a basis for any other class.

extended

A(n)______data type can hold floating-point values of up to six or seven significant digits of accuracy.

float

Strings and other objects that can't be changed are known as______.

immutable

A loop controlled by the user is a type of______loop because you don't know how many times it will eventually loop.

indefinite

The three elements within the for loop are used _____, ____, and ______ the control variable.

initialize, test, update

A(n)______dialog box asks a question and provides a text field in which the user can enter a response.

input

When you instantiate an object from a class, memory is reserved for each _______field in the class.

instance

______A(n)______of a class is an existing object of a class.

instance

The______method of the Character class returns true if the argument is a digit (0-9) and false otherwise.

isDigit()

To run the First application from the command line, you type______First.

java

To convert a String to an integer, you use the Integer class, which is part of ______ and is automatically imported into programs you write.

java.lang

To compile a file named First.java, you type______First.java and then press Enter.

javac

To write a definite loop, you initialize a(n)______, a variable whose value determines whether loop execution continues.

loop control variable

Combining loops to improve performance is referred to as______.

loop fusion

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

method

31. Besides data, classes contain______.

methods

The______operator returns the remainder of integer division.

modulus or %

An inside block is______, or contained entirely within, the outside block.

nested

When loops are______, each pair contains an inner loop and an outer loop.

nested

To allocate the needed memory for a class object, you must use the______operator.

new

Writing______programs involves creating classes, creating objects from those classes, and creating applications.

object-oriented

When you combine mathematical operations in a single statement, you must understand______, or the rules for the order in which parts of a mathematical expression are evaluated.

operator order of precedence

You use arithmetic _______to perform calculations with values in your programs.

operators

When you______a Java method, you write multiple methods with a shared name.

overload

A(n)______, or a library of classes, is simply a folder that provides a convenient grouping of classes.

package

A method of the Double class is the______method, which takes a String argument and returns its double value.

parseDouble()

The do...while loop is a(n)______loop—one in which the loop control variable is tested after the loop body executes.

post-test

A while loop is a(n)______loop—one in which the loop control variable is tested before the loop body executes.

pretest

Data fields within a class typically use the access specifier.

private

Using a programming language, programmers write a series of______, similar to English sentences, to carry out the tasks they want the program to perform.

program statements

Programmers often use _______, a tool that helps them plan a program's logic by writing plain English statements.

pseudocode

A(n)______is a series of if statements that determine whether a value falls within a specified range.

range check

As an object, a String variable name is not a simple data type. It is a(n)______; that is, a variable that holds a memory address.

reference

A(n)______statement causes a value to be sent from a called method back to the calling method.

return

Programming statements written in a high-level programming language are called ______.

source code

A(n)______is an integer contained within square brackets that indicates one of an array's variables, or elements.

subscript

The______reference reduces ambiguity in a method by ensuring the compiler uses the class variable.

this

The AND operator is written as______.

two ampersands or &&

Line comments start with______.

two forward slashes (//)

The prefix and postfix increment operators are _____ operators because you use them with one value.

unary

Verifying user data through a loop is the definition of______.

validating data

A data item is constant when it cannot be changed while a program is running. A data item is______when it might change.

variable

A(n)______loop is one in which the loop-controlling Boolean expression is the first statement in the loop.

while


संबंधित स्टडी सेट्स

Airway management and emergencies test EMT

View Set

Behavioral Neuroscience Chapter 12- Ingestive Behavior

View Set

Chapter 42 Circulation and Gas Exchange

View Set

Healthcare professionals (Metabolic Syndrome and Related Conditions)

View Set