• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 3 out of 29 pages
Exam (elaborations)

CISC 3115 Final Exam with complete solutions: Answered latest updated summer 2025/2026.

Document preview thumbnail
Preview 3 out of 29 pages

CISC 3115 Final Exam with complete solutions: Answered latest updated summer 2025/2026.

Content preview

CISC 3115 Final Exam

August 18, 2025



Name:


120 minutes, 100 points. Closed notes, closed computer, etc. Do not leave the room while
taking the ezam.




Question 1 (5 points)
Note: each part of this question is a continuation of the previous parts.
(a) Suppose we using the Linux command line, working in a newly-created directory. We
write a program consisting of a class named P in a file named P.java. The program,
which contains no errors, is designed to read some data from standard input (the
keyboard) and to print some data to standard output (the screen).
Write the command to compile (but not run) the program.



(b) Write what is printed on the screen if we now enter the 1s command.



(c) Suppose we now create two additional files, named in.txt and out.txt, in the current
directory.
Write the command to run the program, arranging matters so that the program’s input
comes from in.txt and the program’s output goes to out.txt.



(d) Write the command to make a copy of in.txt, naming the copy copy.txt.



(e) Write the command to move copy.txt to the parent of the current directory.

,Question 2 (6 points)
Suppose we have the following Point class.
public class Point {
private int x, y;

public Point(int x, int y) {
this.x = x;
this.y Yy
}

public Point(Point original) {
this.x = original.x;
this.y = original.y;
}

public void setX(int x) { this.x = x; }

public void setY(int y) { this.y = y; }

@Override
public String toString() { return "(" + x + ey o+ )N}


Write the output of each of the following programs.

(a) public class PointClientl {
public static void main(String[] args) {
Point pl = new Point (1, 2);
Point p2 = pi;
Point p3 = new Point(1l, 2);

System.out.println(pl == p2);
System.out.println(pl == p3);

System.out.println(pl.equals(p2));
System.out.println(pl.equals(p3));

}
Hint: here’s the equals method as written in the Object class:
public boolean equals(Object obj) {
return (this == obj);
b

, (b) public class PointClient2 {
public static void main(String[] args) {
Point p = new Point(1, 2);

mi(p);
System.out.println("after mi: " + p);

m2(p);
System.out.println("after m2: " + p);
}

private static void mi(Point p) {
p = new Point(3, 4);
System.out.println("in mi: " + p);
}

private static void m2(Point p) {
p.setX(5);
System.out.println("in m2: " + p);




(c) public class PointClient3 {
public static void main(String[] args) {
Point pl = new Point (1, 2);
Point p2 = pi;

pl.setX(3);
System.out.println(p2);

p2.setY (4);
System.out.println(pl);

Document information

Uploaded on
August 21, 2026
Number of pages
29
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$21.99

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

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.
MindCraft
3.9
(56)
Sold
466
Followers
11
Items
2975
Last sold
22 hours ago



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