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

CSCI 1301 MIDTERM QUESTIONS WITH 100% CORRECT ANSWERS

Rating
-
Sold
-
Pages
15
Grade
A+
Uploaded on
05-12-2025
Written in
2025/2026

CSCI 1301 MIDTERM QUESTIONS WITH 100% CORRECT ANSWERS

Institution
CSCI 1301
Course
CSCI 1301









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

Written for

Institution
CSCI 1301
Course
CSCI 1301

Document information

Uploaded on
December 5, 2025
Number of pages
15
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

What is wrong, logically, with the following code?


Give this one a try later!


There is no logical error, but there is no need to have (x <= 10) in the second
conditional or (x <= 6) in the third conditional

, What is the output of the following code:


int num1 = 6;
int num2 = 10;
num1 = num1 + num2;
num2 = num1 + num2;
System.out.println(num1 + ", " + num2);


Give this one a try later!


16, 26




Write code to declare and instantiate an object of the Random class (call the
object reference variable rand). Then write a list of expressions using the
nextInt method that generate random numbers in the following specified
ranges, including the endpoints. Use the version of the nextInt method that
accepts a single integer parameter.
a. 0 to 10
b. 0 to 400
c. 1 to 10
d. 1 to 400
e. 25 to 50
f. -10 to 15


Give this one a try later!


a.
0 to 10
rand.nextInt(11)
b.
0 to 400
rand.nextInt(401)
c.
1 to 10
rand.nextInt(10) + 1

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.
TestITandFixIT Johns Hopkins University
View profile
Follow You need to be logged in order to follow users or courses
Sold
36
Member since
1 year
Number of followers
0
Documents
4737
Last sold
4 days ago

3.5

8 reviews

5
3
4
2
3
1
2
0
1
2

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 tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right 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 aced it. It really can be that simple.”

Alisha Student

Frequently asked questions