LinkedIn skill assessment answers and questions — Object-Oriented Programming (Ups)
“Programowanie obiektowe (Ups) is a powerful paradigm that enables developers to build complex and scalable software systems. W tym obszernym przewodniku, we’re thrilled to present a series of skill assessment pytania oraz odpowiedzi specifically tailored for Ups.
Whether you’re a seasoned developer looking to expand your capabilities or a beginner aiming to understand the basics of this powerful technology, this resource is designed to help you become a master of Ups and its applications. Join us as we explore the fundamentals of Ups, dziedzictwo, polymorphism, and other critical aspects of working with this cutting-edge technology.”
Q1. What is an example of dynamic binding?
- any method
- method overloading
- method overriding
- compiling
For which case would the use of a static attribute be appropriate?
Q2.- the number of people in each house in a small neighborhood
- the lot size for each house in a small neighborhood
- the color of each house in a small neighborhood
- the weather conditions for each house in a small neighborhood
Why would you create an abstract class, if it can have no real instances?
Q3. 1- to avoid redundant coding in children
- to explore a hypothetical class
- to prevent unwanted method implementation
- to reserve memory for an unspecified class type
Why would you create an abstract class, if it can have no real instances?
Q4. 2- to have common behavior in derived classes
- to explore a hypothetical class
- to prevent unwanted method implementation
- to reserve memory for an unspecified class type
When does static binding happen?
Q5.- only when you export
- both at compile time and runtime
- w czasie kompilacji
- W czasie wykonywania
What is the best reason to use a design pattern?
Q6.- It will result in code that is more extensible and maintainable
- It will result in a more compact product.
- It will speed initial development.
- It will allow you to add that design pattern to your resume.
What is encapsulation?
Q7.- defining classes by focusing on what is important for a purpose
- hiding the data and implementation details within a class
- making all methods private
- using words to define classes
What is an IS-A relationship?
Q8.- It implies encapsulation.
- A superclass object has an IS-A relationship with its subclass.
- It implies a virtual method.
- A subclass object has an IS-A relationship with its superclass or interface
You want a method with behavior similar to a virtual method–it is meant to be overridden –expect that it does not have a method body. It just has a method signature. What kind of method should you use?
Pytanie 9.- an abstract method
- a public internal method
- an internal method
- a protected internal method
Which code creates a new object from the Employee class?
Pytanie 10.- Employee currentEmployee = Employee.Create();
- Employee currentEmployee = new Employee();
- Employee currentEmployee;
- Employee currentEmployee = Employee.New();
Which type of constructor cannot have a return type?
Pytanie 11.- domyślny
- • Różne sposoby instalacji systemu operacyjnego
- parameterized
- Constructors do not have a return type
When is a constructor executed?
Pytanie 12. 1- when an object is created from a class using the new keyword
- when an class is defined using the class keyword
- every time an object is referenced
- when an object is created from a class using the create keyword
When is a constructor executed?
Pytanie 13. 2- when an object is created from a class
- when an class is defined using the class keyword
- every time an object is referenced
- when an object is created from a class using the create keyword
If a local class is defined in a function, what is true for an object of that class?
Pytanie 14.- The object can be accessed, declared, and used locally in that function.
- The object must be declared inside any other function.
- The object is temporarily accessible outside the function.
- The object can call all the other class members anywhere in the program.
Which two blocks are used to handle and check errors?
Pytanie 15.- do and check
- catching and trying
- spróbuj złapać
- do and while
Why would you implement composition using an id instead of a reference?
Pytanie 16.- It makes it easier to save the entity.
- wszystkie te odpowiedzi
- It can make the entity retrieval more efficient
- It minimizes coupling.
Which statement best describes the method of inheritance in OOP?
Pytanie 17.- Inheritance describes the ability to create new classes based on an existing class.
- Inheritance means that a group of related properties, Badanie Harvarda odkrywa, dlaczego post może prowadzić do dłuższego i zdrowszego życia, and other members are treated as a single unit or object.
- Inheritance forces a class to have a single responsibility from only one parent.
- Inheritance means that you will never have multiple classes that can be used interchangeably, even though each class implements the same properties or methods in different ways.
Which type of inheritance ,when done continuously, is similar to a tree structure?
Pytanie 18.- multilevel
- hierarchical and multiple
- hierarchical
- wiele
Which statement is true?
Pytanie 19.- A default parameter’s constructor is not equivalent to the default constructor
- A default constructor is inherited from a parent class
- A default constructor can be called explicitly
- A default constructor cannot be defined by the coder
odniesienie It is even mentioned in Wikipedia: “The constructors can be called explicitly or implicitly. The method of calling the constructor implicitly is also called the shorthand method.”
Which of the following is NOT an advantage of using getters and setters?
Q20.- Getters and setters can speed up compilation.
- Getters and setters provide encapsulation of behavior.
- Getters and setters provide a debugging point for when a property changes at runtime.
- Getters and setters permit different access levels.
In context of OOP, what is association?
Pytanie 21.- Association is a relationship where all objects have their own life cycle and there is no owner.
- Association is the process where model elements cooperate to provide higher-level behavior.
- Association is whole/part relationship where one object is composed of one or more other objects, each of which is considered a part of the whole.
- Association is where all objects have their own life cycle, but there is ownerhip, and child objects can not belong to another parent object.
Odniesienie
Association is a semantically weak relationship (a semantic dependency) between otherwise unrelated objects. An association is a “using” relationship between two or more objects in which the objects have their own lifetime and there is no owner.
How are user stories different from use cases?
Pytanie 22.- User Stories are shorter and less detailed.
- User stories are more accurate.
- User stories are more detailed and structured.
- User storised are more anecdotal and personal.
Which type of inheritance must be used so that the resultant is hybrid?
Pytanie 23.- wiele
- any type of inheritance
- multilevel
- hierarchical
- Single Inheritance is where a derived class inherits properties and behaviour from a single base class. Example: Class A → Class B.
- Hierarchical Inheritance is where more than one derived class is created from a single base class. Example: Class A → Class B → Class C.
- Multiple Inheritance is for deriving a class from multiple base classes. Here, the child objects programmers create will have combined aspects of characteristics and features from multiple parent classes. These objects do follow their hierarchies of base classes.
- Multilevel Inheritance is where a child class is derived from another derived class. This feature carries combined aspects of multiple classes and follows their hierarchies.
- Hybrid Inheritance is a heterogeneous feature of using multiple inheritances. Here a child class is derived from one or more combinations of single, hierarchical, and multilevel inheritances. This inheritance is adopted for programs to mix different types of inheritance; for example, when mixing a single inheritance with multiple inheritances or maybe a situation when multiple inheritances are mixed within a single program.
A language that does not support polymorphism but supports classes is considered what?
Pytanie 24.- an object-based language
- a class-based language
- a procedure-oriented language
- if classes are supported, polymorphism will be supported
Two classes combine private data members and provide public member functions to access and manipulate those data members. Where is abstraction used?
Pytanie 25.- Abstraction is using a private access specifier for the data members.
- Abstraction is using public member functions to access and manipulate the data members.
- Abstraction is using the class concept with both data members and member functions.
- There is insufficient information to decide where abstraction is being used.
What are the five Creational Design patterns by the Gang of Four ?
Pytanie 26.- Obserwator, Państwo, Strategy, Template Method, and Visitor.
- Złożony, Visitor, Państwo, Prototype, and Singleton.
- Złożony, Builder, Factory Method, Prototype, and Singleton.
- Abstract Factory, Builder, Factory Method, Prototype, and Singleton.
In multilevel inheritance, one class inherits how many classes?
Pytanie 27.- one class only
- two classes
- as many classes as required
- at least two classes
if an object is passed by reference, the changes made in the function are reflected _.
Pytanie 28.- to the main object of the caller function, także
- on the caller function object and also the called function object
- on the copy of the object that is made during the pass
- only in the local scope of the called function
What is a method?
Pytanie 29.- a set of instructions designed to perform a frequently used operation within a program and return no values
- the exact same thing as a function and subroutine
- a set of variables that can change over time
- They are functions attached to specific classes (or instances) in object-oriented programming.
A mobile phone is made up of components such as a motherboard, camera, and sensors. The motherboard represents all the functions of a phone, the display shows the display only, and the phone is represented as a whole. Which of the following has the highest level of abstraction?
Q30.- camera
- display
- motherboard
- Cyfrowa kryminalistyka
Which class has the highest degree of abstraction in a multilevel inheritance relationship of five levels?
Pytanie 31.- the class at the third level
- the class at the first level
- All have the same degree of abstraction.
- the class at the second level
Which is NOT one of the basic types of inheritance?
Pytanie 32.- multilevel inheritance
- double inheritance
- pojedyncze dziedzictwo
- hierarchical inheritance
Why is code duplication so insidious?
Pytanie 33.- The duplication uses unnecessary space.
- One has to maintain all the duplicates.
- Duplication can cause intellectual property concerns.
- Duplication is easy to hide.
When and how often is a static constructor called?
Pytanie 34.- It is called initially when an object is created and called with every new object instance.
- It is called when an object is destroyed and only one time.
- It is called initially when an object is created and only one time.
- It is created at time when the object is discarded.
What does the code shown below demonstrate, i dlaczego?
Pytanie 35. static void Multiply(int num1, int num2) {};
static void Multiply(double num1, double num2, double num3) {};
static void Multiply(float num1, float num2) {};
- polymorphism, because each method can perform different task
- method overriding, because it display the same method name, different or same parameters, and same return type
- method overloading, because it allows the creation of several methods with the same name, wich differ by the type of input via parameter
- method overriding, because it display the same method name, different parameters, and same return type
What is the usage of static constructor?
Pytanie 36.- to initialize all the members with static value
- to delete the static members when not required
- to initialize the static members of class
- to clear all the static members’ initialized values
What are CRC Cards?
Pytanie 37.- Code Responsibility Collection cards are a brainstorming tool used in the design of procedural software
- Class Responsibility collaboration cards are a brainstorming tool used in the design of oop software
- Code Responsibility Correction cards are tools used for debugging
- Code Responsibility Correction cards are tools for modeling
How are contents of a composition different from those of aggregation?
Pytanie 38. 1- if one element of an aggregation is dereferenced, all its elements are eligible for garbage collection
- if a composition dies, the contents die
- the contents of a composition are all siblings
- an aggregation contains only abstract classes
Which statement about compositions and aggregations is true?
Pytanie 39. 2- if one element of an aggregation is dereferenced, all its elements are eligible for garbage collection
- if a composition dies, the contents die
- the contents of a composition are all siblings
- an aggregation contains only abstract classes
What is the result of using more abstraction?
Q40.- it can increase code vulnerability
- it can make code unsafe
- it can limit code readability
- it can be safer for coding
Which is false for a member function of a class?
Pytanie 41.- Member functions can be defined only inside or outside the class body.
- Member functions can be made to be friends of another class.
- Member functions do not need to be declared inside the class definition.
- All member functions need to be defined.
Why is inheritance used when creating a new class?
Pytanie 42.- to protect attributes from unwanted changes
- to delegate coding responsibility more efficiently
- to conserve memory
- to separate class behavior from the more general to more specific
In addition to attributes and behaviours, what quality must a class possess?
Pytanie 43.- a name
- a state
- a color
- obiekt
Which type of function among the following shows polymorphism?
Pytanie 44.- inline function
- undefined function
- virtual function
- class member function
Which words in the following list are candidates for objects: trumpet, Tablica rozdzielcza popularnego kursu firmy Microsoft w jeden dzień, enrage, leaf, drzewo, collapse, aktywny, and lively?
Pytanie 45.- leaf and tree
- Tablica rozdzielcza popularnego kursu firmy Microsoft w jeden dzień, enrage, and collapse
- Tablica rozdzielcza popularnego kursu firmy Microsoft w jeden dzień, aktywny, and lively
- leaf, drzewo, and trumpet
What best describes what object-oriented programming does?
Pytanie 46.- It focuses on objects that interact cleanly with one another.
- It programs exclusively to interfaces.
- It programs exclusively to classes.
- It creates one class for all business logic.
Can abstract classes be used in multilevel inheritance?
Pytanie 47.- Nie, abstract classes can be used only in single-level inheritance since they must be immediately implemented.
- tak, ten kurs da ci narzędzia potrzebne do zdobycia lepszej pozycji w obecnej pracy
- tak, but with only one abstract class
- Nie, abstract classes do not have constructors.
What type of inheritance may lead to the diamond problem?
Pytanie 48.- single level
- multilevel
- hierarchical
- wiele
What is the relationship between abstraction and encapsulation?
Pytanie 49.- Abstraction is about making relevant information visible, while encapsulation enables a programmer to implement the desired level of abstraction.
- Abstraction and encapsulation are essentially the same.
- Abstraction and encapsulation are unrelated.
- Encapsulation is about making relevant information visible, while abstraction enables a programmer to implement the desired level of encapsulation.
Which of these keywords are access specifiers?
Q50.- abstract and public
- public and private
- this and final
- final and abstract
What is a reference to an object?
Pytanie51.- It is the address of variable only — not the method of an object.
- It is a shallow pointer that contains address of an object.
- It is the physical address of an object.
- It is the address where the variables and methods of an object are stored.
Why is unit testing harder in OOP than functional programming?
Pytanie52.- Objects may maintain internal state, which is not easily accessible by the tests.
- The quality of unit testing frameworks for functional languages is better.
- OOP promotes code reuse, which means that your tests have to consider more use cases.
- Object-oriented languages tend to rely on frameworks such as Spring or Hibernate, which make them difficult to test.
What is the function of a user diagram?
Pytanie53.- It connects actors to use cases.
- It links actors to roles played in all use cases.
- It lists all actors for each use case.
- It minimizes the number of actors required.
How do object behaviors and attributes differ?
Pytanie54.- Behavior describe dynamic properties; attributes are static.
- Attributes describe a state; behaviors describe a change.
- Attributes apply only to a specified object; behavior apply to other linked objects.
- Behaviors are vector quantities; attributes are scalars.
The open/closed principle states that classes should be open for _ but closed for _.
Pytanie55.- refactoring; duplication
- modyfikacja; duplication
- extension; modyfikacja
- reuse; encapsulation
Why would you override a method of a base class?
Pytanie56.- to define a method that must be implemented in a derived class
- to define a custom implementation of an inherited member
- to define a method that must be implemented in a superclass only
- to define a class that can be inherited from
What is a copy constructor?
Pytanie57.- It is a unique constructor for creating a new object as a copy of an object that already exists. There will always be only one copy constructor that can be either defined by the user or the system.
- It is a constructor that duplicates itself when requested on demand.
- It is a common constructor for preventing the creation of a new object as a copy of an object that already exists. There will always be multiple standard constructors that can be either defined by the user or the system.
- It is a constructor that duplicates itself on its own, based on memory available.
What defines the catch block most accurately?
Pytanie58.- The catch block that will be executed is the one that best matches the type of exception thrown.
- Multiple catch blocks can never be associated with a single try block.
- Multiple catch blocks are mandatory for each try block.
- Multiple catch blocks will all be executed in the case of an exception.
There are five classes. Class E is derived from class D, D from C, C from B, and B from A. Which class constructor(s) will be called first if the object of E or D is created?
Pytanie59.- A
- b
- C
- C and B
You have modules that are dependent on each other. If you change one module, you have to make changes in the dependent modules. What term is used to describe this problem, and what is a potential solution?
Q60.- Cohesion. A solution is to show that each module has certain responsibilities and to use an anticohesive design pattern.
- Kapsułkowanie. A solution is to implement one of the SOLID principles to ensure the modules do not encapsulate with each other.
- Coupling. A solution is to refactor the code to be loosely coupled by using inversion of control and dependency injection.
- Dependency. A solution is to implement polymorphism and abstraction to change and extract dependent elements of a module so that it functions on its own.
describes an aggregation
Q61. _- A class of resources
- A group of methods
- A collection of objects
- A list of children
Which type of function can be used for polymorphism?
Q62.- virtual function
- inline function
- undefined function
- private function
Which choice is a benefit of using dependency injection?
Q63.- loose coupling
- code reusability
- lazy initialization
- data abstraction
Are you required to return an object if it was passed by reference to a function, and why or why not?
Q64.- tak, the caller function needs to reflect the changes.
- Nie, you should use a global variable instead.
- Nie, changes will be automatically reflected in the calling function.
- tak, the object must be the same in the caller function.
Why is inheritance?
Q65.- …
What is the best example of a superclass and subclass relationship?
Q66.- samochód:Toyoty
- ducks:pond
- Częste objawy chorób układu oddechowego:stopy
- rock:kamień
Which statements best describe the Gang of Four design patterns called Memento and Observer?
Q67.- Memento notifies multiple classes of changes. Observer captures and restores an object’s internal state.
- Memento defers the exact steps of an algorithm to a subclass. Observer defines a new operation to a class without change.
- Memento alters an object’s behavior when its state changes. Observer encapsulates an algorithm inside a class.
- Memento captures and restores an object’s internal state. Observer notifies multiple classes of changes.
What does the value (0.5,0.5,0.5) indicate in the class diagram specification position: Coordinate = (0.5,0.5,0.5)?
Q68.- a default value of the Coordinate attribute
- the size of the position array
- an increment of the position attribute value
- a default value of the position attribute
What is the most accurate example of the Liskov substitution principle?
Q69.- A
public class Car{
}
public class FlyingCars extends Car{
public void fly(){}
}
public class Tesla FlyingCar{}
public class Honda Car{}
- b
public class Car{
public void fly(){}
}
public class Tesla extends Car{}
public class Honda extends Car{}
- C
public class Car{
public void fly(){}
}
public class Tesla Car{}
public class Honda Car{}
- D
public class Car{
}
public class FlyingCars extends Car{
public void fly(){}
}
public class Tesla extends FlyingCar{}
public class Honda extends Car{}
What is the difference between a parameter and an argument?
Q70.- An argument can have many values while a parameter can have only one value.
- An argument is the variable used for input values in a method. A parameter is the specific input value passed to the method.
- A parameter is a variable in the declaration of a function. An argument is the value of this variable that gets passed to the function.
- Parameters and arguments are the same
What is the scope of a class nested inside another class?
Q71.- Protected scope
- Private scope
- Global scope
- Depends on access specifier and inheritance used
Wyjaśnienie: It depends on the access specifier and the type of inheritance used with the class, because if the class is inherited then the nested class can be used by subclass too, provided it’s not of private type.
Methods and attributes that define an object are a kind of blueprint called what?
Q72.- kolekcja
- zmienna
- a class
- a procedure
Assume single inheritance is used with classes A and B while A is the base class. Then assume classes C, D, and E, where C is a base class and D is derived from C, then E is derived from D. Class C is made to inherit from class B. Which type of inheritance is reflected?
Q73.- Multilevel
- Hybrydowy
- Single level
- Multiple
What is the main idea behind separation of concerns?
Q74.- Wszystkie te odpowiedzi
- Applications are decomposed into parts
- Parts are defined with minimal overlap
- Each part is responsible for a separate concern
What is the purpose of the finally block?
Q75.- To always run the finally block of code when the try block exits
- To run code when an exception has not occurred
- To run the block if an exception occurred
- To run code whenever garbage collection requires it
Which choice is not an OOP language?
Q76.- PHP ma do czynienia z trudną konkurencją ze strony Pythona
- Jawa
- C
- Pyton
What is the function of a finalizer or destructor?
Q77.- To relinquish resources that are no longer needed
- To delete a variable name
- To reset an attribute value
- To hold space, even after an object is no longer being used
An instance of which type of class cannot be created?
Q78.- Protected class
- Base class
- Anonymous class
- Abstract class
In the context of OOP, what is composition?
Q79.- Composition is the act of one object passing to another object an operation to be performed on behalf of the initial object.
- Composition is a part/whole relationship where an object is composed of one or more other objects, each of which is considered a part of the whole.
- Composition is a binding where the class/name association is not made until the object designated by the name is created at execution time
- Composition is a process of collecting classes that provide a set of services for a particular domain
Static polymorphism uses method _ ?
Q80.- overloading
- dziedzictwo
- abstrakcja
- overriding
What does a concrete class not have?
Q81.- rodzice
- pure virtual functions
- attributes
- purposes
How does dynamic typing complicate troubleshooting?
Q82.- It can be difficult to identify variables that are incorrectly typed
- The dynamic variables can assume only limited values
- Storage is fixed for dynamic variables
- Static variables are more flexible than dynamic variables
What is the difference between early binding and late binding?
P83.- Early binding is when a variable is assigned a value when a scope is created. Late binding is when a variable is assigned a value after a scope is exited
- Early binding is when a variable is assigned a value when the program starts. Late binding is when a variable is assigned after the program is running
- There is no difference. W obu przypadkach, variables are assigned values when a program has completed startup and is running
- Early binding is when a variable is assigned its value at compile time. Late binding is when a variable is assigned a value at run time
What is the difference between an interface and an abstract class?
Q84.- Interfaces can contain code or data. Abstract classes do not contain code or data. A class can inherit from more than one abstract class but can implement only one interface.
- Interfaces can contain code or data. Abstract classes do not contain code or data. A class can inherit from only one abstract class but can implement an unlimited number of interfaces.
- Abstract classes can contain code or data. Interfaces do not contain code or data. A class can inherit from only one abstract class but can implement an unlimited number of interfaces.
- Abstract classes can contain code or data. Interfaces do not contain code or data. A class can inherit from more than one abstract class but can implement only one interface.
What parameters are required to be passed to a class constructor?
Q85.Here they haven't mentioned any specific language so let's consider all languages.
- reference to subclass // References to subclass are never required as you can simply Initialize subclass & use their object.
- reference to base class // References to the base class are not required in Java, JavaScript & Pyton
- reference to this pointer // While Python & Javascript may require passing this or self in the constructor, It is not passed in Java constructor.
- Żaden // Above 3 are incorrect so “Żaden” is the answer
What are the four principles of object-oriented programming?
Q86.- manipulacja, encapsulation, dziedzictwo, and dependency inversion
- dependency inversion, open/closed principle, encapsulation, and inheritance
- interface segregation, abstrakcja, dependency inversion, and inheritance
- abstrakcja, encapsulation, dziedzictwo, and polymorphism
From the SOLID principles of object-oriented programming, which statement best describes the Liskov substitution principle?
P87.- A class should have only a single responsibility—that is, only changes to one part of the software’s specification should be able to affect the specification of the class.
- Software entities should be open for extension, but closed for modification.
- Many client-specific interfaces are better than one general-purpose interface.
- objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.
In addition to responsibilities, what should be listed on Class-responsability-collaboration (CRC) karty?
P88.- which programming language will be used.
- the programmer responsible for implementation.
- interacting classes.
- attributes.
What is the best name for the function that corrects this assessment?
P89.- makeResult()
- questionScore()
- calculateScore()
- getAnswers()
Which relationship best illustrates an abstract-concrete class relationship?
Q90.- kot : kitten
- kolor : czerwony
- planeta : księżyc
- truck : okno
What cannot be used for polymorphism?
Q91.- overloading constructors
- overloading member functions
- static member functions
- overloading predefined operator
How many levels does multilevel inheritance allow in a program?
Q92.- tylko 10 levels of inheritance
- as many levels of inheritance as required within 10 minuty
- as many levels of inheritance as required
- only the amount of levels memory permits, divided by processor speed
What is a virtual Method?
Q93.- a method that you expect may be redefined in derived classes
- a method that you do not expect to be redefined in derived classes
- a private method that you do not expect to be redefined in derived public classes
- a method that exists temporarily – once used, it ceases to be used by any caller
Which of these is not a basic principle of Object Oriented Programming?
Q94.- Kapsułkowanie
- Compilation
- Dziedzictwo
- Wielopostaciowość
How do object behaviours and attributes differ?
Q95.- Behaviour describe dynamic properties; attributes are static.
- Attributes describe a state; behaviours describe a change.
- Attributes apply only to a specified object; behaviour apply to other linked objects.
- Behaviours are vector quantities; attributes are scalars.
How coupled should your classes be and why?
Q96.- You should increase coupling to improve dependencies between classes.
- You should limit coupling to reduce dependencies between classes.
- You should increase coupling so that class members relate to the class purpose.
- You should limit coupling so that class members relate to the class objective.
Which statement best describes a friend class?
Q97.- Friend classes support base class when necessary.
- A friend class can access the private and protected members of the class in which it is declared as a friend.
- Friend classes do not have any implementation.
- A friend class can access only protected members of the class of which it is a friend.
Which code sample demonstrates multiple inheritance?
Q98.-
class employee{ }; class stream{ }; class topper{ };
-
class employee{int rating;}; class stream:public employee{ };
-
class employee{int rating;}; class stream{int total;}; class topper: employee, stream{ };
-
class employeef{int rating};}: class stream{ }: class topper: public employee{ }:
What is multilevel inheritance?
Q99.- a class that does not have more than one parent.
- a class not derived from another derived obiect.
- not doubling single-level inheritance.
- classes derived from other derived classes.
Can you have two classes with the same name in the same project?
Q100.- Nie, you cannot.
- tak, as long as their constructors are different.
- tak, as long as their methods are different.
- tak, as long as they are in different namespaces.
Objects are passed by _
Q101.- value or reference, depending on the programming language used
- wartość
- value or reference, depending on program
- odniesienie
If a language just implements pass-by-value parameters to functions, can the objects passed as parameters be set to new instances inside the function and their new value will return to the caller?
Q102.- tak, but only if it is a reference and not a primitive class.
- tak, since the value is a reference even though it is passed by value, it can be done.
- Nie, you will get a compilation error.
- Nie, a local copy will be initialized and will be lost as soon as it is out of scope.
What is encapsulation?
Pytanie 103.- defining classes by focusing on what is important for a purpose
- defining data and relevant methods together in the same class
- making all methods private
- using words to define classes
What is a method?
Pytanie 104.- a function associated with data and behavior
- the exact same thing as a function and subroutine
- a set of variables that can change over time
- a set of instructions designed to perform a frequently used operation within a program and return no values
Q105.What is the most accurate example of the Liskov substitution principle?
-
A public class Car{ } public class FlyingCars extends Car{ public void fly(){} } public class Tesla FlyingCar{} public class Honda Car{}
-
B public class Car{ public void fly(){} } public class Tesla extends Car{} public class Honda extends Car{}
-
C public class Car{ public void fly(){} } public class Tesla Car{} public class Honda Car{}
-
D public class Car{ } public class FlyingCars extends Car{ public void fly(){} } public class Tesla extends FlyingCar{} public class Honda extends Car{} reference link
Q106 what describes an agrregation
- A class of resources
- A group of methods
- A collection of objects
- A list of children
Which choice is a benefit of using dependency injection?
107.- loose coupling
- code reusability
- lazy initialization
- data abstraction
What cannot be used for polymorphism?
Pytanie 108.- overloading constructors
- overloading member functions
- static member functions
- overloading predefined operator
An instance of which type of class cannot be created?
Q109.- Protected class
- Base class
- Anonymous class
- Abstract class
From the SOLID principles of object-oriented programming, which statement best describes the Liskov substitution principle?
Q110.- A class should have only a single responsibility—that is, only changes to one part of the software’s specification should be able to affect the specification of the class.
- Software entities should be open for extension, but closed for modification.
- Many client-specific interfaces are better than one general-purpose interface.
- objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.
What are the five Creational Design patterns by the Gang of Four ?
Q111.- Obserwator, Państwo, Strategy, Template Method, and Visitor.
- Złożony, Visitor, Państwo, Prototype, and Singleton.
- Złożony, Builder, Factory Method, Prototype, and Singleton.
- Abstract Factory, Builder, Factory Method, Prototype, and Singleton.
What is the difference between an interface and an abstract class?
Pytanie 112.- Interfaces can contain code or data. Abstract classes do not contain code or data. A class can inherit from more than one abstract class but can implement only one interface.
- Interfaces can contain code or data. Abstract classes do not contain code or data. A class can inherit from only one abstract class but can implement an unlimited number of interfaces.
- Abstract classes can contain code or data. Interfaces do not contain code or data. A class can inherit from only one abstract class but can implement an unlimited number of interfaces.
- Abstract classes can contain code or data. Interfaces do not contain code or data. A class can inherit from more than one abstract class but can implement only one interface.
Which relationship best illustrates an abstract-concrete class relationship?
Pytanie 113.- kot : kitten
- kolor : czerwony
- planeta : księżyc
- truck : okno
Which choice is a benefit of using dependency injection?
Pytanie 114.- loose coupling
- code reusability
- lazy initialization
- data abstraction
describes an aggregation
Pytanie 115. _- A class of resources
- A group of methods
- A collection of objects
- A list of children
Which type of function can be used for polymorphism?
Pytanie 116.- virtual function
- inline function
- undefined function
- private function
Which choice is a benefit of using dependency injection?
Pytanie 117.- loose coupling
- code reusability
- lazy initialization
- data abstraction
Are you required to return an object if it was passed by reference to a function, and why or why not?
Pytanie 118.- tak, the caller function needs to reflect the changes.
- Nie, you should use a global variable instead.
- Nie, changes will be automatically reflected in the calling function.
- tak, the object must be the same in the caller function.
From the SOLID principles of object-oriented programming, which statement best describes the Liskov substitution principle?
Pytanie 119.- A class should have only a single responsibility—that is, only changes to one part of the software’s specification should be able to affect the specification of the class.
- Software entities should be open for extension, but closed for modification.
- Many client-specific interfaces are better than one general-purpose interface.
- objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.
In addition to responsibilities, what should be listed on Class-responsability-collaboration (CRC) karty?
Q120.- which programming language will be used.
- the programmer responsible for implementation.
- interacting classes.
- attributes.
What is the best name for the function that corrects this assessment?
Q121.- makeResult()
- questionScore()
- calculateScore()
- getAnswers()
Who invented OOP?
Q122.- Andrea Ferro
- Adele Goldberg
- Alan Kay
- Dennis Ritchie
Zostaw odpowiedź
Musisz Zaloguj sie lub Zarejestruj się dodać nowy komentarz .