buttt

Ace your homework & exams now with Quizwiz!

12. The characters ____ move the cursor to the next line when used within a println() statement. a. /n c. .+ b. \n d. $

ANS: B PTS: 1 REF: 73-74

14. You use ____ operators to perform calculations with values in your programs. a. calculation c. integer b. arithmetic d. precedence

ANS: B PTS: 1 REF: 91

7. ____ 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. a. Applets c. Arguments b. Methods d. Objects

ANS: C PTS: 1 REF: 13

24. public class First { public static void main(String[] args) { System.out.println("First Java application"); } } Given the above code, which item identifies the method's return type? a. public c. void b. static d. println

ANS: C PTS: 1 REF: 18

9. In Java, the reserved keyword ____ means that a method is accessible and usable even though no objects of the class exist. a. active c. static b. undefined d. void

ANS: C PTS: 1 REF: 18-19

15. If a compiler detects a violation of language rules, it refuses to translate the class to ____. a. an application c. machine code b. a logic error d. Java

ANS: C PTS: 1 REF: 24

20. When you run a Java application using the ____ command, do not add the .class extension to the filename. a. class c. java b. static d. output

ANS: C PTS: 1 REF: 29

2. Locating and repairing all syntax errors is part of the process of ____ a program. a. interpreting c. debugging b. compiling d. executing

ANS: C PTS: 1 REF: 3

3. Primitive types serve as the building blocks for more complex data types, called ____ types. a. integer c. reference b. literal d. data

ANS: C PTS: 1 REF: 52

7. The term ____ refers to the mathematical accuracy of a value. a. float data c. significant digits b. real integers d. single-precision floating-point number

ANS: C PTS: 1 REF: 69

10. In Java, ____ is a built-in class that provides you with the means for storing and manipulating character strings. a. Escape c. String b. Type d. Character

ANS: C PTS: 1 REF: 72

20. Each primitive type in Java has a corresponding class contained in the java.lang package. These classes are called ____ classes. a. case c. type-wrapper b. primitive d. show

ANS: C PTS: 1 REF: 87-88

15. ____ occurs when both of the operands are integers. a. Data modeling c. Integer division b. Type cast d. Unlike assignment

ANS: C PTS: 1 REF: 92

17. What is the value of result after the following statement is executed? int result = 2 + 3 * 4; a. 9 c. 14 b. 10 d. 20

ANS: C PTS: 1 REF: 93

23. public class First { public static void main(String[] args) { System.out.println("First Java application"); } } Given the above code, which item identifies the name of the class? a. public c. void b. static d. First

ANS: D PTS: 1 REF: 17

11. In a ____ environment, you can change directories using the cd command. For example, to change to a directory named MyClasses, you type cd MyClasses and press Enter. a. Windows c. graphical b. Java d. DOS

ANS: D PTS: 1 REF: 23

16. ____ 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. a. Running c. Compiling b. Debugging d. Parsing

ANS: D PTS: 1 REF: 27 - 28

5. In Java, you use variables of type ____ to store integers, or whole numbers. a. num c. var b. double d. int

ANS: D PTS: 1 REF: 52

24. When a numeric variable is concatenated to a String, the entire expression becomes a(n) ____. a. int c. method b. constant d. String

ANS: D PTS: 1 REF: 56

4. ____ refers to the hiding of data and methods within an object. a. Instance c. Passed b. Inheritance d. Encapsulation

ANS: D PTS: 1 REF: 8

19. A(n) ____ dialog box asks a question and provides a text field in which the user can enter a response. a. question c. confirm b. JOptPane d. input

ANS: D PTS: 1 REF: 85

10. Using the void keyword in the main() method header indicates that a value will be returned by the main() method is called.

ANS: F

3. A Java identifier can contain only letters, digits, ampersands, or number signs.

ANS: F

5. When you issue the command to compile a class containing errors, the Java compiler does not produce any error messages. You will first need to run the class in order to see error messages.

ANS: F

6. Logic errors are easily identified when a program is compiled.

ANS: F

8. A compiler ignores whitespace (that is, any combination of nonprinting characters) between words and lines.

ANS: F

System software is used for tasks such as word processing, calculations and playing games.

ANS: F

2. If an object's methods are well written, the user is unaware of the low-level details of how the methods are executed, and the user must simply understand the interface or interaction between the method and the object.

