Самые популярные вопросы и ответы для интервью и онлайн-тесты
Образовательная платформа для подготовки к интервью, онлайн-тестов, учебных материалов и живой практики

Развивайте навыки с целевыми маршрутами обучения, пробными тестами и контентом для подготовки к интервью.

WithoutBook объединяет вопросы для интервью по предметам, онлайн-практику, учебные материалы и сравнительные руководства в одном удобном учебном пространстве.

Подготовка к интервью

Пробные экзамены

Сделать домашней страницей

Добавить страницу в закладки

Подписаться по адресу эл. почты

C++ вопросы и ответы для интервью

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

Связанные сравнения

C vs C++Java vs C++

Вопрос 6. What are the advantages of inheritance?


It permits code reusability. Reusability saves time in program development. It encourages the reuse of proven and debugged high-quality software, thus reducing problem after a system becomes functional.

Это полезно? Добавить комментарий Посмотреть комментарии
 

Вопрос 7. How do you write a function that can reverse a linked-list?


void reverselist(void)
{
if(head==0)
return;
if(head->next==0)
return;
if(head->next==tail)
{
head->next = 0;
tail->next = head;
}
else
{
node* pre = head;
node* cur = head->next;
node* curnext = cur->next;
head->next = 0;
cur-> next = head;

for(; curnext!=0; )
{
cur->next = pre;
pre = cur;
cur = curnext;
curnext = curnext->next;
}

curnext->next = cur;
}
}

Это полезно? Добавить комментарий Посмотреть комментарии
 

Вопрос 8. What do you mean by inline function?

The idea behind inline functions is to insert the code of a called function at the point where the function is called. If done carefully, this can improve the application's performance in exchange for increased compile time and possibly (but not always) an increase in the size of the generated binary executables.

Это полезно? Добавить комментарий Посмотреть комментарии
 

Вопрос 9. Write a program that ask for user input from 5 to 9 then calculate the average


#include "iostream.h"
int main() {
int MAX = 4;
int total = 0;
int average;
int numb;
for (int i=0; i<MAX; i++) {
cout << "Please enter your input between 5 and 9: ";
cin >> numb;
while ( numb<5 || numb>9) {
cout << "Invalid input, please re-enter: ";
cin >> numb;
}
total = total + numb;
}
average = total/MAX;
cout << "The average number is: " << average << "n";
return 0;
}

Это полезно? Добавить комментарий Посмотреть комментарии
 

Вопрос 10. Write a short code using C++ to print out all odd number from 1 to 100 using a for loop


for( unsigned int i = 1; i < = 100; i++ )
if( i & 0x00000001 )
cout << i << ",";
 

Это полезно? Добавить комментарий Посмотреть комментарии
 

4) Write a program that ask for user input from 5 to 9 then calculate the average 5) Write a short code using C++ to print out all odd number from 1 to 100 using a for loop " />

Самое полезное по оценкам пользователей:

Авторские права © 2026, WithoutBook.