Quizzes
Site Language: English
Українська
English
Русский
Programming Tests
Login
Sign Up
Programming Tests
Theory
Snippets
Papers
Landing
Android
Prices
FAQ
Cosmo Story
Terms and Conditions
Privacy Policy
Cookies Policy
Send Feedback
static
:
Content language: Русский
English
В каких строках код содержит ошибки инициализации: float f(int); class Obj { public: static const int temp1 = 7; // 1 static int temp2 = 11; // 2 const int temp3 = 13; // 3 static const int temp4 = f(17); // 4 static const float temp5 = 7.0 // 5 };
static
Для даных вложеных класов, каков будет результат выполнения программы? #include <iostream> using namespace std; class A { public: int a; int getB() { return B::b; } class B { public: B() { b = 1; } int b; }; }; int main() { A a; cout << a.getB(); return 0; }
static
Что выведет на экран следующая программа? #include <iostream> using namespace std; struct A { void foo() { cout << "A::foo()\n"; } }; struct B : virtual A { virtual void foo() { cout << "B::foo()\n"; } }; struct C : B, virtual A { void foo() { cout << "C::foo()\n"; } }; int main (int argc, char *argv[]) { C().foo(); A *a = new C; a->foo(); static_cast<A*>(new C)->foo(); return 0; }
static
Что выведет на экран следующая программа? #include <iostream> static int a = 0; template<typename T> void f(T t) { static int b = ++a; std::cout << a; std::cout << b++; } int main (int argc, char *argv[]) { f(27); f(634); f(.8); return 0; }
static
Укажите строчки, содержащие ошибки: struct A { int a; static int b; mutable int c; int &d; const int e; A() : d(b), e(c) { } }; int A::b; void test(const A *a) { a->a = 1; // 1 a->b = 2; // 2 a->c = 3; // 3 a->d = 4; // 4 a->e = 5; // 5 }
static
укажите строчки, содержащие ошибки: struct A { mutable int a; // 1 const mutable int b; // 2 const int &c; // 3 mutable int &d; // 4 static mutable int e; // 5 A() : c(a), d(a) {} };
static
Дан следующий код: #include "stdio.h" class my_class { private: my_class() { printf("constructor\n"); } ~my_class() { printf("destructor\n"); } public: void hello() { printf("Hello codegalaxy.io!\n"); } static my_class& get_instance() { static my_class instance; return instance; } }; int main( void ) { // 1 return 0; } Какие из следующих фрагментов при вставке в строку // 1 не вызовут ошибку компиляции?
static
Дан такой код: struct A { /*ключевое_слово*/ int field; }; int main() { A a; const A& b = a; b.field = 0; return 0; } Какое модификатор должен стоять на месте /*ключевое_слово*/, чтобы код компилировался и выполнялся успешно?
static
Что будет выведено на экран в результате работы программы? #include <iostream> using namespace std; static int a = 0, b = 3; int change_a() { return ++a; } int change_b(int x) { return b+=x; } void func(int x) { static int aa = change_a(); static int bb = change_b(x); } int main() { func(1); func(3); func(5); func(9); cout << a << " " << b; return 0; }
static
Что будет результатом работы программы? #include <iostream> class Clazz { public: int Anton; int Kris; int Denis; Clazz(int a) : Anton(++a) , Denis(++a) , Kris(++a) { } }; int main(int argc, char *argv[]) { static int a; Clazz x(a); std::cout << x.Anton << x.Denis << x.Kris; }
static
← Prev
1
2
3
Next →
Sign Up Now
or
Subscribe for future quizzes