Final

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

If the following is from the method section of a UML diagram, which of the following statements is true? + equals(object2:Stock) : boolean A. This is a private method that returns a boolean value. B. This is a private method that receives two objects from the Stock class and returns a boolean value. C. This is a public method that accepts a Stock object as its argument and returns a boolean value. D. This is a public method that returns a reference to a String object.

...

A characteristic of ________ is that only an object's methods are able to directly access and make the changes to the object's data. A.Data Hiding B.Classes C.Component Reusability D.Procedure

A

An object typically hides it data, but allows outside code to access? A.the methods that operate on the data B.the data files C.private data members D.the pseudocode

A

If you wish to use the System.out.printf method to print a string argument, use the ________ format specifier. A.%s B.%d C.%b D.%f

A

In general, there are two types of files: A. text and binary B. delimited and unlimited C. encrypted and unencrypted D.static and dynamic

A

What is a ragged array? A. a two-dimensional array where the rows have a different number of columns B. a two-dimensional array for which the number of rows is unknown C. a partially initialized two-dimensional array of ranged values D. a one-dimensional array for which the number of elements is unknown

A

What is the value of scores[2][3] in the following array? int[][] scores = { {88, 80, 79, 92}, {75, 84, 93, 80}, {98, 95, 92, 94}, {91, 84, 88, 96} }; A. 94 B. 95 C. 93 D. 84

A

Which of the following is a correct method header for receiving a two-dimensional array as an argument? A. public static void passMyArray(int[][] myArray) B. public static void passMyArray(array myArray) C. public static void passMyArray(int myArray) D. public static void passMyArray(int[]myArray1, int[]myArray2)

A

You can use the ________ method to replace an item at a specific location in an ArrayList. A. set B. add C. replace D. remove

A

javac MyClass.java Before entering the command, you must? A.Make sure you are in the same directory or folder where the MyClass.java file is located B. Save the program with the .comp extension C.Close all other Windows on your computer system. D.Execute the java.sun.com program

A

int x = 5, y = 28; float z; z = (float) (y / x); A.5.6 B.5.60 C.5.0 D.3.0

A

This statement tells the compiler where to find the JOptionPane class and makes it available to your program. A. import javax.JOptionPane; B.Import javax.swing.JOptionPane; C.import JOptionPance; D.import Java.Swing.JOptionPane;

B

What is the result of the following expression? A.8 B.7 C.12 D.105

B

final int x = 22, y = 4; y += x; System.out.println("x = " + x + ", y = " + y); A.x=22,y=88 B.x=22,y=26 C.x=22,y=4 D.Nothing.

B

When an array is passed to a method A. it is passed just as any other object would be B. a reference to the array is passed C. the method has direct access to the original array D. All of the above

D

Which of the following statements opens a file named MyFile.txt and allows you to append data to its existing contents? A. PrintWriter outfile = new PrintWriter(true, "MyFile.txt"); B. FileWriter fwriter = new FileWriter("MyFile.txt"); PrintWriter outFile = new PrintWriter(fwriter); C. PrintWriter outfile = new PrintWriter("MyFile.txt", true); D. FileWriter fwriter = new FileWriter("MyFile.txt", true); PrintWriter outFile = new PrintWriter(fwriter);

D

A method A.may have only one parameter variables B.may have zero or more parameter variables C.must have at least two parameter variables D.never has parameter variables

B

A method's signature consists of A. the return type and the method name B.the method name and the parameter list C.the size of the method in memory D.the return type, the method name, and the parameter list

B

A(n) ________ is a special value that cannot be mistaken as a member of a list of data items and signals that there are no more data items from the list to be processed. A. terminator B. sentinel C. accumulator D. delimiter

B

A(n) ________ is used as an index to pinpoint a specific element within an array. Question options: A. boolean value B. subscript C. element D. range

B

An array of String objects A. must be initialized when the B. consists of an array of references to String objects C. is arranged the same as an array of primitive objects D. is compressed to 4 bytes for each element.

B

Enclosing a group of statements inside a set of braces creates A. an expression B. a block of statements C. an if-else statement D. a relational operator

B

If object1 and object2 are objects of the same class, to make object2 a copy of object1 Question options: A. use the copy method that is a part of the Java API. B. write a method for the class that will make a field by field copy of object1 data members into object2 data members. C. use an assignment statement to make object2 a copy of object1. D. use the default constructor to create object2 with object1 data members.

B

In the following Java statement what value is stored in the variable name? String name = "John Doe"; A."name" B.the memory address where "John Doe" is located C."John Doe" D.the memory address where name is located

B

The "has a" relationship is sometimes called a(n) ________ because one object is part of a greater whole. A. mutual relationship B. whole-part relationship C.possession D.enterprise

B

The JVM periodically performs this process to remove unreferenced objects from memory. A. system restore B.garbage collection C. memory shuffling D. memory sweeping

B

The ________ is ideal in situations where the exact number of iterations is known. A. posttest loop B. for loop C. do-while loop D. while loop

B

The ________ loop is ideal in situations where you always want the loop to iterate at least once. A. pretest B. do-while C. while D. for

B

int x = 5, y = 20; x += 32; y /= 4; System.out.println("x = " + x + ", y = " + y); A.x=160,y=80 B.x=37,y=5 C.x=32,y=4 D.x=9,y=52

B

A ________ is a boolean variable that signals when some condition exists in the program. A.case B.block C.flag D.sentinel

C

