(C/C++) Interview in English - Basic concepts.

时间:2022-09-01 18:24:15

 

Question

Key words

Anwser

A

assignment operator

 

 

 

abstract class

 

It is a class that has one or more pure virtual functions.

 

assignment &
initialization

constructed ->
change value
,Same time

Assignment changes
the value of the object that has already been constructed. Initialization
constructs a new object and gives it a value at the same time.

 

array &
linked list

 

An array is a
sequential collection of same kind of data elements.
Linked list is a data structure which store same kind of data elements but
not in continuous memory locations and size is not fixed.
The size of an array is fixed whereas size of linked list is variable.
In array the data elements are stored in continuous memory locations but in
linked list it is non continuous memory locations.
Addition, removal of data is easy in linked list whereas in arrays it is
complicated.

 

argument passing

call-by-value
call-by-reference

call-by-value. This
method copies the
value of an argument into the formal parameter of the subroutine
Call-by-reference is the second way a subroutine can be passed arguments.
This method
copies the address of an argument (not its value) into the parameter

B

 

 

 

C

constructor

object , initialize

Constructor creates
an object and initializes it. It also creates vtable for virtual functions.
It is different from other methods in a class.

 

copy constructor

initialze by
another object

Constructor which
initializes the it's object member variables ( by shallow copying) with
another object of the same class. If you don't implement one in your class
then compiler implements one for you. 
Q20. When are copy constructors called?  
A20. Copy constructors are called in three cases: 
(1) when a function returns an object of that class by value, 
(2) when the object of that class is passed by value as an argument to a
function, and, 
(3) when you construct an object based on another object of the same class
(Circle c1=c2;).

 

conversion constructor

single argument

constructor with a
single argument makes that constructor as conversion ctor and it can be used
for type conversion.
for example:
class Boo
{
  public:
    Boo( int i );
};
Boo BooObject = 10 ; // assigning int 10 Boo object

 

const reference
arguments

 

a) Using const
protects you against programming errors that inadvertently alter data.
b) Using const allows function to process both const and non-const actual
arguments, while a function without const in the prototype can only accept
non constant arguments.
c) Using a const reference allows the function to generate and use a
temporary variable appropriately.

 

container class

 

A container class
is a class that is used to hold objects in memory or external storage. A
container class acts as a generic holder. A container class has a predefined
behavior and a well-known interface. A container class is a supporting class
whose purpose is to hide the topology used for maintaining the list of
objects in memory. When a container class contains a group of mixed objects,
the container is called a heterogeneous container; when the container is
holding a group of objects that are all the same, the container is called a
homogeneous container. 
example:  vector , list , map .

 

const

 

表示常量不可以修改

 

 

 

 

D

destructor

delete

Destructor usually
deletes any extra resources allocated by the object.

 

data structure

 

A data structure is
a way of organizing data that considers not only the items stored, but also
their relationship to each other. Advance knowledge about the relationship
between data items allows designing of efficient algorithms for the
manipulation of data.

 

 

 

 

E

encapsulation

code and data

Encapsulation is
welding of code and data together into objects.

F

 

 

 

G

globle variable
&
local variable

 

In memory storage
Globle variable : staic  local : stack 
全局变量储存在静态数据库,局部变量在堆栈。

H

Heap &
Stack

 

Heap是堆,空间是由手动操作分配和释放的,它的存储区很大的*存储区。
Stack是栈,是由是操作系统自动分配和释放的,栈上的空间是有限的。程序在编译期间变量和函数分配内存都是在栈上进行的,且在运行时函数调用时的参数的传递也是在栈上进行的。

I

inheritance

derived
properties/behavior

Inheritance is a
mechanism through which a derived class inherits the properties and behavior
of its base class

 

Iterator class

traverse
container class

A class that is
used to traverse through the objects maintained by a container class. There
are five categories of iterators: 
input iterators, output iterators, forward iterators, bidirectional
iterators, random access.

 

inline function

expanded

An inline function
is a function whose code is expanded in line at the point at which
it is invoked, rather than being called.
编译器并不是直接调用函数而是展开内联函数的代码并将其插入到程序代码中
There are two ways to create an inline function.
1)The first is to use the inline modifier.  使用 inline 修饰符
2) defining the code to a member function inside a class declaration. 类中创建内联函数。
Any function that is defined inside a class declaration is automatically made
into an inline function. It is not necessary to precede its declaration with
the keyword inline.