ANS: T

4. You must use the Java interpreter to translate the bytecode into executable statements before running a Java application.

ANS: T

7. Although not a requirement, it is Java standard that class identifiers begin with an uppercase letter and use other uppercase letters to improve readability.

ANS: T

9. Dots (or periods) in a Java statement are used to separate the names of the components that make up the statement.

ANS: T

Methods that retrieve values are called ____ methods.

Accessor

The arguments in a method call are often referred to as ____.

Actual parameters

For ease in locating class methods, many programmers store them in ____ order.

Alphabetical

When calling this() from a constructor, it must be the ____ statement within the constructor.

First

____ parameters are variables in a method declaration that accept the values from the actual parameters.

Formal

Method names that begin with ____ and set are very typical.

Get

When a variable ceases to exist at the end of a method, programmers say the variable ____.

Goes out of scope

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

Local

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 locally declared variable always ____ another variable with the same name elsewhere in the class.

Masks

Every object is a _____ of a more general class.

Member

When you instantiate an object from a class, ____ is reserved for each instance field in the class.

Memory

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

Method

When they have the same name, variables within ____ of a class override the class's fields.

Methods

If a class's only constructor requires an argument, you must provide an argument for every ____ of the class that you create.

Object

When a value is returned from a method, you are required to use the value when the method is called.

false

You are limited to declaring a maximum of three variables in a single statement

false

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

fields

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.

instantiation

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

int

The ____ package is implicitly imported into every program you write.

java.lang

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

method

If a class's only constructor requires an argument, you ____ for every object of the class that you create.

must provide an argument

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

mutator

Nonambiguous, overloaded methods must have the same ____.

name

When a block exists within another block, the blocks are ____.

nested

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

new

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

numeric fields are set to 0 (zero)

If you create a class that contains one method and then instantiate two objects, you usually store ____ for use with the objects

one copy of the method

In Java, ____ means writing multiple methods in the same scope that have the same name but different parameter lists.

overloading

Java classes are stored in a folder or ____.

package

All method declarations contain ____.

parentheses

Most class data fields are ____.

private

If a method is written to receive a double parameter, and you pass an integer to the method, then the method will ____.

work correctly; the integer will be promoted to a double

If you want all objects to share a single nonchanging value, then the field is static and ______.

Final

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

Student()

The reference to an object that is passed to any object's nonstatic class method is called the ____.

This refrence

A method's identifier must be more than one word, must have no embedded spaces, and cannot be a Java keyboard.

false

A variable can hold more than one value at a time

false

Constants hold a single value for the duration of the program execution

false

If an integer is passed to a method with a double parameter, the double is promoted to an integer

false

Multiplication, division, and remainder always take place after addition or subtraction in an expression

false

Once a variable has been declared and initialized, new values may not be assigned to the variable

false

The expression boolean isTenLarger = (10 < 5) will produce a value of true

false

The interface is the part of a method that the method's client does not see

false

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

true

When you write your own constructors, you cannot write versions that receive parameters

true

You can create a confirm dialog box with five arguments

true

You can identify a class that is an application because it contains a public static void main( ) method

true

You can use the keyword final with methods or classes

true

11. You can store any character, including nonprinting characters such as a backspace or a tab, in a(n) ____ variable. a. int c. boolean b. char d. set

ANS: B PTS: 1 REF: 73

25. Which escape sequence will move the cursor to the beginning of the current line? a. \b c. \\ b. \r d. \n

ANS: B PTS: 1 REF: 73

22. { public static void main(String[] args) { System.out.println("First Java application"); } } Given the above code, which item identifies the access specifier? a. public c. void b. static d. First

ANS: A PTS: 1 REF: 16

12. After a successful compile, you can run the class file on any computer that has a ____. a. Java language interpreter c. text editor b. Web browser d. DOS

ANS: A PTS: 1 REF: 23

14. Whenever a method requires multiple arguments, the arguments are always separated with ____. a. commas c. forward slashes b. periods d. brackets

ANS: A PTS: 1 REF: 35

3. ____ are also called modules, methods, functions, and subroutines. Java programmers most frequently use the term "method." a. Procedures c. Classes b. Calls d. Applications

ANS: A PTS: 1 REF: 5

4. ____ refers to the order in which values are used with operators. a. Associativity c. Declaration b. Initialization d. Floating

ANS: A PTS: 1 REF: 53

