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!
Why doesn't the catch block receive the exception, and what happens instead?#include <iostream>#include <stdexcept> void Foo() noexcept{ throw std::runtime_error("oops");} int main(){ try { Foo(); } catch (...) { std::cout << "caught"; }}What will the program output and which C++ mechanism causes this result?What will the program output and which C++ mechanism causes this result?#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();}What value will m_val have after constructing an object of type A?class A{public: A() : m_val(42) {} private: int m_val = 10;};What will the program output and which C++ feature determines this result?#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;}Which special function is called in expressions (1) and (2)?class MyClass { /* ... */ }; MyClass a;MyClass b = a; // (1)MyClass c;c = a; // (2)Which overload of Foo is selected for each call and why?#include <iostream> void Foo(int n) { std::cout << "int "; }void Foo(int* p) { std::cout << "ptr "; } int main(){ Foo(NULL); // (1) Foo(nullptr); // (2)}When is variable n initialized and how many times during program execution?#include <iostream> void Counter(){ static int n = 0; std::cout << ++n << " ";} int main(){ Counter(); Counter(); Counter();}Which statement correctly describes the difference between these two declarations?const int* p1; // Aint* const p2; // BWhat will the program output?#include <iostream> int main(){ int x = 2147483647; // INT_MAX std::cout << (x + 1);}