J

 

 

 

K

 

 

 

L

 

 

 

M

malloc()/free(),
new/delete

memory ,
constructor/object

1)malloc()/free()
is function using c/c++, new/delete is operator , using in C++
2)malloc()/free() is for dynamic memory using/release , new/delete is object
construtor/destuctor

 

memory allocation

 

1)static 内存在程序编译的时候就已经分配好,这块内存在程序的整个运行期间都存在。例如全局变
2)stack 执行函数时,函数内局部变量的存储单元都可以在栈上创建,
3)heap(dynamic ) , malloc()/free(),  new/delete

N

 

 

 

O

Overloading (重载) &
 Overriding (重写/覆盖)

Same function name
, diff augs
Same fun/augs, dif method

Overloading is a
method that allows defining multiple member functions with the same name but
different signatures. 
Overriding is a method that allows the derived class to redefine the behavior
of member functions which the derived class inherits from a base class.

P

polymorphism

virual funcition ,
inheritance

one interface,
mutipul methods
virual function and inheritance make C++ to support polymorphism

 

private,protected,public

members and friend
class
+derived member and friend
+everyone

Private members are
accessible only by members and friends of the class. Protected members are
accessible by members and friends of the class and by members and friends of
derived classes. Public members are accessible by everyone.

 

pure virtual
function

virtual void
show_area()=0;

A pure virtual
function is a function declared in a base class that has no definition
relative to the base."

 

potinter &
reference

initialization/change/void

1) Reference must
be initialized , while pointer no need.
2) After reference is initialized , the value can not be changed, but pointer
object maybe
3) Can't use reference for a void , but can use pointer to a void value

Q

 

 

 

R

reference

&

C++’s default
parameter-passing convention is call-by-value,manually create a
call-by-reference by passing the address of an argument (i.e., apointer to
the argument) to a function.

S

struct & class

default access
level

The default access
level assigned to members of struct is public while the default access level
assigned to a class is private. 
c和c++中struct的主要区别是c中的struct不可以含有成员函数,而c++中的struct可以。
c++中struct和class的主要区别在于默认的存取权限不同,struct默认为public,而class默认为private

 

static member of a
class

exist once

Static data members
exist once for the entire class, as opposed to non-static data members, which
exist individually in each instance of a class.

 

static

 

1) static Local
Variables
a static variable to maintain its value between function calls.
2) static Global Variables

 

signature

 

Function's
signature is its name plus the number and types of the parameters it accepts.

 

Silently write and
call

 

Constructors,
destructors, copy constructors,
assignment operators, and address-of operators.

 

storage classes

auto/register/static/extern

auto: the default. Variables are automatically created and
initialized when they are defined and are destroyed at the end of the block
containing their definition. They are not visible outside that block
register: a type of
auto variable. a suggestion to the compiler to use a CPU register for
performance
static: a variable that is known only in the function that
contains its definition but is never destroyed and retains its value between
calls to that function. It exists from the time the program begins execution
extern: a static variable whose definition and placement is
determined when all object and library modules are combined (linked) to form
the executable code file. It can be visible outside the file where it is
defined.

T

template &
macro

 

Using
template  to create generic(template) functions and classes. In a
template function or class, the type of data upon which the function or class
operates is specified as a parameter. Thus, you can use one function or class
with several different types of data,without having to explicitly recode
specific versions for each data type.

 

this pointer

object's function
call

The this pointer is
a pointer accessible only within the member functions of a class, struct, or union
type. It points to the object for which the  member function is
called. Static member functions do not have a this pointer.

U

using' declaration?

 

A using declaration
makes it possible to use a name from a namespace without the scope
operator.

V

virtual & 
non-virtual function

run-time
compile time

The behavior of a
non-virtual function is known at compile time while the behavior of a virtual
function is not known until the run time.

 

virtual function

derived class
redefined

虚函数是指在基类中使用了vitual申明,并且在一个或多个派生类中被重新定义的函数
A virtual function is a function that is declared as
virtual in a base class and redefined
in one or more derived classes

 

Virtual Destructor?

 

sing virtual
destructors, you can destroy objects without knowing their type

 

volatile

 

volatile

确保本条指令不会因编译器的优化而省略,且要求每次直接读值.
简单地说就是防止编译器对代码进行优化.

比如:操作系统、硬件或者其它线程等。遇到这个关键字声明

