CSI final

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

A UML diagram does not contain _____________.

The object names

What will be the value of x[8] after the following code is executed? final int SUB = 12; int[] x = new int[SUB]; int y = 20; for(int i = 0; i < SUB; i++) { x[i] = y; y += 5; }

60

a reference variable stores an____________

object

Which symbol indicates that a member is private a UML diagram?

-

A(n) __________ is used as an index to pinpoint a specific element within an array.

element

It is common practice in object-oriented programming to make all of a class's ________

fields private

If numbers is a two-dimensional int array that has been initialized and total is an int that has been set to 0, which of the following will sum all the elements in the array?

for (int row = 0; row < numbers.length; row++) { for (int col = 0; col < numbers[row].length; col++) total += numbers[row][col]; }

A constructor

has the same name as the class

Overloading means multiple methods in the same class:

have the same name but different parameter lists

In Java, you do not use the new operator when you use a(n) ____________.

initialization list

1. Another term for an object of a class is a(n) __________.

instance

1. When an individual element of an array is passed to a method __________.

it is passed like any other variable

Each array in Java has a public field named _______ that contains the number of elements in the array

length

Most of the programming languages used today are __________.

object-oriented

A class's responsibilities include __________.

Both of these

It is common practice to use a _______ variable as a size declarator.

Final

What does the following statement do? double[] array1 = new double[10];

It does all of these

Class objects normally have __________ that perform useful operations on their data, but primitive variables do not.

Methods

You can use the ________ method to replace an item at a specific location in an ArrayList.

Replace

Java allows you to create objects of the __________ class in the same way you would create primitive variables.

Scanner

Instance methods do not have the __________ key word in their headers.

Static

The scope of a public instance field is __________

The instance methods and methods outside the class

For the following code, what would be the value of str[2]? String[] str = {"abc", "def", "ghi", "jkl"};

a reference to the string object containing "ghi"

A ragged array is __________

a two-dimensional array where the rows have different numbers of columns

Which of the following ArrayList class methods is used to insert an item at a specific location in an ArrayList?

add

Java performs ____________, which means that it does not allow a statement to use a subscript that is outside the range of valid subscripts for the array.

array bounds checking

one of more objects may be created from a

class

A ____________________ can be thought of as a blueprint that can be used to create a type of ________

class, object

What is the 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} };

94

The __________ method is used to insert an item into an ArrayList.

Add

By default, Java intializes array elements to __________

0

Subscripting always starts with _________

0

Given the following code, what will be the value of finalAmount when it is displayed? public class Order { private int orderNum; private double orderAmount; private double orderDiscount; public Order(int orderNumber, double orderAmt, double orderDisc) { orderNum = orderNumber; orderAmount = orderAmt; orderDiscount = orderDisc; } public double finalOrderTotal() { return orderAmount - orderAmount * orderDiscount; } } public class CustomerOrder { public static void main(String[] args) { Order order; int orderNumber = 1234; double orderAmt = 580.00; double orderDisc = .1; order = new Order(orderNumber, orderAmt, orderDisc); double finalAmount = order.finalOrderTotal(); System.out.printf("Final order amount = $%,.2f\n", finalAmount); } }

522.00

The _________ indicates the number of elements the array can hold.

Array size declarator

____________ refers to combining data and code into a single object

Encapsulation

When an object is passed as an argument to a method, what is passed into the method's parameter variable?

NOT the values for each field

When you work with a __________, you are using a storage location that holds a piece of data.

Primitive variable

Which of the following statements will create a reference, str, to the String "Hello, World"?

String str = new "Hello, World";

For the following code, which statement is not true? public class Circle { private double radius; public double x; private double y; }

The y field is available to code written outside the circle class

What would be the result after the following code is executed? final int SIZE = 25; int[] array1 = new int[SIZE]; ... // Code that will put values in array1 int value = 0; for (int a = 0; a <= array1.length; a++) { value += array1[a]; }

This code would cause the program to crash

What will be the results after the following code is executed? int[] x = { 55, 33, 88, 22, 99, 11, 44, 66, 77 }; int a = 10; if(x[2] > x[5]) a = 5; else a = 8;

a = 5

The following statement is an example of _______________ import java.util.*;

an explicit import statement

Method that operate on an object's fields are called _______.

instance methods

Methods that operate on an object's fields are called __________

instance methods

1. Which of the following is a valid declaration for a ragged array with five rows but no columns? int[][] ragged = new int[5]; int[][] ragged = new int[][5]; int[][] ragged = new int[5][]; int[] ragged = new int[5];

int[][] ragged = new int[5][];

A search algorithm __________.

is used to locate a specific item in a larger collection of data.

The Arraylist class is in the ______________ package

java.arraylist

The _____________ package is automatically imported into all java programs.

java.lang

Which of the following is a correct method header for receiving a two-dimensional array as an argument?

public static void passArray(int [][])

Given that String[] str has been initialized, to get a copy of str[0] with all the characters converted to uppercase, you would use the __________ statement.

str[0].toUpperCase();

Which of the following is not involved in identifying the classes to be used when developing an object-oriented application?

the code

The scope of private instance field is ___________.`

the instance field is methods of the same class.

Given the following two-dimensional array declaration, which statement is true? int[][] numbers = new int[6][9];

the number array has 6 rows and 9 columns

To indicate the data type of a variable in a UML diagram, you enter __________.

the variable name followed by a colon and the data type

Given the following code, what will be the value of finalAmount when it is displayed? public class Order { private int orderNum; private double orderAmount; private double orderDiscount; public Order(int orderNumber, double orderAmt, double orderDisc) { orderNum = orderNumber; orderAmount = orderAmt; orderDiscount = orderDisc; } public int getOrderAmount() { return orderAmount; } public int getOrderDisc() { return orderDisc; } } public class CustomerOrder { public static void main(String[] args) { int ordNum = 1234; double ordAmount = 580.00; double discountPer = .1; Order order; double finalAmount = order.getOrderAmount() — order.getOrderAmount() * order.getOrderDisc(); System.out.printf("Final order amount = $%,.2f\n", finalAmount); } }

there is no value because the object, order, has not been created.

Two or more methods in a class may have the same name as long as ____________

they have different parameter list

1. What will be the results after the following code is executed? int[] array1 = new int[25]; ... // Code that will put values in array1 int value = array1[0]; for (int a = 1; a < array1.length; a++) { if (array1[a] < value) value = array1[a]; }

value contains the lowest value in array1

The binary search algorithm

will, normally, have the number of comparisons that is half the number of elements in the array

A partially filled array is normally used _________

with an accompanying integer value that holds the number of items stored in the array

What would be the result after the following code is executed? int[] x = {23, 55, 83, 19}; int[] y = {36, 78, 12, 24}; for(int a = 0; a < x.length; a++) { x[a] = y[a]; y[a] = x[a]; }

x[] = {36, 78, 12, 24} and y[] = {36, 78, 12, 24}


Conjuntos de estudio relacionados

Art History 111: Ming Dynasty China

View Set

Hydration of 1-Hexene - Lab Flow

View Set

Network + Transcender Questions (Network Architecture)

View Set

Principles of Exercise: Lesson 6

View Set

chap 11 launchpad, chap 11 quiz, chap 12 quiz, chap 12 launchpad, chap 15 launchpad, chap 16 launchpad, chap 17 launchpad, chap 19 launchpad, chap 42 launchpad, chap 16, 15, 17 quiz, chap 19 quiz, chap 30 quiz, chap 30 self assessment, exam 4, exam 4...

View Set

Peds final (ch 1, 3-7, 13-15, 18-21, 23): part 2 (fixed)

View Set