Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

CS 1102 Programing 1 JAVA Self Quiz Review 9 Attempt A, B &C Complete Study Questions And Answers 2025 Updated Tests

Rating
-
Sold
-
Pages
69
Grade
A
Uploaded on
11-06-2025
Written in
2024/2025

CS 1102 Programing 1 JAVA Self Quiz Review 9 Attempt A, B &C Complete Study Questions And Answers Updated Tests

Institution
CS 1102
Course
CS 1102

Content preview

CS 1102 Programing 1 JAVA Self Quiz Review 9 Attempt A,
B &C Complete Study Questions And Answers Updated
Tests
Attempt A
Question 1
Correct
Mark 1.00 out of 1.00
Question text

What is the output of the following Java program?
import java.util.*;
class Array Games {
public static void main(String[] args) {
Array List<Integer> a = new ArrayList<Integer>();
for (int i = 1; i <= 5; i++) a.add(i);
System.out.println(a.get(a.get(2)));
}
}
Select one:


b.
c.

d.


Feedback

Your answer is correct.
The ArrayList has elements {1,2,3,4,5}. Because indices start at 0, "a.get(2)" returns the 3rd element, 3. Then
"a.get(3)" returns 4. See Section 7.3.1.
The correct answer is: 4
Question 2
Incorrect
Mark 0.00 out of 1.00
Question text

Consider the following Java method, which term best describes "'("Hello, World!")"?

,public static void main(String[] args) {
System.out.println("Hello, World!"); }


Select one:
actual parameter or argument
b. formal parameter
c. method call

d.


Feedback

Your answer is incorrect.
See Section 4.3.2 of Eck (2014).
The correct answer is: actual parameter or argument
Question 3
Correct
Mark 1.00 out of 1.00
Question text

What is output by the following Java program?
class Zap { static boolean zap() { return
true; } static int zap(boolean x) { return 0; }
static double zap(int x) { return 0.5; } static
String zap(double x) { return "Zap!"; } static
boolean zap(String x) { return false; } public
static void main(String[] args) {
System.out.println(zap(zap(zap(zap()))));
}
}
Select one:
true
b.
c. 0.5

d. Zap!


Feedback

Your answer is correct.

,The innermost call to "zap" has no argument, so it uses the first method definition, which returns the boolean
value true. The next call to "zap" thus gets a boolean argument, so it uses the second method definition,
which returns the int 0. The next call to "zap" gets this int argument, so it uses the third method definition,
which returns the double 0.0. The outmost call to "zap" thus gets a double argument, so it uses the fourth
method definition, which returns the String "Zap!" See Section 4.3.3 of Eck (2014).
The correct answer is: Zap!
Question 4
Correct
Mark 1.00 out of 1.00
Question text

Which one of the following claims about Java is INCORRECT?
Select one:


b. An object belongs to a class.
c.

d.


Feedback

Your answer is correct.
See Sections 5.1.1, 5.1.2, and 5.3.2 of Eck (2014).
The correct answer is: An object is a type.
Question 5
Correct
Mark 1.00 out of 1.00
Question text

What is the output of the following Java program?

interface Food {
public void printFlavor();
}
class Pepper extends Food {
public void printFlavor() { System.out.println("spicy"); }
}
public class Lunch { public static void
main(String[] args) { Food pepper =
new Pepper();
pepper.printFlavor();

, }
}
Select one:

a. bland

b. bland
spicy

c. no output

d. spicy

e. the program does not compile
Feedback
Your answer is correct.
"Food" is an interface, not a class. "Pepper" must implement it, not extend it. See Section 5.7.1.
The correct answer is: the program does not compile
Question 6
Incorrect
Mark 0.00 out of 1.00
Question text

Which one of the following values can a Java variable NOT have?
Select one:

a floating-point number
b. an integer
c. an object
d. the memory location of an object


Feedback

Your answer is incorrect.
Java object variables store references to objects, not the objects themselves. See Section 5.1.2 of Eck (2014).
The correct answer is: an object
Question 7
Incorrect
Mark 0.00 out of 1.00
Question text

Written for

Institution
CS 1102
Course
CS 1102

Document information

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

Subjects

$18.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF


Also available in package deal

Thumbnail
Package deal
CS 1102 Verified Package Deal With Latest Study Pack Solutions 2025 Updates
-
15 2025
$ 70.99 More info

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.
Nipsey Chamberlain School Of Nursing
View profile
Follow You need to be logged in order to follow users or courses
Sold
2106
Member since
5 year
Number of followers
1528
Documents
15173
Last sold
3 days ago
LECT EXAMS

FOR THE BEST ASSIGNMENTS,TEST BANKS,EASSY AND TO HELP IN TUTORING I have done papers of various topics and complexities. I am punctual and always submit work on-deadline. I write engaging and informative content on all subjects. Send me your research papers, case studies, psychology papers, etc , and I’ll do them to the best of my abilities. Writing is my passion when it comes to academic work. I’ve got a good sense of structure and enjoy finding interesting ways to deliver information in any given paper. I love impressing clients with my work, and I am very punctual about deadlines. Send me your assignment and I’ll take it to the next level. I strive for my content to be of the highest quality. Your wishes come first— send me your requirements and I’ll make a piece of work with fresh ideas, consistent structure, and following the academic formatting rules For every student you refer to me with an order that is completed and paid transparently, I will do one assignment for you, free of charge!!

Read more Read less
4.1

372 reviews

5
216
4
57
3
56
2
14
1
29

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

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions