Prog midterm

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

nonletter

Any ___________ argument passed to the Character class's toLowerCase method or toUpperCase method is returned as it is.

The String class's valueOf method accepts a string representation as an argument and returns its equivalent integer value.

False

overrides

If a method in a subclass has the same signature as a method in the superclass, the subclass method ________ the superclass method.

package

If you don't provide an access specifier for a class member, the class member is given ________ access by default.

dashed line with an open arrowhead at one end.

In a UML diagram you show a realization relationship by connecting a class and an interface with a

inheritance

In object-oriented programming, ________ allows you to extend the capabilities of a class by creating another class that is a specialized version of it.

comma separated value

In the __________ file format, when data in a spreadsheet is exported, each row is written to a line and commas are used to separate the values in the cells.

ClassA

In the following statement, which is the subclass?public class ClassA extends ClassB implements ClassC

#

Protected class members can be denoted in a UML diagram with the ________ symbol.

remove

The __________ method removes an item from an ArrayList at a specific index.

import java.util.StringTokenizer;

To use the class StringTokenizer, you must have the following import statement.

The String class's regionMatches method performs a case-insensitive comparison.

True

9, 14, 2018, and -

What are the tokens in the following statement?StringTokenizer st = new StringTokenizer("9-14-2018", "-", true);

94

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} };

W

What will be displayed after the following code is executed?String str = "RSTUVWXYZ";System.out.println(str.charAt(5));

We have lived in Tampa, Trenton, and Atlanta.

What will be displayed after the following statements are executed?StringBuilder strb = new StringBuilder("We have lived in Chicago, Trenton, and Atlanta.");strb.replace(17, 24, "Tampa");System.out.println(strb);

15

What will be the value of position after the following code is executed?int position;String str = "The cow jumped over the moon.";position = str.indexOf("ov");

extends

Which key word indicates that a class inherits from another class?

add

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

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

Which of the following is a valid declaration for a ragged array with five rows but no columns?

instanceOf

Which of the following is the operator used to determine whether an object is an instance of a particular class?

class hierarchy

Which of the following shows the inheritance relationships among classes in a manner similar to that of a family tree?

int x = Integer.parseInt(str);

Which of the following statements converts a String object variable named str to an int and stores the value in the variable x?

public class ClassA implements Interface1, Interface2

Which of the following statements correctly specifies two interfaces?

public class Salaried extends PayType

Which of the following statements declares Salaried as a subclass of PayType?

It declares array1 to be a reference to an array of long values. It will allow valid subscripts in the range of 0 through 9. It creates an instance of an array of ten long values. All of these are true.

Which of the following statements is(are) true about this code?final int ARRAY_SIZE = 10;long[] array1 = new long[ARRAY_SIZE];

System.out.println(Double.MAX_VALUE);

Which of the following statements will display the maximum value that a double can hold?

set

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

A search algorithm

a method of locating a specific item in a larger collection of data

valueOf

The String class's __________ method accepts a value of any primitive data type as its argument and returns a string representation of the value.

char array primitive type String object

The StringBuilder class's insert method allows you to insert a(n) __________ into the calling object's string.

An ArrayList object automatically expands in size to accommodate the items stored in it

True

An abstract class is not instantiated itself but serves as a superclass for other classes.

True

Because every class directly or indirectly inherits from the Object class, every class inherits the Object class's members.

True

Because the subclass is more specialized than the superclass, it is sometimes necessary for the subclass to replace inadequate superclass methods with more suitable ones.

True

Objects in an array are accessed with subscripts, just like any other data type in an array

True

The String[] args parameter in the main method header allows the program to receive arguments from the operating system command-line

True

To determine if two arrays are equal you must compare each of the elements of the two arrays.

True

Trying to extract more tokens than exist from a StringTokenizer object will cause an error.

True

When an "is a" relationship exists between objects, it means that the specialized object has all the characteristics of the general object plus additional characteristics that make it special.

True

The cow jumped over the moon.

What will be displayed after the following code is executed?StringBuilder strb = new StringBuilder(12);strb.append("The cow ");strb.append("jumped over the ");strb.append("moon.");System.out.println(strb);

The code contains a syntax error and will not compile.

What will be the result after the following code is executed?final int ARRAY_SIZE = 5;float[] x = float[ARRAY_SIZE];for (i = 1; i <= ARRAY_SIZE; i++){ x[i] = 10.0;}

The value variable will contain the lowest value in the numbers array.

What would be the result after the following code is executed?int[] numbers = {40, 3, 5, 7, 8, 12, 10};int value = numbers[0];for (int i = 1; i < numbers.length; i++){ if (numbers[i] < value) value = numbers[i];}

An array of 6 values, ranging from 0 through 5 and referenced by the variable x will be created.

What would be the result of executing the following code? int[] x = {0, 1, 2, 3, 4, 5};

tokens

A series of words or other items of data, separated by spaces or other characters, are known as

only public and protected members of the superclass.

A subclass can directly access

abstract

A(n) ________ method is a method that appears in a superclass but expects to be overridden in a subclass.

Subscript

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

are treated as final and static.

All fields declared in an interface

In order to do a binary search on an array

the array must first be sorted in ascending order

import java.util.ArrayList;

to use the ArrayList Class

A partially filled array is normally used

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

A sorting algorithm is used to locate a specific item in a larger collection of data

False

If a string has more than one character used as a delimiter, you must write a loop to determine the tokens, one for each delimiter character.

False

In an inheritance relationship, the subclass constructor always executes before the superclass constructor.

False

You cannot assign a value to a wrapper class object.

False

4

Given the following code, how many times will the while loop be executed?StringTokenizer st = new StringTokenizer("Java programming is fun!");while (st.hasMoreTokens())System.out.println(st.nextToken());

a UML diagram

In ________, inheritance is shown with a line that has an open arrowhead at one end that points to the superclass.

variable-length argument list

Java provides a mechanism known as a __________ which makes it possible to write a method that takes a variable number of arguments.

testing and converting character data

The Character wrapper class provides numerous methods for


Ensembles d'études connexes

Chapter 6: Values, Ethics, and Advocacy

View Set

OR Life and Health Insurance: Simulate Your Exam from Exam FX.

View Set

Algebra- Solving Inequalities Unit test Part 1

View Set

Key Questions: The Spread of Christian Ideas (10.3)

View Set

industrialization spreads worksheet

View Set