23. You may declare an unlimited number of variables in a statement as long as the variables are ____. a. the same data type c. properly commented b. initialized to the same value d. floating point numbers

ANS: A PTS: 1 REF: 54

13. In Java, when a numeric variable is concatenated to a String using the ____, the entire expression becomes a String. a. plus sign c. concatenate statement b. equal sign d. string statement

ANS: A PTS: 1 REF: 56

8. A ____ data type can hold 14 or 15 significant digits of accuracy. a. double c. char b. float d. boolean

ANS: A PTS: 1 REF: 69

21. A(n) ____ dialog box displays the options Yes, No, and Cancel. a. confirm c. message b. input d. answer

ANS: A PTS: 1 REF: 89

5. ____ describes the feature of languages that allows the same word to be interpreted correctly in different situations based on the context. a. Polymorphism c. Source code b. Architecturally neutral d. Insulation

ANS: A PTS: 1 REF: 9

16. The percent sign is the ____ operator. a. remainder c. percentage b. remaining d. integer division

ANS: A PTS: 1 REF: 92

18. The ____ is the type to which all operands in an expression are converted so that they are compatible with each other. a. unifying type c. numbered b. data type d. primitive

ANS: A PTS: 1 REF: 99

6. Programs that are embedded in a Web page are called Java ____. a. consoles c. applications b. applets d. windowed applications

ANS: B PTS: 1 REF: 11

8. A(n) ____ defines the circumstances under which a class can be accessed and the other classes that have the right to use a class. a. identifier c. parameter b. access specifier d. Pascal casing

ANS: B PTS: 1 REF: 16

25. public class First { public static void main(String[] args) { System.out.println("First Java application"); } } Given the above code, which item identifies that the method will work without instantiating an object of the class? a. public c. void b. static d. println

ANS: B PTS: 1 REF: 18

1. A program written in ____ is the most basic circuitry-level language. a. Java c. BASIC b. machine language d. C

ANS: B PTS: 1 REF: 2

18. It is best to use the ____ available text editor when writing Java programs. a. most complex c. best b. simplest d. latest

ANS: B PTS: 1 REF: 21

19. It is a tradition among programmers that the first program you write in any language produces "____" as its output. a. Hi, your name! c. My first program! b. Hello, world! d. Hello, your name!

ANS: B PTS: 1 REF: 21

17. A ____ is an error not detected until the program asks the computer to do something wrong, or even illegal, while executing. a. syntax error c. package b. run-time error d. Java API

ANS: B PTS: 1 REF: 31

10. Line comments start with ____. a. a forward slash and an asterisk c. a forward slash and two asterisks b. two forward slashes d. a percent sign

ANS: B PTS: 1 REF: 32

13. Java contains a class named ____ that allows you to produce dialog boxes. a. JBox c. JDialog b. JOptionPane d. JGUI

ANS: B PTS: 1 REF: 34

21. If you receive an error that states, "Exception in thread 'main' java.lang.NoClassDefFoundError," when you try to execute the application, you probably do not have your ____ set correctly. a. class length c. java b. class path d. object

ANS: B PTS: 1 REF: 34

2. A ____ is a named memory location that you can use to store a value. a. cast c. reference b. variable d. primitive

ANS: B PTS: 1 REF: 52

A data item is ____ when it cannot be changed while a program is running. a. variable c. primitive b. constant d. literal

ANS: B PTS: 1 REF: 52

22. Which of the following is NOT a component of a variable declaration statement? a. data type identifier c. variable name b. symbolic constant d. ending semicolon

ANS: B PTS: 1 REF: 53

6. A(n) ____ variable can hold only one of two values: true or false. a. integer c. true b. boolean d. comparison

ANS: B PTS: 1 REF: 67

9. You use the ____ data type to hold any single character. a. single c. byte b. char d. float

ANS: B PTS: 1 REF: 70

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

Arguments

Within any class or method, the code between a pair of curly braces is called a(n) ____.

Block

Which of the following is NOT an initial value assigned to an object's data field by a default constructor?

Boolean field sets to true

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

Class

A variable comes into existence, or ____, when you declare it.

Comes into scope

When an object of one class is a data field within another class, they are related by ____.

Composition

____ describes the relationship between classes when an object of one class is a data field within another class.

Composition

A(n) ____ method is a method that creates and initializes class objects.

