CSCI1301 Exam 2 Questions 100% Solved.
True or false: A while loop may execute the body of the loop *zero times* (perform zero
iterations) - answerTrue
A while loop keeps repeating the body of the loop until... - answerThe controlling Boolean
expression becomes false
What happens if a loop nev...
What is the main reason you would use a do-while loop over a while loop? - answer✔If you
want the loop body to execute at least once
What does the *continue* statement do? - answer✔Skips the current iteration of a loop body
True or false: A single array can contain values of *different* data types. - answer✔False
True or false: An array must contain at least *2* elements. - answer✔False
True or false: You could have a program that has 2 arrays. One array stores int values and the
other stores String values. - answer✔True
What index refers to the very first element of an array? - answer✔0
Is an array an object or a primitive type? - answer✔Object
How do you find the number of elements in an array? - answer✔Use arrayName.length
How is an object different from a class? - answer✔A class is a general definition for objects.
Objects are particular instances of the class which have values for the instance variables.
What are the two main things that a class specifies for objects? - answer✔Attributes and actions
(behaviors)
What type of method is the *main* method? - answer✔Void
True or false: Methods may have variables declared inside of them. - answer✔True
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 sirjoel. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $10.49. You're not tied to anything after your purchase.