(C/C++) Interview in English - Basic concepts.的更多相关文章

  1. Basic Concepts of Block Media Recovery

    Basic Concepts of Block Media Recovery Whenever block corruption has been automatically detected, yo ...

  2. (二)Basic Concepts 基本概念

    Basic Concepts There are a few concepts that are core to Elasticsearch. Understanding these concepts ...

  3. CMUSphinx Learn - Basic concepts of speech

    Basic concepts of speech Speech is a complex phenomenon. People rarely understand how is it produced ...

  4. Nginx Tutorial #1: Basic Concepts(转)

    add by zhj: 文章写的很好,适合初学者 原文:https://www.netguru.com/codestories/nginx-tutorial-basics-concepts Intro ...

  5. (C/C++) Interview in English - Threading

    Q. What's the process and threads and what's the difference between them? A.  A process is an execut ...

  6. (C/C++) Interview in English. - Memory Allocation/Deallocation.

    Q: What is the difference between new/delete and malloc/free? A: Malloc/free do not know about const ...

  7. (C++) Interview in English. - Constructors/Destructors

    Constructors/Destructors. 我们都知道,在C++中建立一个类,这个类中肯定会包括构造函数.析构函数.复制构造函数和重载赋值操作:即使在你没有明确定义的情况下,编译器也会给你生成 ...

  8. [Network]Introduction and Basic concepts

    [该系列是检讨计算机网络知识.因为现在你想申请出国.因此,在写这篇博客系列的大多数英语.虽然英语,但大多数就是我自己的感受和理解,供大家学习和讨论起来] 1 Network Edge The devi ...

  9. Lesson 1 Basic Concepts: Part 1

    www.how-to-build-websites.com/basic-concepts/part1.php An introduction to domain names, web servers, ...

随机推荐

  1. FineUI(专业版)v1.2.0 和 FineUI(开源版)v4.1.1 同时发布!

    FineUI(开源版)v4.1.1 (建议所有 v4.x 升级到此版本):http://fineui.com/demo/ +2014-08-15 v4.1.1        -修正Form中表单字段设 ...

  2. linuxmint 17没有vim

    首先上软件管理器中安装vim,之后配置.vimrc文件 下面是从网上摘抄的配置文件: """""""""&qu ...

  3. Java 类型转换以及Object转成其他类型

    Object转int int count=(int)map.get("count") int count=Integer.parseInt((String)map.get(&quo ...

  4. WS之cxf简单实现

    1.服务端实现: 1.1 定义接口,用@WebService修饰: /** @WebService 所修饰的接口,那么接口里面的方法全部都属于web的服务  */ @WebService public ...

  5. SMB/CIFS协议解析一概述

    一.SMB/CIFS协议的区别 在NetBIOS出现之后,Microsoft就使用NetBIOS实现了一个网络文件/打印服务系统,这个系统基于NetBIOS设定了一套文件共享协 议,Microsoft ...

  6. wer

    概述 快速入门流程: 使用叮当扫码产品请遵循以下操作步骤: 1. 新建项目信息 2. 新建产品信息 3. 添加发货产品 4. 发货 5. 收货 (具体使用操作请查看详细的使用说明) 文档目的: 本文档 ...

  7. 克拉克拉(KilaKila):大规模实时计算平台架构实战

    克拉克拉(KilaKila):大规模实时计算平台架构实战 一.产品背景:克拉克拉(KilaKila)是国内专注二次元.主打年轻用户的娱乐互动内容社区软件.KilaKila推出互动语音直播.短视频配音. ...

  8. easy-ui treegrid 实现分页 并且添加自定义checkbox

    首先第一点easy-ui  treegrid 对分页没有好的实现, 因为在分页的过程中是按照 根节点来分页的  后台只能先按照 根节点做分页查询  再将子节点关联进去, 这样才能将treegrid 按 ...

  9. Tinkoff Internship Warmup Round 2018 and Codeforces Round #475 (Div. 1)D. Frequency of String

    题意:有一个串s,n个串模式串t,问s的子串中长度最小的包含t k次的长度是多少 题解:把所有t建ac自动机,把s在ac自动机上匹配.保存每个模式串在s中出现的位置.这里由于t两两不同最多只有xsqr ...

  10. js 立即执行函数

    1.我们首先要搞明白:函数表达式和函数声明的区别. 函数表达式:既可以为匿名函数也可以有函数名,但是调用的时候都是通过函数左边的变量func来调用 var func = function(){ ale ...