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
Document preview thumbnail
Preview 2 out of 8 pages
Exam (elaborations)

CS 2420 Midterm 1 UPDATED ACTUAL and Correct Answers

Document preview thumbnail
Preview 2 out of 8 pages

CS 2420 Midterm 1 UPDATED ACTUAL and Correct Answers

Content preview

CS 2420 Midterm 1 UPDATED ACTUAL and Correct Answers
Question: What prints?
double d = 3.14;
int i = (int)d;
System.out.println("d is " + d + " and i is " + i);
Answer:
d is 3.14 and i is 3

Question: What prints
boolean b = true;
if(10 > 100 && b)
System.out.print("1");
else
System.out.print("2");
if(10 > 100 || b)
System.out.println("3");
Answer:
23

Question: What prints
Point p1 = null;
if(true)
p1 = new Point();
p1.x = 3;
p1.y = -5;
Point p2 = p1;
p2.x = 10;
System.out.println("p1.x is " + p1.x + " and p2.x is " + p2.x);
Answer:
p1.x is 10 and p2.x is 10

Question: What is the testing technique in which the smallest testable parts of an application are
individually and independently tested for correctness called?
Answer:
unit
testing

, Question: All methods that are members of an interface are abstract
Answer:
true

Question: All members of an interface (methods and data) are public
Answer:
true

Question: A class that implements an interface must not perform any method overloading
Answer:
false

Question: All methods that are members of an interface must have a return type of
void
Answer:
false

Question: All abstract classes are interfaces
Answer:
false

Question: class Person { public String getAddress() ... }
class Employee extends Person { public double getSalary() ... }
class Student extends Person { public String toString() ... }
class GradStudent extends Student { public boolean equals(Object other) ... }
Employee e = new Employee();
Student s = new GradStudent();
Person p = e;
Object o = s;
Answer:


Question: What is true of the method call p.getSalary()?
Answer:


Question: What is true of the method call s.toString()?
Answer:

Document information

Uploaded on
June 28, 2026
Number of pages
8
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$13.49

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.
STANFORDGRADESS
4.0
(238)
Sold
1579
Followers
108
Items
114633
Last sold
1 day 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