CSE 110 FINAL

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

A default constructor takes _____ arguments

0

The first element of an array is located at index _____.

0

The index of the last element of an array with a size of 5 elements is _____.

4

Which of the following expression would be a valid index for an array of 5 elements? Choose all that apply.

Answered: 2*2, 2+2 and 4

Which object oriented element is used to define "has a" relationship?

Answered: Data Hiding

Which object oriented element is used to define "is a" relationships?

Answered: Encapsulation, Message Passing, Polymorphism, Composition

Which object oriented element is best defined as "an object should have complete authority over its responsibilities"?

Answered: Inheritance, Encapsulation

Which of the following is a Java primitive data type?

Answered: String,float, int boolean, double,

Creating an object of a class is called ________.

Answered: classification

Which object oriented element is best defined as "objects best viewed as packages of responsibility"?

Answered: composition

Which method can be called to get the size (number of elements) of an ArrayList?

Answered: count

Which method can be used to retrieve an element of an ArrayList? Choose all that apply.

Answered: index, at

The Java reference type equivalent of the primitive type int is _____.

Answered: integer, String

Which of the following are characteristics of the Java programming language?

Answered: interpreted and compiled

Which method can be used to replace an element in an ArrayList? Choose all that apply.

Answered: replace

Immediately after the object's variables are placed in memory _____.

Answered: the object is instantiated, the variables are destroyed, the object is destroyed

Which of the following are good analogies for classes an objects?

Cookie cutters and cookies Blueprints and buildings

A value type variable can store a null reference in Java.

False

Arrays cannot be passed as arguments to methods in Java.

False

In Java, arrays can only store primitive types.

False

Java has a string multiplication operator just like Python.

False

Java uses the same operator for exponentiation as Python

False

Only an enhanced for loop can be used to iterate over an ArrayList

False

Only an enhanced for loop can be used to iterate over an ArrayList.

False

When we instantiate an ArrayList we must specify the initial size.

False

Which object oriented element is best supports object collaboration?

Message Passing

To help us collect information from the user through the keyboard in Java, we use a

Scanner

A name defined in an inner scope is not available outside that block

True

A name defined in an outer scope is also available in all blocks nested inside that scope

True

A reference type variable can store a null reference in Java

True

An advantage of composition is the fact that we can sometimes reuse classes that we have already written, instead of having to design and write new classes.

True

An object is an instance of a class

True

An object is an instance of a class.

True

ArrayLists are reference types.

True

ArrayLists can only store reference types.

True

Data hiding can allow us to separate the information from its representation.

True

Data hiding helps make encapsulation work.

True

In Java, arrays are reference types

True

In general, data hiding means that an object keeps what it knows private.

True

In java, a two dimensional array in Java is really an "array of arrays."

True

Java ArrayList is a generic type.

True

Java ArrayLists are like re-sizable arrays

True

Java boolean literal values are expressed in all lowercase

True

Java has a reference type equivalent for each primitive type

True

The Java String type is a reference type.

True

The ability to use variables as index expression for arrays gives us a way to generalize array access.

True

The differences between value types and reference types applies to parameters

True

We can implement a getter method without a setter method, thus creating a read-only value.

True

We can more easily debug a program when the responsibilities are well encapsulated

True

We can use a variable as an index expression to access an array element in Java

True

We cannot delete individual elements from an array in Java

True

We cannot delete individual elements from an array in Java.

True

When there are no remaining references to an object in your Java program, the object will be destroyed.

True

What structure is commonly used to iterate over all the elements of a two dimensional array?

a nested loop

If a reference type variable does not store a reference to an object, then it stores __________.

a null reference

The Java keywords "public" and "private" are called _____.

access modifiers

Which method can be used to insert an element into an ArrayList?

add

The Java statement counter++ will

add 1 to the variable count

Which of the following is/are true about arrays? Choose all that apply.

an array is a set of variables

The java expression like the one below will evaluate to ________. new Bunny("Flopsy", 8)

an object reference

Which method can be used to add an element to an ArrayList? Choose all that apply.

answered: at, none of these

The Java keyword used to declare that a method does not return a value is _____.

answered: null

Which of the following is a major functional limitation of arrays?

arrays have a fixed size

Which keyword is used in Java to define a class?

class

Every Java program consists of at least one

class definition

Which method can be called to remove all elements from an ArrayList at once?

clear

Which of the following are characteristics of the python programming language

compiled interpreted

Method overloading distinguishes between methods based on

data types of arguments and number of arguments

When there are no remaining references to an object, the object will be _____.

destroyed

Operation are things an object

does

Methods used to access an object's private data are called _____.

getters and setters

Which of the following step comes earliest in the object life cycle?

initialization

The purpose of a constructor is to _____.

initialize an object to a valid state

The purpose of a constructor is to __________

initialize an object to a valid state

The first step in the object life cycle is _____.

instantiation

In java, when you divide an int by another int, the result will be an

int

Which of the following would declare and instantiate an array of 5 integers in Java?

int[] my_array = new int[5];

Which of the following correctly demonstrates the use of an array initializer list? Choose all that apply.

int[] my_array = {1, 2, 3, 4, 5};

Which of the following would declare an array of integers in Java?

int[] my_array;

Java arrays have an attribute named _____ that can be accessed to get the size (number of elements) of the array.

length

The idea of looping through an array (element-by-element) looking for some element that meets our criteria, is called a(n) _____.

linear search

In java, functions are called

methods

Which keyword is used in Java to create an object?

new

which of the following would instantiate an array of 5 integers in Java? Choose all that apply.

new int[5]

Which of the following are characteristics of the Java programming language?

none of these

A reference type variable stores a _____________

reference

All non-primitive types in Java are __________

reference types

Which method can be used to remove an element from an ArrayList?

remove

Java uses the keyword ________ to return a value from a method

return

Which methods can be used to replace an element in an ArrayList?

set

In Java class members are declared with the keyword

static

In Java what keyword does an object use to refer to itself?

this

Which of the following is not a kind of loop in Java? Choose all that apply.

until

When doing an object oriented analysis of a problem, we call the ways that various kinds of users will use the system _____.

use cases

The two kinds of types in the Java programming language are ___________.

value and reference types

All of the Java primitive types are _______.

value types

An object's attributes are implemented as _____.

varaibles

An object's attributes are implemented as

variables


Conjuntos de estudio relacionados

Thomas Jefferson (3rd President)

View Set