A block of code is enclosed in a set of A. parentheses B. double quotes C. braces D. brackets

C

A class's responsibilities include A.the things a class is responsible for doing. B.the things a class is responsible for knowing C.both a and b D.neither A nor B

C

A constructor A.has return type of void B.always accepts two arguments C.has the same name as the class D.always has an access specifier of private

C

Before entering a loop to compute a running total, the program should first A.read all the values into main memory. B. know exactly how many values there are to total. C. set the accumulator variable to an initial value, usually zero D. set all variable to zero.

C

The ________ method is used to display a message dialog. A.messageDialog B.showDialog C.showMessageDialog D.messageDialogshop

C

The boolean data type may contain the following range of values: A.-2,147,483,648 to +2,147,483,647 B.-32,762 to +32,767 C.true or false D.-128 to +127

C

To return an array of long values from a method, use this as the return type for the method. A. long[ARRAY_SIZE] B. long C. long[] D. array

C

What is the following statement an example of? import java.util.Scanner; A.a wildcard import statement B.a conditional import statement C.an explicit import statement D.an unconditional import statement

C

What will be displayed when the following code is executed? double x = 45678.259; DecimalFormat formatter = new DecimalFormat("#,##0.0"); JOptionPane.showMessageDialog(null,formatter.format(x)); A. 45,678.26 B. 45678.259 C. 45,678.259 D. 45,678.3

D

What will be returned from the method, if the following is the method header? public Rectangle getRectangle() A. the values stored in the data members of the Rectangle object B. a null value C. an object that is contained in the class Rectangle D. the address of an object of the Rectangle class

D

________ operators are used to determine whether a specific relationship exists between two values. A. Assignment B. Logical C. Arithmetic D. Relational

D

What will be returned from the method, if the following is the method header? public Rectangle getRectangle() Question options: A. the values stored in the data members of the Rectangle object B. a null value C. an object that is contained in the class Rectangle D. the address of an object of the Rectangle class

D.

The sequential search algorithm A. requires the array to be in ascending ordered B. uses a loop to sequentially step through an array,starting with the first element C. returns 1 if the value being search for is found, otherwise it returns -1. D. All of the above

B

This is a special language used to write computer programs. A.Application B.Programming Language C.Pseudocode D.Operating System

B

Which Scanner class method reads a String? A.nextString B.nextLine C.getLine D.charAt

B

Which of the following statements opens a file named MyFile.txt and allows you to read data from it? A. File file = new File("MyFile.txt"); B. PrintWriter inputFile = new PrintWriter("MyFile.txt"); C. File file = new File("MyFile.txt"); Scanner inputFile = new Scanner(file); D. Scanner inputFile = new Scanner("MyFile.txt");

C

You can use the enum key word to A. specify the values that belong to that type B. create your own data type C. Both A and B

C

You may use this to compare two enum data values. A. the==,> and < operators B.the moreThan, lessThan and equalsTo methods C. the equals and compareTo methods D. the ordinal method

C

If the following is from the method section of a UML diagram, which of the following statements is true? + equals(object2:Stock) : boolean Question options: A. This is a private method that returns a boolean value. B.This is a private method that receives two objects from the Stock class and returns a boolean value. C.This is a public method that accepts a Stock object as its argument and returns a boolean value. D. This is a public method that returns a reference to a String object.

C.

"Blank" is a cross between human language and a programming language. A. Java B. The Java Virtual Machine C. The compiler D. Pseudocode

D

A loop that executes as long as a particular condition exists is called a(n) ________ loop. A. infinite B. count-controlled C. relational D. conditional

D

Another term for an object of a class is a(n) A.access specifier B.member C.method D.instance

D

Class objects normally have ________ that perform useful operations on their data, but primitive variables do not. A.instances B.relationships C.fields D.methods

D

Enumerated types have this method, which returns the position of an enum constant in the declaration list. A.index B.position C.location D.ordinal

D

Given the following two-dimensional array declaration, which statement is true? int[][] numbers = new int[6][9]; A. The numbers array has 54 rows. B. The numbers array has 6 columns and 9 rows. C. The numbers array has 15 rows. D. The numbers array has 6 rows and 9 columns.

D

Methods that operate on an object's fields are called A. private methods B.instance variables C.public methods D.instance methods

D

One or more objects may be created from a(n) A. method B.field C.instance D.class

D

RAM is usually? A.A static type of memory, used for permanent storage B.Secondary Storage C.An input/output device D.A volatile type of memory, used only for temporary storage.

D

The only limitation that static methods have is A. they must be declared outside of the class B. they can only be called from static members of the class C. they can refer to only nonstatic members of the class D. they cannot refer to nonstatic members of the class

D

The original name for Java was? A.*7 B.HotJava C. Elm D. Oak

D

This is a set of programming language statements that, together, perform a specific task. A.Object B.Compile C.Pseudocode D.Procedure

D

This type of loop will always be executed at least once. A. infinite B. pretest C. conditional D. posttest

D


Conjuntos de estudio relacionados

Database II final part 2 (chapter 9)

View Set

Medical Terminology: The Cardiovascular System (Combining forms, Prefixes, Suffixes, and Word surgery)

View Set

History of Rock Exam 2 - Militant Blues on Campus

View Set

Practice Questions Chapters 39-43

View Set

Finance, chapter 4, analyzing single cash flows

View Set

midterm review intro to human services

View Set

HW 7: TOPICS, VIDEO, AND READINGS

View Set