Ooad Interview Questions-answers New

  • Uploaded by: Utsav Shah
  • 0
  • 0
  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Ooad Interview Questions-answers New as PDF for free.

More details

  • Words: 1,146
  • Pages: 6
What is polymorphism in Object Oriented Programming (OOPS) Languages? In object-oriented programming, polymorphism is a generic term that means 'many shapes'. (from the Greek meaning "having multiple forms"). Polymorphism is briefly described as "one interface, many implementations." polymorphism is a characteristic of being able to assign a different meaning or usage to something in different contexts - specifically, to allow an entity such as a variable, a function, or an object to have more than one form. •

Compile time poly.



Run time poly.

Function Overloading Polymorphism means that functions assume different forms at different times. In case of compile time it is called function overloading.Two or more functions can have same name but their parameter list should be different either in terms of parameters or their data types. The functions which differ only in their return types cannot be overloaded. The compiler will select the right function depending on the type of parameters passed.

Operator overloading In polymorphism operators can also be overloaded (Compile time polymorphism). Operators can be overloaded in order to perform special functions with respect to the class. With the help of operator overloading standard operations such as + , - , * , etc can be applied on the objects of the class.

What is Encapsulation in Object Oriented Programming (OOPS) Languages? Encapsulation is the procedure of covering up of data and functions into a single unit. Encapsulation (also information hiding) consists of separating the external aspects of an object which are accessible to other objects, from the internal implementation details of the object, which are hidden from other objects. A process, encapsulation means the act of enclosing one or more items within a (physical or logical) container (Class).

Benefits of Encapsulation in oops: Encapsulation makes it possible to separate an objects implementation from its behavior to restrict access to its internal data. This restriction allows certain details of an objects behavior to be hidden. It allows us to create a "black box" and protects an objects internal state from corruption by its clients. It helps in minimizing interdependencies among modules by defining a strict external interface. So encapsulation prevents a program from becoming so interdependent that a small change has massive ripple effects. What is inheritance? Inheritance is the mechanism which allows a class A to inherit properties of a class B. We say "A inherits from B''. Objects of class A thus have access to attributes and methods of class B without the need to redefine them. If class A inherits from class B, then B is called superclass of A. A is called subclass of B. Objects of a subclass can be used where objects of the

corresponding superclass are expected. This is due to the fact that objects of the subclass share the same behavior as objects of the superclass.

What is the difference between abstract class and interface? We use abstract class and interface where two or more entities do same type of work but in different ways. Means the way of functioning is not clear while defining abstract class or interface. When functionality of each task is not clear then we define interface. If functionality of some task is clear to us but there exist some functions whose functionality differs object by object then we declare abstract class. What is a static class? We can declare a static class. We use static class when there is no data or behavior in the class that depends on object identity. A static class can have only static members. We can not create instances of a static class using the new keyword. .NET Framework common language runtime (CLR) loads Static classes automatically when the program or namespace containing the class is loaded. •

Static classes only contain static members.



Static classes cannot be instantiated. They cannot contain Instance Constructors



Static classes are sealed.

What is the difference between value parameter and reference parameter?

A value parameter is used for "in" parameter passing, in which the value of an argument is passed into a method, and modifications of the parameter do not impact the original argument. A value parameter refers to its own variable, one that is distinct from the corresponding argument. This variable is initialized by copying the value of the corresponding argument. A reference parameter is used for "by reference" parameter passing, in which the parameter acts as an alias for a caller-provided argument. A reference parameter does not itself define a variable, but rather refers to the variable of the corresponding argument. Modifications of a reference parameter impact the corresponding argument.

What is the property of class? A property is a member that provides access to an attribute of an object or a class. Examples of properties include the length of a string, the size of a font, the caption of a window, the name of a customer, and so on. Does a class inherit the constructors of its superclass? A class does not inherit constructors from any of its super classes. If a class is declared without any access modifiers, where may the class be accessed? A class that is declared without any access modifiers is said to have package access. This means that the class can only be accessed by other classes and interfaces that are defined within the same package.

What is difference between overloading and overriding? a) In overloading, there is a relationship between methods available in the same class whereas in overriding, there is relationship between a superclass method and subclass method. b) Overloading does not block inheritance from the superclass whereas overriding blocks inheritance from the superclass. c) In overloading, separate methods share the same name whereas in overriding, subclass method replaces the superclass. d) Overloading must have different method signatures whereas overriding must have same signature.

List out some of the object-oriented methodologies. Object Oriented Development (OOD) (Booch 1991,1994). Object Oriented Analysis and Design (OOA/D) (Coad and Yourdon 1991). Object Modeling Techniques (OMT) (Rumbaugh 1991). Object Oriented Software Engineering (Objectory) (Jacobson 1992). Object Oriented Analysis (OOA) (Shlaer and Mellor 1992). The Fusion Method (Coleman 1991).

What do u meant by “SBI” of an object? SBI stands for State, Behavior and Identity. Since every object has the above three. State: It is just a value to the attribute of an object at a particular time. Behaviour:It describes the actions and their reactions of that object.Identity: An object has an identity that characterizes its own existence. The identity

makes it possible to distinguish any object in an unambiguous way, and independently from its state.

What do you meant by static and dynamic modeling? Static modeling is used to specify structure of the objects that exist in the problem domain. These are expressed using class, object and USECASE diagrams. But Dynamic modeling refers representing the object interactions during runtime. It is represented by sequence, activity, collaboration and statechart diagrams

Related Documents

Ooad
November 2019 23
Ooad
April 2020 15
Ooad
May 2020 10
Ooad
June 2020 9
Ooad
November 2019 26

More Documents from "Robin"