100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

CSCI1301 Exam 2 Questions And Correct Answers

Rating
-
Sold
-
Pages
6
Grade
A+
Uploaded on
11-10-2024
Written in
2024/2025

CSCI1301 Exam 2 Questions And Correct Answers...

Institution
CSCI1301
Module
CSCI1301









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
CSCI1301
Module
CSCI1301

Document information

Uploaded on
October 11, 2024
Number of pages
6
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

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
£7.69
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached


Also available in package deal

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Easton West Virgina University
Follow You need to be logged in order to follow users or courses
Sold
503
Member since
2 year
Number of followers
221
Documents
22060
Last sold
2 days ago

3.9

111 reviews

5
53
4
21
3
21
2
7
1
9

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these revision notes.

Didn't get what you expected? Choose another document

No problem! You can straightaway pick a different document that better suits what you're after.

Pay as you like, start learning straight away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and smashed it. It really can be that simple.”

Alisha Student

Frequently asked questions