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 3 out of 16 pages
Exam (elaborations)

CSE 205 Exam 1 Questions And Answers Complete Study Solutions

Document preview thumbnail
Preview 3 out of 16 pages

CSE 205 Exam 1 Questions And Answers Complete Study Solutions A java application always contains a single method, what is the method name and give the signature of this method. ANS public static void main(Strings[] args){....} How is data given to its parameter? ANS Through a command line interface. Example: javac A java A in Java identifiers can only begin with? ANS Identifiers can only begin with letters, underscores( _ ), or dollar signs ($). Is Java a Functional Language, Procedural Language, Object-Oriented Language, or Logic Language? ANS Object-Oriented Language What does API stand for? ANS Application Programming Interface What package needs to be imported to use the scanner class? ANS import .Scanner; What is Encapsulation? ANS 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. What are the three visibility modifiers, and what is their scope? ANS 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. What is the purpose of toString()? ANS toString() is used to provide human users with a readable representation of the object. What is an accessor method? ANS (GETTER) an accessor method is a method that accesses or gets the value of a property of an object. What is a mutator method? ANS (SETTER) a mutator method is a method that sets the value of a property of an object.

Content preview

CSE 205 Exam 1 Questions And Answers Complete
Study Solutions
A java application always contains a single method, what is the method name and give the signature of this
method. ANS public static void main(Strings[] args){....}



How is data given to its parameter? ANS Through a command line interface.

Example: javac Assignment5.java
java Assignment5.java <input1.txt> myout1.txt



in Java identifiers can only begin with? ANS Identifiers can only begin with letters, underscores( _ ), or
dollar signs ($).


Is Java a Functional Language, Procedural Language, Object-Oriented Language, or Logic Language? ANS
Object-Oriented Language



What does API stand for? ANS Application Programming Interface



What package needs to be imported to use the scanner class? ANS import java.util.Scanner;



What is Encapsulation? ANS 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.



What are the three visibility modifiers, and what is their scope? ANS 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.



What is the purpose of toString()? ANS toString() is used to provide human users with a readable
representation of the object.

,What is an accessor method? ANS (GETTER) an accessor method is a method that accesses or gets the
value of a property of an object.



What is a mutator method? ANS (SETTER) a mutator method is a method that sets the value of a property
of an object.



What is a constructor? ANS A constructor is a special method that is used to create an object out of a class
definition and is used to initialize variables.


Define a constructor with two parameters int x, y for a class Point. A point object has an x and y coordinate.
ANS public Point(int x, int y){

this.x = x;
this.y = y;

}


Which method signatures would give an error if all methods were defined in a same (single) class?
public int calc(int num1, int num2){ ... }
public double calc(int num1, int num2){ ...}
public int calc(double num1, int num2){ ... }
public int calc(int num3, int num4){ ... }

public int calc(int num1, int num2, int num3){ ... } ANS public int calc(int num1, int num2){ ... }

public double calc(int num1, int num2){ ...}
public int calc(int num3, int num4){ ... }


These all have the same method signatures when calling the constructor, this is also known as Method
Overloading.



What is the difference between an instance variable, and a local variable. ANS INSTANCE: are GLOBAL
to all instance methods of the class
LOCAL: are only visible to the method scope in which it's defined.



The _________reference refers to the instance of the object. ANS this

, What is the keyword that associates a variable or method with the class rather than the object? ANS Static



Do all classes need a main method? ANS No, only one class should have a main method which is the entry
point to your program.



What is Software Engineering? ANS An attempt to produce a repeatable process for the development and
management of software projects. The quality of the software is a direct result of the process we follow to
create it.



Explain the relationship between development and maintenance effort. ANS Small increases in
development effort can reduce maintenance effort.



Which development method takes an object-oriented approach? Briefly describe this methods' steps. ANS
Evolutionary Development
Establish Requirements - What are the inputs expected by the applicationand what outputs are to be returned.

Architectural Design - Decide what kind of Algorithms and Data Structuresare needed to store and access the
data, and how are the objects going tointeract.Establish Refinement Scope - Phases of developmentIdentify
Classes & Objects -Identify RelationshipsDetailed DesignImplementationUnit TestingSystem Test Release


A very bad method for programming is called the Build-and-Fix approach. Why is this such a bad method?
ANS The build-and-fix approach is bad because no specifications are ever established which leads to
piecemeal code. Only immediate problems are corrected larger architectural problems are never identified or
fixed. Leads to an inability to maintain an application.


Suppose you have a program that takes as its input an integer from 0 to 423. Using the black box method of
testing list 9 test integers that you would use to adequately test the program. ANS -1, 0, 1

422, 423, 424

-100, 250, 550



What is a code walkthrough? ANS A meeting in which several people carefully review a design/ sections
of code to see if
the design satisfies requirement or the implementation represent the design.

Document information

Uploaded on
April 17, 2025
Number of pages
16
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$16.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.
Nipsey
4.1
(377)
Sold
2123
Followers
1528
Items
15240
Last sold
6 days 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