OOP Chapter (1, 2, 3) Multiple Choice Questions

¡Supera tus tareas y exámenes ahora con Quizwiz!

____ 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

____ refers to the order in which values are used with operators.

Associativity

____ refers to the hiding of data and methods within an object.

Encapsulation

____ is the encapsulation of method details within a class.

Implementation hiding

____ occurs when both of the operands are integers.

Integer division

The command to execute a compiled Java application is _____________.

Java

____ is the process the compiler uses to divide your source code into meaningful portions; the message means that the compiler was in the process of analyzing the code when the end of the file was encountered prematurely.

Parsing

____ are also called modules, methods, functions, and subroutines. Java programmers most frequently use the term "method."

Procedures

A(n) ____________________ operator compares two items and the result has a Boolean value.

Relational

In Java, ____ is a built-in class that provides you with the means for storing and manipulating character strings.

String

When a numeric variable is concatenated to a String, the entire expression becomes a(n) ____.

String

Which Java statement produces the following output?

System.out.println("w\nxyz");

Line comments start with ____.

Two forward slashes ( // )

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

a boolean value

In Java, methods must include all of the following except ___________.

a call to another method

The remainder operator ___________.

%

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

aMethod('Q');

A(n) ____ defines the circumstances under which a class can be accessed and the other classes that have the right to use a class.

access specifier

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

an assigned value

Programs that are embedded in a Web page are called Java ____.

applets

Data items you use in a call to a method are called ____.

arguments

You use ____ operators to perform calculations with values in your programs.

arithmetic

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

backslash

A(n) ____ variable can hold only one of two values: true or false.

boolean

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

byte

You must compile classes written in Java into _____________.

bytecode

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

casting

The method with the declaration public static char procedure(double d) has a method type of ___________.

char

Which assignment is correct in Java?

char aChar = ′*′;

A public static method named computeSum() is located in classA. To call the method from within classB, use the statement ___________.

classA.computeSum();

Whenever a method requires multiple arguments, the arguments are always separated with ____.

commas

Nonexecuting program statements that provide documentation are called _____________.

comments

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

compile and then interpret

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

compiler

A data item is ____ when it cannot be changed while a program is running.

constant

When data cannot be changed after a class is compiled, the data is ___________.

constant

Locating and repairing all syntax errors is part of the process of ____ a program.

debugging

The method ____ is the first line of a method.

declaration

In a Java program, you must use _____________ to separate classes, objects, and methods.

dots

A ____ data type can hold 14 or 15 significant digits of accuracy.

double

Which assignment is correct in Java?

double money = 12; double money = 12.0; double money = 12.0d;

Which assignment is correct in Java?

double value = 2.12;

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

float

Languages that let you use an easily-understood vocabulary of descriptive terms, such as read, write, or add, are known as _____________ languages.

high-level

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

implicitly converts the values to a unifying type

In Java, you use variables of type ____ to store integers, or whole numbers.

int

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

int

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

line, block

A(n) ____ variable is known only within the boundaries of the method.

local

If a compiler detects a violation of language rules, it refuses to translate the class to ____.

machine code

A program written in ____ is the most basic circuitry-level language.

machine language

The most basic circuitry-level computer language is

machine language

All Java applications must have a method named _____________.

main( ) (Many java classes do not contain a main method but all executable java programs do)

The ____ method executes first in an application, regardless of where you physically place it within its class.

main()

When an application is run, the method that must be executed first must be named ____.

main()

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

method

Java is architecturally _____________.

neutral

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

object

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 ___________.

parentheses

Arguments to methods always appear within _____________.

parentheses

In Java, when a numeric variable is concatenated to a String using the ____, the entire expression becomes a String.

plus sign

____ describes the feature of languages that allows the same word to be interpreted correctly in different situations based on the context.

polymorphism

A unique identifier is most likely used as a ____ key in a database.

primary

A(n) ____________________ is a simple data type.

primitive

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

procedures

Which of the following method declarations is correct for a static method named displayFacts() if the method receives an int argument?

public static void displayFacts(int data)

Primitive types serve as the building blocks for more complex data types, called ____ types.

reference

The percent sign is the ____ operator.

remainder

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

return 77;

A ____ is an error not detected until the program asks the computer to do something wrong, or even illegal, while executing.

run-time error

Which of the following is not a primitive data type in Java?

sector

All Java programming statements must end with a _____________.

semicolon (Lines do not necessarily end with a semicolon—just complete statements.)

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

shoeSize = 9;

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

showResults(12.2, 67);

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

significant digits

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

state

In Java, the reserved keyword ____ means that a method is accessible and usable even though no objects of the class exist.

static

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

subtraction

Which of the following is NOT a component of a variable declaration statement?

symbolic constant

The rules of a programming language constitute its _____________.

syntax

You may declare an unlimited number of variables in a statement as long as the variables are ____.

the same data type

A boolean variable can hold ___________.

the value true or false

You use a ___________ to explicitly override an implicit type.

type cast

The ____ is the type to which all operands in an expression are converted so that they are compatible with each other.

unifying type

A ____ is a named memory location that you can use to store a value.

variable

Named computer memory locations are called _____________.

variables

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

.Java

What is the value of result after the following statement is executed? int result = 2 + 3 * 4;

14

In Java, what is the value of 3 + 7 * 4 + 2?

33

The assignment operator in Java is ___________.

=

The "equal to" relational operator is ___________.

==


Conjuntos de estudio relacionados

Lab: Ionic and Covalent Bonds Assignment: Reflect on the Lab

View Set

Chapter 4 Life Policy Provisions and Options

View Set

Dr. Vergaray TAMIU Government Weekly Quiz III

View Set

HVAC Motor Control (Chapters 16 and 19)

View Set