oops 内核重启问题_OOPS面试问答

oops 内核重启问题

Welcome to OOPS interview questions and answers. There are many Object Oriented Programming languages such as Java, C++ and Python. Having a clear idea about OOPS concepts is very important if you are going to face any interview on these programming languages. That’s why I thought to share the top OOPS interview questions with you and provide detailed answers for them.

欢迎来到OOPS面试问答。 有许多面向对象的编程语言,例如Java,C ++和Python。 如果您要面对这些编程语言的任何访谈,那么对OOPS概念有一个清晰的了解非常重要。 这就是为什么我想与您分享OOPS面试的主要问题,并为他们提供详细的答案。

OOPS面试问题 (OOPS Interview Questions)

  1. 什么是OOPS? (What is OOPS?)

    Object Oriented Programming System is the programming technique to write programs based on the real world objects. The states and behaviors of an object are represented as the member variables and methods. In OOPS programming programs are organized around objects and data rather than actions and logic.

    面向对象的编程系统是一种基于实际对象编写程序的编程技术。 对象的状态和行为表示为成员变量和方法。 在OOPS中,编程程序围绕对象和数据而不是动作和逻辑进行组织。

  2. OOPS概念的优点是什么? (What are the advantages of OOPS concepts?)

    Major advantages of OOPS programming are;

    1. Simplicity: OOPS programming objects model real world objects, so the complexity is reduced and the program structure is clear.
    2. Modularity: Each object forms a separate entity whose internal workings are decoupled from other parts of the system.
    3. Modifiability: It is easy to make minor changes in the data representation or the procedures in an OO program. Changes inside a class do not affect any other part of a program, since the only public interface that the external world has to a class is through the use of methods.
    4. Extensibility: Adding new features or responding to changing operating environments can be solved by introducing a few new objects and modifying some existing ones.
    5. Maintainability: Objects can be maintained separately, making locating and fixing problems easier.
    6. Reusability: Objects can be reused in different programs.

    OOPS编程的主要优点是;

    1. 简便性 :OOPS编程对象对真实世界的对象进行建模,因此降低了复杂性,并且程序结构清晰。
    2. 模块化 :每个对象形成一个单独的实体,其内部工作与系统的其他部分分离。
    3. 可修改性 :可以很容易地对数据表示或OO程序中的过程进行小的更改。 类内部的更改不会影响程序的任何其他部分,因为外部世界对类的唯一公共接口是通过使用方法。
    4. 可扩展性 :可以通过引入一些新对象并修改一些现有对象来解决添加新功能或响应不断变化的操作环境的问题。
    5. 可维护性 :对象可以单独维护,从而使查找和修复问题更加容易。
    6. 可重用性 :对象可以在不同的程序中重用。
  3. 过程编程和OOPS有什么区别? (What is the difference between Procedural programming and OOPS?)

    1. Procedural language is based on functions but object oriented language is based on real world objects.
    2. Procedural language gives importance on the sequence of function execution but object oriented language gives importance on states and behaviors of the objects.
    3. Procedural language exposes the data to the entire program but object oriented language encapsulates the data.
    4. Procedural language follows top down programming paradigm but object oriented language follows bottom up programming paradigm.
    5. Procedural language is complex in nature so it is difficult to modify, extend and maintain but object oriented language is less complex in nature so it is easier to modify, extend and maintain.
    6. Procedural language provides less scope of code reuse but object oriented language provides more scope of code reuse.

    1. 程序语言基于功能,而面向对象的语言则基于现实世界的对象。
    2. 程序语言在函数执行的顺序上很重要,而面向对象的语言在对象的状态和行为上很重要。
    3. 程序语言将数据公开给整个程序,但是面向对象的语言将数据封装。
    4. 过程语言遵循自上而下的编程范例,而面向对象的语言遵循自下而上的编程范例。
    5. 程序语言本质上很复杂,因此很难进行修改,扩展和维护,而面向对象的语言本质上则不太复杂,因此更易于修改,扩展和维护。
    6. 程序语言提供较少的代码重用范围,而面向对象的语言提供更多的代码重用范围。
  4. OOPS的核心概念是什么? (What are the core concepts of OOPS?)

    OOPS core concepts are;

    1. Abstraction
    2. Encapsulation
    3. Polymorphism
    4. Inheritance
    5. Composition
    6. Association
    7. Aggregation

    OOPS核心概念是;

    1. 抽象化
    2. 封装形式
    3. 多态性
    4. 遗产
    5. 组成
    6. 协会
    7. 聚合
  5. 什么是抽象? (What is Abstraction?)

    Abstraction is an OOPS concept to construct the structure of the real world objects. During this construction only the general states and behaviors are taken and more specific states and behaviors are left aside for the implementers.

    抽象是一种OOPS概念,用于构建现实世界对象的结构。 在此构造期间,仅采用一般状态和行为,而更具体的状态和行为留给实现者。

  6. 什么是封装? (What is Encapsulation?)

    Encapsulation is an OOPS concept to create and define the permissions and restrictions of an object and its member variables and methods. A very simple example to explain the concept is to make the member variables of a class private and providing public getter and setter methods. Java provides four types of access level modifiers: public, protected, no modifier and private.

    封装是一种OOPS概念,用于创建和定义对象及其成员变量和方法的权限和限制。 解释该概念的一个非常简单的示例是将类的成员变量设为私有,并提供公共的getter和setter方法。 Java提供了四种访问级别修饰符:公共,受保护,无修饰符和私有。

  7. 抽象和封装有什么区别? (What is the difference between Abstraction and Encapsulation?)

    1. “Program to interfaces, not implementations” is the principle for Abstraction and “Encapsulate what varies” is the OO principle for Encapsulation.
    2. Abstraction provides a general structure of a class and leaves the details for the implementers. Encapsulation is to create and define the permissions and restrictions of an object and its member variables and methods.
    3. Abstraction is implemented in Java using interface and abstract class while Encapsulation is implemented using four types of access level modifiers: public, protected, no modifier and private.

    1. “程序到接口而不是实现”是抽象的原理,“封装变化的内容”是OO的封装原理。
    2. 抽象提供了类的一般结构,并为实现者留下了细节。 封装是创建和定义对象及其成员变量和方法的权限和限制。
    3. Java是使用接口和抽象类在Java中实现的,而封装是使用四种访问级别修饰符的类型实现的:公共,受保护,无修饰符和私有。
  8. 什么是多态? (What is Polymorphism?)

    Polymorphism is the occurrence of something in various forms. Java supports various forms of polymorphism like polymorphic reference variables, polymorphic method, polymorphic return types and polymorphic argument types.

    多态是各种形式的事物的发生。 Java支持多种形式的多态,例如多态参考变量,多态方法,多态返回类型和多态参数类型。

  9. 什么是继承? (What is Inheritance?)

    A subclass can inherit the states and behaviors of it’s super class is known as inheritance.

    子类可以继承其超类的状态和行为,称为继承。

  10. 什么是多重继承? (What is multiple inheritance?)

    A child class inheriting states and behaviors from multiple parent classes is known as multiple inheritance.

    从多个父类继承状态和行为的子类称为多重继承。

  11. 继承中的钻石问题是什么? (What is the diamond problem in inheritance?)

    In case of multiple inheritance, suppose class A has two subclasses B and C, and a class D has two super classes B and C.If a method present in A is overridden by both B and C but not by D then from which class D will inherit that method B or C? This problem is known as diamond problem.

    在多重继承的情况下,假设类A有两个子类B和C,而类D有两个超类B和C.如果B和C都覆盖了A中存在的方法,但D却覆盖了D,则从哪个类D覆盖将继承该方法B或C? 这个问题被称为钻石问题。

  12. 为什么Java不支持多重继承? (Why Java does not support multiple inheritance?)

    Java was designed to be a simple language and multiple inheritance introduces complexities like diamond problem. Inheriting states or behaviors from two different type of classes is a case which in reality very rare and it can be achieved easily through an object association.

    Java被设计为一种简单的语言,并且多重继承引入了诸如钻石问题之类的复杂性。 从两种不同类型的类继承状态或行为是一种情况,实际上这种情况很少见,可以通过对象关联轻松实现。

  13. 什么是静态绑定和动态绑定? (What is Static Binding and Dynamic Binding?)

    Static or early binding is resolved at compile time. Method overloading is an example of static binding.

    Dynamic or late or virtual binding is resolved at run time. Method overriding is an example of dynamic binding.

    静态或早期绑定在编译时解决。 方法重载是静态绑定的一个示例。

    动态或后期或虚拟绑定在运行时解决。 方法覆盖是动态绑定的一个示例。

  14. “ IS-A”和“ HAS-A”关系的含义是什么? (What is the meaning of “IS-A” and “HAS-A” relationship?)

    “IS-A” relationship implies inheritance. A sub class object is said to have “IS-A” relationship with the super class or interface. If class A extends B then A “IS-A” B. It is transitive, that is, if class A extends B and class B extends C then A “IS-A” C. The “instanceof” operator in java determines the “IS-A” relationship.

    When a class A has a member reference variable of type B then A “HAS-A” B. It is also known as Aggregation.

    “ IS-A”关系表示继承。 子类对象被称为与超类或接口具有“ IS-A”关系。 如果A类扩展了B,则A为“ IS-A” B。它是可传递的,也就是说,如果A类扩展了B而B类扩展了C,则A为“ IS-A”C。java中的“ instanceof”运算符确定“ IS-A”的关系。

    当类A的成员引用变量的类型为B时,则A为“ HAS-A” B。这也称为聚合。

  15. 什么是协会? (What is Association?)

    Association is a relationship between two objects with multiplicity.

    关联是两个具有多重性的对象之间的关系。

  16. 什么是汇总? (What is Aggregation?)

    Aggregation is also known as “HAS-A” relationship. When class Car has a member reference variable of type Wheel then the relationship between the classes Car and Wheel is known as Aggregation. Aggregation can be understood as “whole to its parts” relationship.

    Car is the whole and Wheel is part. Wheel can exist without the Car. Aggregation is a weak association.

    聚合也称为“ HAS-A”关系。 如果Car类的成员引用变量的类型为Wheel,则Car和Wheel类之间的关系称为“聚合”。 聚集可以理解为“整体”关系。

    汽车是整体,车轮是一部分。 车轮可以不带汽车而存在。 聚集是一个弱关联。

  17. 什么是成分? (What is Composition?)

    Composition is a special form of Aggregation where the part cannot exist without the whole. Composition is a strong Association. Composition relationship is represented like aggregation with one difference that the diamond shape is filled.

    组合是聚集的一种特殊形式,其中一部分不能没有整体而存在。 作文是一个强大的协会。 组成关系像聚合一样表示,菱形填充的一个区别是。

  18. 什么是依赖性? (What is Dependency?)

    When one class depends on another because it uses that at some point in time then this relationship is known as Dependency. One class depends on another if the independent class is a parameter variable or local variable of a method of the dependent class. A Dependency is drawn as a dotted line from the dependent class to the independent class with an open arrowhead pointing to the independent class.

    当一个类由于在某个时间点使用另一个而依赖另一个类时,这种关系称为依赖关系。 如果独立类是依赖类的方法的参数变量或局部变量,则一个类依赖于另一类。 从相关类到独立类的虚线绘制为一个相关性,并带有指向独立类的空心箭头。

  19. 关联和依赖之间有什么区别? (What is the difference between Association and Dependency?)

    The main difference between Association and Dependency is in case of Association one class has an attribute or member variable of the other class type but in case of Dependency a method takes an argument of the other class type or a method has a local variable of the other class type.

    关联和依赖关系之间的主要区别是,在关联的情况下,一个类具有另一类类型的属性或成员变量,但是在依赖关系的情况下,方法采用另一类类型的参数,或者方法具有另一类的局部变量类类型。

  20. 什么是课程? (What is a Class?)

    A class is the specification or template of an object.

    类是对象的规范或模板。

  21. 什么是对象? (What is an Object?)

    Object is instance of class.

    对象是类的实例。

翻译自: https://www.journaldev.com/12492/oops-interview-questions-answers

oops 内核重启问题

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值