Save
Upgrade to remove ads
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

SA2 - OOP

QuestionAnswer
When Overloading does not occur? More than one method with same name, same number of parameters and type but different signature
What is it called if an object has its own lifecycle and there is no owner? Association
Which of following statement can result in new object instance creation if executed successfully. -All -String str = new String("VirtuQ"); -String str = "VirtuQ" + " "+ Simplifying Education"; -int [] arr = {1,2,3,4,5}; -String str = new String(); All
OOP describes the task to be performed on objects.(T/F) True
True or False: This line of code is correct System.out.println("Hi!"); True
static Variable used in defining a class variable(T/F) True
Global Variables are variables used in a methodT/F) False
a method a method that is accessible from all classes. public method
final Variable: constant variable(T/F) True
This - It can be used to access class variables and methods.(T/F) False
Which feature can be implemented using encapsulation? Group of answer choices Abstraction Polymorphism Inheritance Overloading Abstraction
Encapsulation is implemented by using__________ Group of answer choices None of the above class private public static
How can Encapsulation be achieved? Group of answer choices Using Abstraction Using inheritance Using only private members Using Access Specifiers Using Access Specifiers
Abstraction is the way to add functions in a user defined structure.(T/F) False
Which among the following violates the principle of encapsulation almost always? Group of answer choices Array variables Public variables Local variables Global variables Global variables
How many classes can be inherited by a single class in java? Only 1
If base class contains 2 nested classes, will it be possible to implement single level inheritance? Yes, only if derived class also have nested classes No, never No, it will use more than 2 classes which is wrong Yes, always Yes, always
Which among the following is correct for a hierarchical inheritance? One base class can be derived into other two derived classes or more
Which amongst the following is true for hybrid inheritance? Group of answer choices Constructor calls are priority based Constructor of only derived class is called Constructor calls are usual Constructor calls are in reverse Constructor calls are usual
Which among the following is correct for the following code? class A { public : class B { public : B(int i): data(i) { } int data; } }; class C: public A { class D:public A::B{ }; }; Single level inheritance is used, with both enclosing and nested classes
The focus of procedural programming is to break down a programming task into a collection of variables, data structures, and subroutines(T/F) True
A _____ is a procedure associated with a class that describes an action an object is able to perform. function routine method procedure Method
________ describes the task to be performed on objects. Group of answer choices Procedural Programming OOP OOP
What is it called where child object gets killed if parent object is killed? Group of answer choices Composition Aggregation Association Encapsulation Composition
this keyword can be passed as an argument in the method call.(T/F) True
________ – a method that is automatically executed when an object is created. This method is used to initialize the attributes. Group of answer choices Constructor Default Custom Constructor
Access (Getter) – a method that is used to access or retrieve data. Group of answer choices false true False
Instance Variables are variables stored in the class and are available to all objects of a class or objects of other classes if access is permitted(T/F) False
In Inheritance, the programmer can change one part of the code without affecting other parts Group of answer choices true false True
Encapsulation is implemented by using private Group of answer choices false true True
Encapsulation is supported by ___________ Group of answer choices None of the above Objects Methods Classes Classes
Which among the following should be encapsulated? -The data which belongs to some other class -The data which is intended to be changed -The data which is prone to change is near future -The data prone to change in long terms The data which belongs to some other class
Which is the correct syntax of inheritance? class derived_classname : access base_classname{ /*define class body*/ };
The private members of the base class are visible in derived class but are not accessible directly. Group of answer choices True False True
Which among the following best describes multiple inheritance? More than one class being parent of single child
Which access type data gets derived as private member in derived class? Group of answer choices Protected Private Public Protected and Private
If class A and class B are derived from class C and class D, then ________________ Group of answer choices Those is enclosing class Those are all independent classes Those are 2 pairs of single inheritance That is multilevel inheritance That is multilevel inheritance
___ ___is a technique of solving a problem and breaking it down into smaller parts and solving each of the smaller problems. Procedural Programming
This model of software development is process-centric or procedural since it concentrates on the procedures in a system. Procedural Programming
It describes the task to be performed on objects. These objects that have to be created and stored in the computer memory, contain data and instructions to perform tasks specific to that object. Object-Oriented Programming
ØThe focus of ___ ___ is to break down a programming task into a collection of variables, data structures, and subroutines Procedural Programming
Whereas in ___ -___ ___, it is to break down a programming task into objects that expose behavior (methods) and data (members or attributes) using interfaces. Object-Oriented Programming
The most important distinction is that while ___ ___uses procedures to operate on data structures Procedural Programming
___ ___programming bundles the two together, so an "object", which is an instance of a class, operates on its "own" data structure. Object-Oriented
procedure vs ___ procedure vs methods
___ vs methods procedure vs methods
___ vs object record vs object
record vs ___ record vs object
___ ___ vs message procedure call vs message
procedure call vs ___ procedure call vs message
It uses a collection of objects interacting with each other. Object-Oriented Programming
One of the principal advantages of using ___ ___ is that it enables programmers to create modules that need not be changed when a new type of object is added. OOP technique
Reduced software complexities and realistic modelling through the use of various techniques: Benefits of OOP
The process of picking out the common features of objects and procedures. This process focuses on the essential characteristics of an object. Abstraction
The process of hiding the implementation details of an object. Encapsulation
Software reusability by implementing inheritance. Programs are built that can be used by several other applications. Benefits of OOP
allows an object to extend its characteristics to another object. Inheritance
Resilience to change with the use of polymorphism Benefits of OOP
Ability to process objects differently depending on their data type or class. Polymorphism
A ___ is a template or blueprint that defines an object’s attributes and operations. It serves as a design for creating objects. Class
An ___ is an instance of a class that consumes memory and has a finite lifespan. It represents a specific realization of the class, containing actual values for the attributes defined by the class. Object
Exists when an object contains a reference to another object. Referred to as the “has a” relationship. Association
Referred to as the “kind of” or “is a” relationship. Inheritance
The parent class from which properties are inherited by another class superclass (base class)
a new class with properties taken from a parent class subclass (derived class)
a well-encapsulated conceptual class. The objects of this class do not exist in real world abstract class
___ is a general-purpose notational language used for specifying and visualizing complex software, usually large object-oriented project. It uses several types of diagrams such as the case diagram, class diagram, and state chart diagram. Unified Modeling Language (UML)
A ___ ___ is used to describe the attributes and behaviours of objects in the system. Class Diagram
are the data contained in a class Attributes
are the actions performed on that data Operations
Public (+), Private (-), Protected (#) Accessibility
+ Public
- Private
# Protected
~ Package
“ “ no symbol indicates default access
“ “ represents abstract class method
underline represents static method or attribute
Customer -CustomerID: Long (Attributes) +Name: String (Attributes) +AddCustomer( ) [Save Operation – No parameters] +GetDetails(ID: Integer) [Load Operation – Integer parameter] -CheckValid( ): Boolean[CheckValid Operation – Boolean return value]
declared either at the start or end of a class definition. These variables identify the data stored in the object. Attributes
a method that is automatically executed when an object is created. This method is used to initialize the attributes. Constructor
Standard Methods used to change or access the private data in an object.
Mutator (Setter) a method that is used to change the data.
Accessor (Getter) a method that is used to access or retrieve data.
Custom Methods implement the business rules for which the application is being developed.
Class Name Attributes<--attributes declaration Operations or Methods<--- constructor definition standard methods definition custom methods definition
Define the ClassName <access> class <ClassName> { //codes here } public class Student { //codes here… }
Declare the attributes <access> <datatype> <attributeName>; private String Name;
Create constructor <access> <ClassName(args list)> { //code here } public Student(){ this.name = ""; }
Create standard methods (setters) <access> <return type> setXxx(args list) { //codes here } public setName(String newName){ this.name = newName; }
<access> <return type> getXxx (args list) { //codes here } public getName(){ return this.name; }
Create custom methods Syntax: <access> <return type> <methodName(args list)> { //codes here } public void displayName(){ System.out.println(this.name); }
contains a reference to the current object being constructed. It represents an instance of the class in which it appears. It can be used to access class variables and methods. this (Keyword)
Variable: a variable that is only accessible within a class where it is declared. Method: a method that is only accessible within the class where it is declared. private
Variable: a variable that is accessible from all classes. Method: a method that is accessible from all classes. public
The ____ modifier is accessible only within the package. If you don't use any modifier, it is treated as default by ___. default (no keyword)
The ___ access modifier is accessible within and outside the package but through inheritance only. It can be applied on the data member, method and constructor. It can't be applied on the class. protected
Variable: used in defining a class variable. Method: used in defining a class method. static
Class: a class that can never be sub-classed Variable: Constant Variable Method: a method that cannot be overridden. final
variables stored in each object of a class, usually referred to as the non-static member fields of a class. Instance Variables (non-static fields)
variables stored in the class and are available to all objects of a class or objects of other classes if access is permitted, usually referred to as the static members of the class. Class Variables (static fields)
data used in a method. This data is temporary and does not exist once the method has completed execution. Local Variables (method variables or local data)
The meaning of ___, is to make sure that "sensitive" data is hidden from users. To achieve this, you must: Encapsulation
Declare class variables/attributes as private (only accessible within the same class) Encapsulation
Provide public setter and getter methods to access and update the value of a private variable Encapsulation
Private variables can only be accessed within the same class (an outside class has no access to it) However, it is possible to access them if we provide ___ ___ ___ and ___ ___methods. Get and Set. public getter (accessor), setter (mutator)
The ___ method returns the variable value Get
the ___ method sets the value. Set
___ (if you omit the set method) read-only
___ (if you omit the get method) write-only
The programmer can change one part of the code without affecting other parts Flexible
The technique of deriving new class definitions from an existing class definition. Inheritance
Re-use of predefined and well-tested classes benefits of using class inheritance in OOP
Standardization of behaviors across a group of classes benefits of using class inheritance in OOP
Ability to use members of a family of classes interchangeably in methods benefits of using class inheritance in OOP
is the class from which another class inherits properties. This is a class that is on top of a hierarchy. Superclass
is a class that inherits all the non-private attributes and methods, except constructors from a superclass. This class has the ability to override methods of the superclass. Subclass
Syntax for Implementing Inheritance: public class Subclass extends Superclass{ }
Subclasses derived from a single superclass Single Inheritance
Subclasses derived from a multiple superclass Multiple Inheritance
Java ___ ___ support multiple inheritance, however, Java provides same effects and benefits of multiple inheritance through the use of interface. does not
contains a reference to the parent class (superclass) object. It is used to access members of a class inherited by the class in which it appears. Super
It explicitly call a constructor of its immediate superclass. A super constructor call in the constructor of a subclass will result in the execution of relevant constructor from the superclass, based on the arguments passed. Super
OOP is a technique of solving a problem and breaking it down into smaller parts and solving each of the smaller problems. Group of answer choices false true False
Which statement(s) best describes inheritance? The child object inherits from its parent, adding specialized attributes and behavior When a child object inherits from its parent, only the additional attributes and behavior must be coded, which is one of the benefits of OOP.
How do I print out numbers on JAVA? Group of answer choices System.out.println(#); System.out.println('#'); System.out.println(false); System.out.println("#"); System.out.println(false);
this can be used to refer current class instance variable. Group of answer choices true false True
a method that is only accessible within the class where it is declared. Group of answer choices public method private method protected method private method
_________– used to change or access the private data in an object. Standard Methods
final Class: a class that can never be sub-classed Group of answer choices true false True
In Encapsulation, Class variables can be made read-only or write-only false true True
Encapsulation has poor control of class attributes and methods Group of answer choices true false False
Which of the following is not an advantage to using inheritance? One big superclass can be used instead of many little classes.
How many types of inheritance can be used at a time in a single program? Group of answer choices Any two types Any 4 types Any three types Any type, any number of times Any type, any number of times
Members which are not intended to be inherited are declared as ________________ Group of answer choices Public members Private or Protected members Private members Protected members Private members
If a derived class object is created, which constructor is called first? Group of answer choices Depends on how we call the object Base class constructor Not possible Derived class constructor Base class constructor
Created by: user-1776272
 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards