100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
CSCI1301 Exam 2 Questions And Correct Answers $9.99   Add to cart

Exam (elaborations)

CSCI1301 Exam 2 Questions And Correct Answers

 1 view  0 purchase
  • Course
  • CSCI1301
  • Institution
  • CSCI1301

CSCI1301 Exam 2 Questions And Correct Answers...

Preview 2 out of 6  pages

  • October 11, 2024
  • 6
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • csci1301
  • csci1301 exam 2
  • CSCI1301
  • CSCI1301
avatar-seller
Easton
CSCI1301 Exam 2 Questions And Correct Answers


True or false: A while loop may execute the body of the loop *zero times* (perform zero
iterations) - ANSWER True



A while loop keeps repeating the body of the loop until. - ANSWER The controlling
Boolean expression becomes false



What happens if a loop never reaches a stopping point and becomes an infinite loop? -
ANSWER You have to abort the program manually



A for-loop has three parts: an initializing action, a Boolean expression, and an update
action. Which one of the following three occurs for the first time *after* the first iteration
of the loop? - ANSWER Update Action



True or false: There are some circumstances where it is impossible to use a while loop.
In such circumstances, you must use a for loop. - ANSWER False



True or False It is generally better to use a do-while loop than a while loop if you are
certain that the body of the loop should execute at least *once*. - ANSWER True



What is the key reason you would want to use a do-while loop instead of a while loop? -
ANSWER If you want the body of the loop to at least run 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



Which index is associated with the first element in an array? ANSWER 0



Is an array an object or a primitive data type? ANSWER Object



How would you find the size of the array? ANSWER Use arrayName.length



How does an object differ 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(behaviours)



What type of method is the *main* method? - ANSWER Void



True or False Methods can have variables declared inside of them. - ANSWER True



True or False All methods must return a value or an object. - ANSWER False



If I had an object named fido and a method named bark, how would you call the method
bark on the fido object? - ANSWER fido.bark();



True or false: A variable that is declared *outside* of any method is called a *local*
variable. - ANSWER False

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

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

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

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 Easton. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $9.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

80630 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$9.99
  • (0)
  Add to cart