Computer programming final

studied byStudied by 1 person
0.0(0)
get a hint
hint

If the source code is compiled by a java compiler, what is the output?

1 / 21

encourage image

There's no tags or description

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

22 Terms

1

If the source code is compiled by a java compiler, what is the output?

Byte code and .class file

New cards
2

Programming style is important because

a program with proper style is easy to debug for errors, a program is more readable with proper style

New cards
3

To exit a loop and  move directly on to the next iteration of the loop which is an appropriate command to use

continue

New cards
4

Which of the following is not a type of loop

for while   (for, do while, and while are real)

New cards
5

Which of the following are part of a class interface

method signatures, class javadoc comments

New cards
6

What type should a method that prints a string to the console be?

public void methodName()

New cards
7

Encapsulation divides a class into which 2 of the following?

implementation, interface

New cards
8

What is the default constructor in a java class

the constructor defined with no parameters, a constructor that is provided to us by java when no other constructor is defined

New cards
9

What is the purpose of defining and using a constructor?

to provide an object with initial values, to instantiate an object

New cards
10

Which of the following would be appropriate for generating a random number for a 20 sided die (values 1-20)

int d20 = (int)(20.0 * Math.random()) +1;

New cards
11

You can overload a method by changing

type of parameters, number of parameters

New cards
12

A class variable that can be accessed without the need of instantiating an object is a

static

New cards
13

Consider the following array-

Int[] a = new int[22];

What is the last index of a?

a.length-1, 21

New cards
14

Which of the following are true about arrays

arrays must have a declared size in order to be used, it is ok to waste element 0

New cards
15

When creating a method that takes an array as a parameter we must

ensure the method can deal with any size array

New cards
16

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

20

New cards
17

The search algorithm that looks through each element in an array in order, until a result is found is called:

sequential search

New cards
18

What is a reference type

A reference to data stored in memory or a variable that holds a memory address as its value

New cards
19

Are class objects reference types

yes

New cards
20

Are primitive types such as int and double reference types

no

New cards
21

Which of the following is not true when encapsulating a class definition?

We should make helping methods that are only to be called by other methods Public

New cards
22

The job of accessor and mutator methods are:

to set and get the values of Private instance variables

New cards

Explore top notes

note Note
studied byStudied by 3937 people
Updated ... ago
4.9 Stars(11)
note Note
studied byStudied by 38 people
Updated ... ago
4.0 Stars(2)
note Note
studied byStudied by 13 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 94 people
Updated ... ago
4.8 Stars(5)
note Note
studied byStudied by 48 people
Updated ... ago
4.0 Stars(3)
note Note
studied byStudied by 21 people
Updated ... ago
5.0 Stars(2)
note Note
studied byStudied by 14 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 16 people
Updated ... ago
4.0 Stars(1)

Explore top flashcards

flashcards Flashcard55 terms
studied byStudied by 8 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard198 terms
studied byStudied by 2 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard100 terms
studied byStudied by 113 people
Updated ... ago
5.0 Stars(3)
flashcards Flashcard137 terms
studied byStudied by 4 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard126 terms
studied byStudied by 209 people
Updated ... ago
4.0 Stars(14)
flashcards Flashcard126 terms
studied byStudied by 4 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard106 terms
studied byStudied by 9 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard119 terms
studied byStudied by 38 people
Updated ... ago
5.0 Stars(2)