Constructor

The name of the ____ is always the same as the name of the class whose objects it constructs.

Constructor

You can use ____ arguments to initialize field values, but you can also use arguments for any other purpose.

Constructor

A method header is also called a(n) _____.

Declaration

A(n) ____ constructor is one that requires no arguments.

Default

Due to automatic type promotion, when a method with a double parameter is passed an integer, the integer will be promoted to a(n) ____.

Double

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

Extended

After an object has been instantiated, its methods can be accessed using the object's _____, a dot, and a method call.

Identifier

____ is a principle of object-oriented programming that describes the encapsulation of method details within a class.

Implementation hiding

The ____ statement notifies the program that you will be using the data and method names that are part of the imported class or package.

Import

Another name for a nonstatic member class is a(n) ____.

Inner Class

A method can receive ____ arguments, even if it is defined as needing double arguments.

Integer

Methods used with object instantiations are called ____ methods.

Internal

The ____ package contains is implicitly imported into Java programs and is the only automatically imported, named package.

Java.Lang

In order to allocate the needed memory for an object, you must use the ____ operator.

New

When you properly ____ a method, you can call it providing different argument lists, and the appropriate version of the method executes.

Overload

____ involves using one term to indicate diverse meanings, or writing multiple methods with the same name but with different parameter lists.

Overloading

Object-oriented programmers use the term ____ when a child class contains a field or method that has the same name as one in the parent class.

Override

When an application contains just one version of a method, you can call the method using a(n) ____ of the correct data type.

Parameter

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

Primary

Assigning ____ to a field means that no other classes can access the field's values.

Private access

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

Return statement

The compiler determines which version of a method to call by the method's ____.

Signature

It is not necessary to create an instance of the Math class because the constants and methods of the class are ____.

Static

It is a convenience to be able to use one reasonable name for ____ that are functionally identical except for argument types.

Tasks

You can use the asterisk (*) as a ____, which indicates that it can be replaced by any set of characters.

Wildcard symbol

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

a boolean value

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

aMethod('Q');

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

abstract

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

abstraction

Which of the following is not a type of nested class?

ambiguous

If you give the same name to a class's instance field and to a local method variable, the instance variable overrides the method's local variable

false

The code between a pair of curly braces in a method is a ____.

block

A constructor ____ overloaded.

can be

A constructor ____ parameters.

can receive

Methods that do not have a this reference because they have no object associated with them are called ____ methods.

class

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

class client

Variables that are shared by every instantiation of a class are ____.

class variables

A(n) ____ is a data type that consists of a list of values.

enumeration

A disadvantage of Java is the large memory requirements to store a separate copy of each variable and method for each instantiation of a class

false

A method body provides information about how other methods can interact with it.

false

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;

Which of the following statements determines the square root of a number and assigns it to the variable s?

s = Math.sqrt(number);

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

showResults(12.2, 67);

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

signature

The compiler determines which version of a method to call by the method's ____.

signature

You can write your own constructor methods; but when you don't write a constructor method for a class object, Java writes one for you.

true

If you declare a variable as an instance variable within a class and you declare and use the same variable name within a method of the class, then within the method ____.

the variable used inside the method takes precedence

The reference to an object that is passed to any object's nonstatic method is called the ____.

this reference

A block can exist entirely within another block or entirely outside and separate from another block, and sometimes blocks can overlap.

true

An alternative to importing a class is to import an entire package of classes

true

An application's main( ) method must have a void return type.

true

Any class can contain an unlimited number of methods

true

Application classes frequently instantiate objects that use the objects of other classes

true

As long as you do not make any ambiguous method calls, a program that contains a potentially ambiguous situation will exec

true

Even if a statement occupies multiple lines, the statement is not complete until the semicolon is reached

true

It is illegal to declare the same variable name more than once within a block

true

Parentheses in a method declaration contain parameters that are funneled into the method.

true

The legal integer values are -2^31 through 2^31 -1. These are the highest and lowest values that you can store in four bytes of memory, which is the size of an int variable

true

The term parse means to break into component parts

true


Related study sets

N404 populations and community health exam 1

View Set

lymphatic system and the peripheral vascular system

View Set

Urinary System Exam Review (Pt. 4)

View Set

Business Law - Cheeseman - Chapter 29

View Set

Employee Training and Development Chapter 7 Assignment

View Set