logo

Crowdly

Browser

Add to Chrome

Програмування (СА)

Looking for Програмування (СА) test answers and solutions? Browse our comprehensive collection of verified answers for Програмування (СА) at e-learning.lnu.edu.ua.

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

Що буде виведено в результаті виконання коду?

Введіть відповідь точно так, як її виведе програма, без додаткових пробілів.

#include <iostream>

#include <vector>

using namespace std;

class Driver{public:string id; Driver(string x):id(x){} }; class Bus{Driver* d; public:Bus(Driver* x):d(x){} void show(){cout<<d->id;} };

int main(){

Driver d("D1"); Bus b(&d); b.show();

return 0;

}

View this question

Що буде виведено в результаті виконання коду?

Введіть відповідь точно так, як її виведе програма, без додаткових пробілів.

#include <iostream>

using namespace std;

class A{public: virtual void f(int){cout<<"A";}}; class B:public A{public:void f(int) override{cout<<"B";}};

int main(){

B b; A* p=&b; p->f(3);

return 0;

}

View this question

Який буде результат спроби скомпілювати цей код?

Введіть відповідь точно так, як зазначено у варіантах екзамену.

#include <iostream>

using namespace std;

class A {

public:

void f(int x) { cout << x; }

};

int main() {

A a;

a.f();

return 0;

}

View this question

Що буде виведено в результаті виконання коду?

Введіть відповідь точно так, як її виведе програма, без додаткових пробілів.

#include <iostream>

#include <stack>

#include <queue>

#include <vector>

#include <functional>

#include <string>

using namespace std;

int main(){

queue<char> q; q.push('A'); q.push('B'); while(!q.empty()){cout<<q.front(); q.pop();}

return 0;

}

View this question

Що буде виведено в результаті виконання коду?

Введіть відповідь точно так, як її виведе програма, без додаткових пробілів.

#include <iostream>

using namespace std;

struct P {

void f(){cout<<"P";}

};

struct Q : public P {

void f(){cout<<"Q";}

};

int main() {

Q obj;

P* p=&obj; p->f();

return 0;

}

View this question

Що буде виведено в результаті виконання коду?

Введіть відповідь точно так, як її виведе програма, без додаткових пробілів.

#include <iostream>

#include <string>

using namespace std;

class A{public:A(){cout<<"A";} ~A(){cout<<"a";} }; class B{public:B(){cout<<"B";} ~B(){cout<<"b";} }; class C{A a; B b; public:C(){cout<<"C";} ~C(){cout<<"c";} };

int main(){

C c;

return 0;

}

View this question

Що буде виведено в результаті виконання коду?

Введіть відповідь точно так, як її виведе програма, без додаткових пробілів.

#include <iostream>

#include <stack>

#include <queue>

#include <vector>

#include <functional>

#include <string>

using namespace std;

int main(){

stack<char> s; s.push('A'); s.push('B'); while(!s.empty()){cout<<s.top(); s.pop();}

return 0;

}

View this question

Що буде виведено в результаті виконання коду?

Введіть відповідь точно так, як її виведе програма, без додаткових пробілів.

#include <iostream>

#include <set>

#include <map>

#include <string>

#include <functional>

using namespace std;

int main(){

set<int, greater<int>> s={1,3,2}; for(int x:s) cout<<x;

return 0;

}

View this question

Який буде результат виконання цього коду?

Введіть відповідь точно так, як зазначено у варіантах екзамену.

#include <iostream>

#include <vector>

#include <numeric>

#include <stdexcept>

using namespace std;

int main() {

vector<int> v;

if (v.empty()) throw logic_error("empty vector");

cout << accumulate(v.begin(), v.end(), 0);

return 0;

}

View this question

Що буде виведено в результаті виконання коду?

Введіть відповідь точно так, як її виведе програма, без додаткових пробілів.

#include <iostream>

#include <vector>

#include <algorithm>

#include <numeric>

using namespace std;

int main(){

vector<int> v={1,1,2,2,3}; auto it=unique(v.begin(),v.end()); v.erase(it,v.end()); for(int x:v) cout<<x;

return 0;

}

View this question

Want instant access to all verified answers on e-learning.lnu.edu.ua?

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

Browser

Add to Chrome