Looking for met2502f25-a.sg test answers and solutions? Browse our comprehensive collection of verified answers for met2502f25-a.sg at distance3.sg.digipen.edu.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
Write if the following code fragment doesn't compile or write if the code compiles but has undefined behavior when executed. Otherwise, write the exact text written to the standard output stream.
int x {10};
int & y {20};
y = 30;
std::cout << x << ',' << y;
Write if the following code fragment doesn't compile or write if the code compiles but has undefined behavior when executed. Otherwise, write the exact text written to the standard output stream.
int x {10};
int & y;
y = 20;
std::cout << x << ',' << y;
Write if the following code fragment doesn't compile or write if the code compiles but has undefined behavior when executed. Otherwise, write the exact text written to the standard output stream.
int x {10};
int & y {x};
y=20;
std::cout << x << ',' << y;
Given these definitions:
int i = 1.01, *pi{&i};which of the following definitions are legal?
Given these definitions:
int i{-1};
int const i2{i};
which of the following definitions are illegal?
Determine the exact text printed to standard output stream by the following code fragment?
namespace A {
char c{'a'};
}
char c{'b'};
int main() {
using namespace A;
std::cout << c;
}
Does the following code fragment compile?
namespace helpers {
int counter {1};
}
namespace helpers {
int strength {2};
}
namespace helpers {
int Div2(int value) { return value/2; }
}
int main() {
std::cout << helpers::counter << "\n";
std::cout << helpers::strength << "\n";
std::cout << helpers::Div2(8) << "\n";
}
Does the following code fragment compile?
namespace helpers {
int counter{1}, strength{2};
}
int Div2(int value) {
return value/2;
}
int main() {
std::cout << helpers::counter << "\n";
std::cout << strength << "\n";
std::cout << Div2(8) << "\n";
}
Write if the following code fragment doesn't compile. Otherwise, write the exact text written to the standard output stream.
namespace {
double my_sqrt(double x) { return std::sqrt(x); }
}
int main() {
std::cout << (std::sqrt(25.0) == my_sqrt(25.0));
}