Term 1 of 93
What is the output of the following code?
int u = 3;
int v = 5;
u += v;
v += u;
u -= v;
v -= u;
PRINT (u + ", " + v);
5, 3
3, 5
-5, 18
-5,-3
False
True
Encapsulation
-5, 18
Term 2 of 93
Consider the array declaration and instantiation: int[ ] arrayOne = new int[5]; Which of the
following is true about arrayOne?
It stores 6 elements with legal indices from 0 to 5.
It stores 5 elements with legal indices from 1 to 5.
It stores 5 elements with legal indices from 0 to 4.
It stores 4 elements with legal indices from 1 to 4.
,Term 3 of 93
Once an array is created, it cannot be resized during program execution.
True/False
True
False
Term 4 of 93
Classes should be contained in their own file.
True/False
True
False
Term 5 of 93
Output is process of reading information from user, usually via keyboard or mouse.
True/False
True
False
Term 6 of 93
Array Lists can be multi-dimensional.
True/False
True
False
,Term 7 of 93
Consider variable x which is an int
where x = 0,
which statement below will be true after the following loop terminates?
while (x < 100)
{
x *= 2;
}
x == 0
x == 2
The loop won't terminate. It's an infinite loop.
x == 98
The loop won't terminate. It's an infinite loop.
X == 0
Produce an index out of bounds error.
Accessor and getter
Term 8 of 93
Parentheses can be left out if a method does not need any parameters.
True/False
True
False
Term 9 of 93
Program design consists of
the ability to solve problems.
writing the code for a program.
writing the documentation for a program.
steps a programmer should do before they start coding a program in a specific language.
, Term 10 of 93
Pseudocode form of writing should be used only when the logic of the program is complex.
True/False
True
False
Term 11 of 93
A String (or string) object is a primitive data type.
True/False
True
False
Term 12 of 93
Overloading methods means:
Sending more variables than parameters listed.
Multiple methods of same name with different parameters.
Crashing your program by running method too many times.
Repeating code in a program.
Term 13 of 93
What are used to get values from private attributes?
Accessor
Getter
Setter
Mutator
Produce an Index out of Bounds Error.
[0][0] and [0,0]
Accessor and Getter
Setter and Mutator
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller stuuviaa. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $7.99. You're not tied to anything after your purchase.