人気の面接質問と回答・オンラインテスト
面接対策、オンラインテスト、チュートリアル、ライブ練習のための学習プラットフォーム

集中型学習パス、模擬テスト、面接向けコンテンツでスキルを伸ばしましょう。

WithoutBook は、分野別の面接質問、オンライン練習テスト、チュートリアル、比較ガイドをひとつのレスポンシブな学習空間にまとめています。

面接準備

模擬試験

ホームページに設定

このページをブックマーク

メールアドレスを登録

C++ 面接の質問と回答

Test your skills through the online practice test: C++ Quiz Online Practice Test

関連する比較

C vs C++Java vs C++

質問 86. Write a program that ask for user input from 5 to 9 then calculate the average


int main()
{
int MAX=4;
int total =0;
int average=0;
int numb;
cout<<"Please enter your input from 5 to 9";
cin>>numb;
if((numb <5)&&(numb>9))
cout<<"please re type your input";
else
for(i=0;i<=MAX; i++)
{
total = total + numb;
average= total /MAX;
}
cout<<"The average number is"<<average<<endl;

return 0;
}

役に立ちましたか? コメントを追加 コメントを見る
 

質問 87. Assignment Operator - What is the diffrence between a "assignment operator" and a "copy constructor"?


Answer1.
In assignment operator, you are assigning a value to an existing object. But in copy constructor, you are creating a new object and then assigning a value to that object. For example:
complex c1,c2;
c1=c2; //this is assignment
complex c3=c2; //copy constructor

Answer2.
A copy constructor is used to initialize a newly declared variable from an existing variable. This makes a deep copy like assignment, but it is somewhat simpler:

There is no need to test to see if it is being initialized from itself.
There is no need to clean up (eg, delete) an existing value (there is none).
A reference to itself is not returned.

役に立ちましたか? コメントを追加 コメントを見る
 

質問 88. RTTI - What is RTTI?


Answer1.
RTTI stands for "Run Time Type Identification". In an inheritance hierarchy, we can find out the exact type of the objet of which it is member. It can be done by using:

1) dynamic id operator
2) typecast operator

Answer2.
RTTI is defined as follows: Run Time Type Information, a facility that allows an object to be queried at runtime to determine its type. One of the fundamental principles of object technology is polymorphism, which is the ability of an object to dynamically change at runtime.

役に立ちましたか? コメントを追加 コメントを見る
 

質問 89. STL Containers - What are the types of STL containers?


There are 3 types of STL containers:

1. Adaptive containers like queue, stack
2. Associative containers like set, map
3. Sequence containers like vector, deque

役に立ちましたか? コメントを追加 コメントを見る
 

質問 90. What is the need for a Virtual Destructor ?


Destructors are declared as virtual because if do not declare it as virtual the base class destructor will be called before the derived class destructor and that will lead to memory leak because derived class??s objects will not get freed.Destructors are declared virtual so as to bind objects to the methods at runtime so that appropriate destructor is called.

役に立ちましたか? コメントを追加 コメントを見る
 
RTTI - What is RTTI? 4) STL Containers - What are the types of STL containers? 5) What is the need for a Virtual Destructor ? " />

ユーザー評価で最も役立つ内容:

著作権 © 2026、WithoutBook。