Elance OOPS Concepts Test Answers 2015



What is a primary motivation for using OOP?
Because other programming paradigms have become obsolete.
To increase data coupling.
To increase speed of writing code.
To increase reusability and maintainability of code.


True or false? Polymorphism means to support multiple inheritance.
True
False


Patterns are:
solved computer science problems that are easy to reuse
for weenies and should be avoided
another word for interfaces
unpredictable


What is another name for the composition over inheritance technique?
Composite Reuse Principle
Comcast Reuse Principle
Compost Reuse Principle
Constant Refurbishment Practices


True or false? It's legal to have two variables both named $count where one is a global variable and the other is used inside a class.
only if $count is static in both uses
True
False


What are objects identified by?
Their relationship with other objects.
Their qualities.
Their unique name.
Their orientation within a program.


Ref counts are:
an optimization for compilers
how wrestling referees determine a winner
a way of managing object lifetimes
magic methods on all classes


What are method names typically restricted by?
The alphabet.
Ethical rules.
Code conventions.
Grammatical rules.


What kind of relationship is the public class “Animal” with the extension, “Mammal” demonstrating?
IS-NOT-A Relationship
HAS-A Relationship
WAS-A Relationship
IS-A Relationship


True or false? the final keyword blocks a child class from altering a method.
True
False


Which of these concepts is not an OOP concept?
decoupling
encapsulation
inheritance
semantics


Static binding is also known as what?
Dynamic binding.
Runtime binding.
Early binding.
Late binding.


When does binding occur with static binding?
After runtime binding occurs.
At runtime.
Never.
At compile time.


When an object is instantiated:
the new method is called
the init method is called
the constructor method is called
it gets a static initialization


Which of the following classes allows only one object of it to be created?
Abstract class
Friend class
Singleton class
Virtual class


How can dynamic binding be contrasted with static binding?
Dynamic binding is runtime binding, while static binding is compile time binding.
They are bound together with polymorphic compiling.
Dynamic binding is compile time binding, while static binding is runtime binding.
Static binding is better than dynamic binding.


True or false? .Encapsulation is a key reason to choose OOP design
True
False


Dynamic binding refers to binding that is done when?
At compile time.
At night.
At both compile time, and runtime.
At runtime only.


If a variable is declared to be default, what kind of modifier does it have?
Alphabetical.
Truncated.
Numeric.
It has no modifiers.


What is a simple way to think of inheritance?
One object writing new properties for another.
New properties written from scratch.
One object acquiring the properties of another.
One object generating another object.


A polymorphism can be called what?
A relationship between two objects.
A function that performs in different ways.
Functions that perform the same way.
The order of objects in a sequence.


C is an object oriented language
True
False


Public variables are visible outside of the class.
only to subclasses
False
only through methods
True


True or false? A class can implement one or more interfaces.
False
True


C++ is an object oriented language
True
False


True or false? An interface is another name for a class.
False
True


True or false? Private methods can be called by subclasses
False
True


OOP stands for:
object oriented programming
oops!
oblong object programming
objectively oriented programmers


True or false? A class factory and a constructor are the exact same thing.
False
True


If a user were to observe Java code from the outside world, what would they be able to access?
All of the code in the program.
The Java console.
The public methods.
The private methods.


The diamond problem refers to:
a common problem in single inheritance hierarchies
a very hard computer program, refering to the Mohs scale
a standard interview question for programmers
the multiple inheritance issue of determining which subclass method to call


If you wanted a variable to be free from changes outside its class, how should it be declared?
Encapsulated.
Public.
Private.
Free.


If you wrote two methods with the same syntax and arguments to define a class, what would happen?
An error because the compiler can't tell them apart.
The compiler would ignore both of them.
The compiler would assume a meaning and compile automatically.
The compiler would compile them separately in different instances, thus resolving any errors.


What is encapsulation used for?
Encapsulation is used to hide code from programmers.
Encapsulation is used to isolate malicious code.
Encapsulation is used to hide programmers from code.
Encapsulation is used to prevent unauthorized access to code.


True or false? Using traits gives single inheritance languages most of the power of multiple inheritance.
True
False


True or false? Implementing an interface is the same as creating a subclass
True
False


Static functions can use which variables?
private
static
private and static
public


In most OOP languages virtual methods are:
dynamically dispatched
not callable directly
statically dispatched


Why is dynamic binding referred to as “late binding”?
It is not bound at runtime.
It is not bound at compile time.
It is never bound.
It is bound at compile time.


Why is composition considered a simpler method than inheritance?
It is filled with complicated inheritance hierarchies.
Composition has complex namespace clashes.
It isn't considered a simpler method.
Composition lacks the namespace clash, and the complicated inheritance hierarchies.


A trait is:
another word for class
another word for interface
a collection of methods


Which of the following could be considered a polymorphism?
Two functions named “clsCalculation”.
Two classes named “clsCalculation” with the single function, “add”.
The class, “clsCalculation” with two functions, both named “Add”.
Two classes named “add”.


Can an object have more than one instance?
Yes.
Yes, but they must be in two different physical locations.
Yes, but it will result in errors.
No.


Which of the following is included in the field of formal semantics?
The definition of logistic models.
The comprehension of relational models.
The definition of semantic models.
The understanding of programming models.


A mutator method is also known as a:
updater
setter
deleter
getter


Lambda functions are allowed in class definitions
True
False


When a variable is defined within a class, what is it considered?
An instance variable.
An early variable.
A varying variable.
A class variable.


An abstract class can:
Be subclassed
Only contain abstract methods
Be instantiated


True or false? Static variables are visible outside of the class
depends
True
False


What is the most important trait of a polymorphism?
The total differences.
The multiple interfaces.
The common interface.
The difference in interface.


True or false? Abstract methods are only defined in the parent.
True
False


Semantically, what has happened if the result rendered is non-computational?
Syntactically illegal strings have occurred.
A system failure.
Syntactically legal strings have occurred.
A program corruption.


When two methods have the same name, what are they considered, and what kind of binding do they have?
Overloaded, late.
Overloaded, static.
Overloaded, dynamic.
Overhauled, static.


Programming languages supporting the OOPS paradigm are typically contained within what two classes?
System based and program-based.
Prototype-based, or class-based.
OOPS-based and object-based
Logic-based and inference-based.


What are classes used for?
Classes are used to manage metadata.
Classes are used to define specific types.
Classes define objects.
Classes describe different features.


A clone method is needed to:
to create a second copy of all contained subobjects
make any copies of children objects
make any copies of the parent object
make any copies of this object


Virtual inheritance is:
where only one base class object is created
not an OOP term
the base class is replicated for each derived class
where virtually nothing is inherited


What class and extension best demonstrate a HAS-A Relationship?
Feline, Lion
Canine, Mammal
Feline, Canine
Feline, Animal


If a system is systematically computing “metadata”, what would you use to define that system?
Attribute phonetics.
Programming metadata.
Attribute grammars.
Accentuated grammars.


True or false? Private variables are visible outside of the class.
True
False
only through methods
only to subclasses


What plays a critical role in testing for syntactic legality?
Syntactic congruency.
Mathematical truths.
Logical assumptions.
Termination proofs.