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)

OOP terminology 2023 with complete solution questions and answers

Rating
-
Sold
-
Pages
4
Grade
A+
Uploaded on
11-03-2023
Written in
2022/2023

Program Modules Program development requires that large programs are divided into smaller program modules to be manageable. This is the principle of divide and conquer. Structured Programming Structured programming is an organized style of programming that places emphasis on modular programming, which aids testing, debugging and modifying. In structured programming, modules are procedures and functions that process external data passed by parameters Object Oriented Programming is a programming style with heavy emphasis on program reliability through modular programming. In object oriented programming, modules contain both the data and subroutines that process the data. In Java the modules are called classes and the process-subroutines are smaller modules called methods. Object Oriented Programming, a formal definition is a style of programming that incorporates program development in a language with the following three OOP traits: • Encapsulation • Polymorphism • Inheritance Encapsulation is the process of placing a data structure's data (attributes) with the methods (actions) that act upon the data, inside the same module, called a class in Java. Inheritance is the process of using features (both attributes and actions) from an established higher class. The higher class is called the superclass. The lower class is called the subclass. Polymorphism(vague) allows a single accessing feature, such as an operator, method or class identifier, to have many forms Class is a user-defined data type that encapsulates both data and the methods that act upon the data and is a template for the construction of objects. Object or Instance is one instance of a class. A class is a type and an object is a variable. Cat is a class and Fluffy is an object or one instance of the Cat class. Objects can be discussed in a general sense, such as in Object Oriented Programming. This causes confusion between Object, the concept and object, the instance of a class. There is a tendency to use instance when referring to one variable example of a class to avoid confusion. Attributes or Instance Variables The data components of a class are the class attributes and they are also called _________. should only be accessed by methods of the same class. Methods _______are action modules that process data. In other languages such modules may be called subroutines, procedures or functions. In Java the modules are called _______. They are declared inside a class module and process the instance variables. Instantiation is the moment or instance that memory is allocated for a specific object of a class. Statements like the construction of an object, the definition of an object, the creation of an object all have the same meaning as the instantiation of an object. Class Declaration Location is located outside any other class declaration. It is possible to declare one class inside another class (inner class), which is not part of this course. Instantiation and Construction An object is created with the new operator. The creation of a new object is called: instantiation of an object construction of an object The special method that is called during the instantiation of a new object is called a constructor. Private and Public Class Members The principle of encapsulation requires that object data members are only accessed by methods of the same object. Private class members of some object x can only be accessed by methods of the same x object. Public class members of some object x can be accessed by any client of object x. Data attributes of a class should be declared private. Methods of a class are usually declared public, but there are special helper methods that may also be declared private. Helper methods will be demonstrated later in this chapter. Copy Constructor is a constructor that instantiates a new object as a copy of an existing object. A ___________uses a single parameter, which is an object of the same class as the copy constructor. Objects and Simple (Types Store Information Differently) Simple (primitive) data types store assigned values directly in their allocated memory locations. Objects store memory references of the memory locations allocated during the construction of the object Aliasing occurs when two or more variables reference the same memory location. Any change in the value of one variable brings about a change in the value of the other variable(s). Java Parameters Java passes information to a method with parameters. A copy of the calling, actual parameter is assigned to the receiving, formal parameter in the method. In the case of a simple/primitive data type, a copy of the variable's value, like 23, 'A', or true, is sent by the parameter. Any changes are changes to a copy, which makes no changes to the original. The same thing actually happens in the case of an object; however, with an object the value is the memory address of the object itself. If this is changed, it does not alter the memory address of the original object. The only way changes made in a method impact the original calling object, is if changes are made to the attributes of the object. NOTE: Strings are objects, even though they tend to behave like simple/primitive data types in some programs. Class Methods It is possible to access methods directly without first creating an object. Methods that are accessed in this manner are called Class Methods. Class methods need to be declared with the static keyword used in the heading like: public static double add(double a, double b) { return a + b; } Accessing a class method is done with the class identifier, followed by the method identifier, like: Sln(C(X,Y)); It is possible to access static methods with object identifiers. This is considered poor styling and should be avoided. Static Methods and Static Attributes Static methods and static attributes can be accessed for the entire duration of a program. Static variables (attributes) can be accessed by static methods and object methods. Instance variables (attributes) can only be accessed by object methods. Static attributes can be accessed with object identifiers and class identifiers.

Show more Read less
Institution
OOP Terminology
Course
OOP terminology








Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
OOP terminology
Course
OOP terminology

Document information

Uploaded on
March 11, 2023
Number of pages
4
Written in
2022/2023
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$11.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

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.
Arthurmark Chamberlain College Of Nursing
Follow You need to be logged in order to follow users or courses
Sold
45
Member since
4 year
Number of followers
39
Documents
1422
Last sold
7 months ago

3.7

9 reviews

5
5
4
0
3
2
2
0
1
2

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