logo

Crowdly

Browser

Додати до Chrome

Course 58

Шукаєте відповіді та рішення тестів для Course 58? Перегляньте нашу велику колекцію перевірених відповідей для Course 58 в courses.apriorit.com.

Отримайте миттєвий доступ до точних відповідей та детальних пояснень для питань вашого курсу. Наша платформа, створена спільнотою, допомагає студентам досягати успіху!

 Is this code safe? Why?

const
 std::string& GetGreeting(){    std::string s = "Hello";    return s;} int main(){    const std::string& ref = GetGreeting();    std::cout << ref;}

100%
0%
0%
0%
Переглянути це питання

Task 1

There are n people entering and exiting a room. For each person i, they enter at time a and exit at time b. Implement a function that finds the maximum number of people present in the room at the same time.

For example, given [(1,5), (2,6), (3,7)]:

  • at time 3–5 all three people are in the room simultaneously

Переглянути це питання

Task 2

Roman numerals are represented by the following symbols:

I1
V5
X10
L50
C100
D500
M1000

Usually a smaller value follows a larger one: VIII = 8XII = 12. However there are 6 cases where a smaller value is placed before a larger one - in that case it is subtracted:

  • IV = 4, IX = 9
  • XL = 40, XC = 90
  • CD = 400, CM = 900

Implement a function that converts a Roman numeral string to a decimal integer.

The input string is guaranteed to be a valid Roman numeral in the range [1, 3999].

Переглянути це питання

#include <iostream> class A{public:    virtual void Foo() { std::cout << "A::Foo"; }    void Bar() { Foo(); }}; class B : public A{public:    void Foo() override { std::cout << "B::Foo"; }}; int main(){    A* obj = new B();    obj->Bar();    delete obj;}

0%
0%
0%
100%
Переглянути це питання

Є n людей, кожна з яких входить у кімнату в момент часу a та виходить у момент часу b. Необхідно написати функцію, яка визначає максимальну кількість людей, що одночасно перебували в кімнаті.

Наприклад, для вхідних даних [(1,5), (2,6), (3,7)]:

  • у момент часу 3–5 всі три людини перебувають у кімнаті одночасно

Переглянути це питання

class MyClass { /* ... */ }; MyClass a;MyClass b = a;  // (1)MyClass c;c = a;          // (2)

100%
0%
0%
0%
Переглянути це питання

class A{public:    A() : m_val(42) {} private:    int m_val = 10;};

0%
100%
0%
0%
Переглянути це питання

#include <iostream> void Foo(int n)  { std::cout << "int "; }void Foo(int* p) { std::cout << "ptr "; } int main(){    Foo(NULL);    // (1)    Foo(nullptr); // (2)}

100%
0%
0%
0%
Переглянути це питання

#include <iostream> class A{public:    virtual void Foo() { std::cout << "A"; }}; class B : public A{public:    void Foo() override { std::cout << "B"; }}; int main(){    B b;    A a = b;  // !    a.Foo();}

0%
100%
0%
0%
Переглянути це питання

#include <iostream> void Counter(){    static int n = 0;    std::cout << ++n << " ";} int main(){    Counter();    Counter();    Counter();}

0%
100%
0%
0%
Переглянути це питання

Хочете миттєвий доступ до всіх перевірених відповідей на courses.apriorit.com?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome