Question from the C++ test

What is the output of the following code? #include <iostream> #include <string> using namespace std; int main() { string s = "Hello World!"; cout << s[10]; return 0; }

Hard

Which of the following statements are true?

  1. A static data member is declared inside the class but its definition always appears outside the class.
  2. If a class has a static data member and two objects are created from this class, then each object would have its own static data member
  3. A user defined object can be declared as static data member of another class.
  4. A static member function can be called using the class name.
Author: Abha AgrawaStatus: PublishedQuestion passed 449 times
Edit
-1
Community Evaluations
developer avatar
Spelling / formatting error
Antoine
31/03/2024
unclear new lines for 3 & 4 answers