CSCI 185 Final

studied byStudied by 4 people
0.0(0)
get a hint
hint

Given:
int [] numbers = new double [8];
numbers [2] = 22.6

What is the correct term(s) for numbers? (Select all that apply)

1 / 22

encourage image

There's no tags or description

Looks like no one added any tags here yet for you.

23 Terms

1

Given:
int [] numbers = new double [8];
numbers [2] = 22.6

What is the correct term(s) for numbers? (Select all that apply)

Array or Array Variable

New cards
2

If you declare an array int[] list = [20,2,15,7] the value at the lowest index:

20

New cards
3

Which keyword modifier prevents a method from being Overriden in a subclass

final

New cards
4

A class can (blank) more than one interface

implement

New cards
5

A class that extends another class is called (choose all that apply)

a subclass, a child class

New cards
6

Which of the following is true about exceptions

We must make either a try catch block, or add a throws clause for all checked exceptions

Adding a Finally block after a Catch block is optional

We do not need to write code to handle certain types of exceptions

New cards
7

Per our class, which of the following are steps to take when creating a new exceptions class?

Do not override the getMessage() method

Create a Default constructor

New cards
8

time exception code one

time limit exceeded. Try again next time!

New cards
9

What happens if you create a method and it throws a checked exception that it does not catch?

The method must be decided with the throws clause and handed by the method in which it is called

New cards
10

What are the differences between a binary and a text file

The classes we use to write to such files

The way in which program writes to them

Text files are human readable and binary files are not

The type of data they can hold

New cards
11

Which best describes what is happening in the following code?

try {
while (true) {

int anInteger = inputStream.readInt();

System.out.println(anInteger);

}

}

catch(EOFException e);

{

//no code here

}

Program will loop until the end of the stream

New cards
12

When we discuss input in relation to files, are we

Talking about data being read from a binary file to a program

Referring to what a user enters in the console that is read by a stream object

Talking about data being read from a text file by a program

New cards
13

What are true about file paths in OS X, Windows 10, and Linux?

Folders in windows are separated by “;” folders in linux and OS X use “;”

New cards
14

Which of the following is true about recursion

Recursive methods are always faster than iterative

New cards
15

Suppose we have a method defined with the following code:

public void methodB(int n)

{

if(n<3)

System.out.print(“Goose”);

else

{

Systen.out.print(“Duck”)

methodB(n-1)

}

}

What would be the output of this code if we called methodB

with a value of 5 for its parameter?

Duck Duck Duck Goose

New cards
16

Which of the following is not true about binary search?

it uses binary numbers in the algorithms

New cards
17

Which of the following is not possible with the add() method of the ArrayList class?

Replace a value at a specific position in the list

New cards
18

Which of the following is an appropriate way to create an ArrayList that holds whole number values?

ArrayList<Integer>myList = newArrayList<Integer>(20)

New cards
19

What is a Text File? How is data stored inside of a text file? Are Java program files considered text files? What is a binary file? How are these different from text files? What type of data may we want to store in binary as opposed to text files?

A text file is a file on a computer system that stores data encoded as a text.

The data stored inside is simply just a series of strings with new lines. Java program files are text files because we can read and write to them as humans.

Binary files are files that are encoded as binary, with no text value.

Binary files are different from text files because, unlike text files, we can’t read binary files without special programs in order to do so.

New cards
20

Which method is not a member of the ArrayList <> class

size()

New cards
21

What is merge sort? Describe the details about its implementation as well as the process that it goes through.

pray

New cards
22

What is binary search?

a searching algorithm used in a sorted array by repeatedly dividing the search interval in half.

New cards
23

What is a recursive method? What purpose do they serve? How do we ensure we avoid infinite recursion when creating recursive methods?


A recursive method is a function or procedure that calls itself in order to solve a problem. To avoid infinite recursion, we need to ensure that the base case(s) will eventually be reached.

New cards

Explore top notes

note Note
studied byStudied by 63 people
Updated ... ago
4.0 Stars(4)
note Note
studied byStudied by 6 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 48 people
Updated ... ago
5.0 Stars(2)
note Note
studied byStudied by 23 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 34 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 15 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 64 people
Updated ... ago
4.8 Stars(4)
note Note
studied byStudied by 7738 people
Updated ... ago
4.5 Stars(20)

Explore top flashcards

flashcards Flashcard40 terms
studied byStudied by 40 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard40 terms
studied byStudied by 15 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard34 terms
studied byStudied by 6 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard48 terms
studied byStudied by 2 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard61 terms
studied byStudied by 30 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard45 terms
studied byStudied by 13 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard35 terms
studied byStudied by 5 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard110 terms
studied byStudied by 34 people
Updated ... ago
5.0 Stars(4)