logo

Crowdly

Browser

Add to Chrome

Course 58

Looking for Course 58 test answers and solutions? Browse our comprehensive collection of verified answers for Course 58 at courses.apriorit.com.

Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!

 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%
View this question

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

View this question

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].

View this question

#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%
View this question

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

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

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

View this question

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

100%
0%
0%
0%
View this question

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

0%
100%
0%
0%
View this question

#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%
View this question

#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%
View this question

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

0%
100%
0%
0%
View this question

Want instant access to all verified answers on courses.apriorit.com?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome