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 5 pages
Exam (elaborations)

CSE 205 EXAM 1 UPDATED ACTUAL QUESTIONS AND CORRECT ANSWERS

Document preview thumbnail
Preview 2 out of 5 pages

CSE 205 EXAM 1 UPDATED ACTUAL QUESTIONS AND CORRECT ANSWERS

Content preview

CSE 205 EXAM 1 UPDATED ACTUAL QUESTIONS AND
CORRECT ANSWERS

Question:
1. A java application always contains a single method, this method is called? Give the signature of this
method.
Answer:
main public static void main(String[] args)

Question:
2. How is data given to this parameter?
Answer:
Through a command line interface. For example: java someCompiledClass data

Question:
3. Identifiers can only begin with?
Answer:
Letters, underscores, dollar sign

Question:
4. Is Java a Functional Language, Procedural Language, Object-Oriented Language, or Logic Language?
Answer:
Object-Oriented

Question:
5. What does API stand for?
Answer:
Application Programmer Interface

Question:
6. What needs to be done to use the scanner class?
Answer:
import java.util.Scanner;

Question:
7. What's the difference between println, and print
Answer:
println ends with a line break

Question:
8. What is Encapsulation?
Answer:
The hiding of design decisions in a computer program that are most likely to change, thus protecting other
parts of the program from change if the design decision is changed. The variables contained in an object
should be modified only within the object

, Question:
9. What are the three visibility modifiers and what is their scope?
Answer:
public: can be accessed from anywhere private: can only be accessed from inside the class protected: the
member can only be accessed within its own package (as with package-private) and, in addition, by a
subclass of its class in another package.

Question:
10. What is the purpose of toString()?
Answer:
The purpose is to give a readable representation of the object.

Question:
11. What is an accessor method?
Answer:
An accessor method can be defined to access private variable in the class since private data cannot be
accessed from outside of the class.

Question:
12. What is mutator method?
Answer:
A mutator method can be defined to modify private variable in the class.

Question:
13. What is a constructor?
Answer:
A constructor is a special method that is used to create a new object.

Question:
14. Define a constructor with two parameters int x, y for the class Point.
Answer:
public Point(int x, int y){ this.x = x; this.y = y;}

Question:
15. Which method signatures would give an error if all methods were defined in a single class?
Answer:
public int calc(int num1, int num2){ ... } public double calc(int num1, int num2){ ...} // differing return
type is not enough, must differ in parameter types and/or //number of parameters public int calc(double
num1, int num2){ ... } public int calc(int num3, int num4){ ... } // differs only in parameter name, must
differ in parameter types and/or //number of parameters public int calc(int num1, int num2, int num3){ ... }

Question:
16. What is the difference between an instance variable, and a local variable?
Answer:
instance variables are global to all instance methods of the class, local variables are only visible to the
method scope in which its defined.

Document information

Uploaded on
September 5, 2026
Number of pages
5
Written in
2026/2027
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.
STANFORDGENIUS
4.0
(237)
Sold
1562
Followers
108
Items
113428
Last sold
2 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