가장 많이 묻는 면접 질문과 답변 & 온라인 테스트
면접 준비, 온라인 테스트, 튜토리얼, 라이브 연습을 위한 학습 플랫폼

집중 학습 경로, 모의고사, 면접 준비 콘텐츠로 실력을 키우세요.

WithoutBook은 주제별 면접 질문, 온라인 연습 테스트, 튜토리얼, 비교 가이드를 하나의 반응형 학습 공간으로 제공합니다.

Prepare Interview

모의 시험

홈페이지로 설정

이 페이지 북마크

이메일 주소 구독

C++ 면접 질문과 답변

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

관련 차이점

C vs C++Java vs C++

Ques 91. What is "mutable"?

Answer1.
"mutable" is a C++ keyword. When we declare const, none of its data members can change. When we want one of its members to change, we declare it as mutable.

Answer2.
A "mutable" keyword is useful when we want to force a "logical const" data member to have its value modified. A logical const can happen when we declare a data member as non-const, but we have a const member function attempting to modify that data member. For example:
class Dummy {
public:
bool isValid() const;
private:
mutable int size_ = 0;
mutable bool validStatus_ = FALSE;
// logical const issue resolved
};

bool Dummy::isValid() const
// data members become bitwise const
{
if (size > 10) {
validStatus_ = TRUE; // fine to assign
size = 0; // fine to assign
}
}


Answer2.
"mutable" keyword in C++ is used to specify that the member may be updated or modified even if it is member of constant object. Example:
class Animal {
private:
string name;
string food;
mutable int age;
public:
void set_age(int a);
};

void main() {
const Animal Tiger(??Fulffy??,'antelope??,1);
Tiger.set_age(2);
// the age can be changed since its mutable
}

도움이 되었나요? Add Comment View Comments
 

Ques 92. Differences of C and C++
Could you write a small program that will compile in C but not in C++ ?


In C, if you can a const variable e.g.
const int i = 2;
you can use this variable in other module as follows
extern const int i;
C compiler will not complain.

But for C++ compiler u must write
extern const int i = 2;
else error would be generated.

도움이 되었나요? Add Comment View Comments
 

Ques 93. Bitwise Operations - Given inputs X, Y, Z and operations | and & (meaning bitwise OR and AND, respectively), what is output equal to in?


output = (X & Y) | (X & Z) | (Y & Z);

도움이 되었나요? Add Comment View Comments
 

Ques 94. What is a modifier?


A modifier, also called a modifying function is a member function that changes the value of  at least one data member. In other words, an operation that modifies the state of an object. Modifiers are also known as ?mutators?. Example: The function mod is a modifier in the following code snippet:

class test
{
int x,y;
public:
test()
{
x=0; y=0;
}
void mod()
{
x=10;
y=15;
}
};

도움이 되었나요? Add Comment View Comments
 

Ques 95. What is an accessor?


An accessor is a class operation that does not modify the state of an object. The accessor functions need to be declared as const operations

도움이 되었나요? Add Comment View Comments
 

2) Differences of C and C++
Could you write a small program that will compile in C but not in C++ ?
3) Bitwise Operations - Given inputs X, Y, Z and operations | and & (meaning bitwise OR and AND, respectively), what is output equal to in? 4) What is a modifier? 5) What is an accessor? " />

Most helpful rated by users:

Copyright © 2026, WithoutBook.