Looking for Обчислювальна техніка та програмування [04123] test answers and solutions? Browse our comprehensive collection of verified answers for Обчислювальна техніка та програмування [04123] at vns.lpnu.ua.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
x унаслідок виконання фрагменту коду
int x = 7, y=10;
int *px = &x, py = &y;
py = px; *py = 22; *px += 31;
Задайте відповідність між функціями та їх призначенням
Чи працюватиме код поданий далі? Якщо так, то який результат його виконання?
#include <iostream>
using namespace std;
struct P
{
char * str;
int a;
};
P* create() {
P* ptr = new P;
ptr->str = new char[6];
strcpy_s(ptr->str,6, "Hello");
ptr->a = 10;
return ptr;
}
void main() {
P* o = create();
cout << o->str << "\t" << o->a << "\n";
}
Фрагмент коду, поданий нижче містить "вічний" цикл:
int i = 0, a = 4;
while (i<a)
cout << a - i;
i++;
Який з перелічених операторів є оператором присвоєння в мові С?
Який результат виконання наступного фрагмента коду:
Який результат виконання наступного фрагмента коду:
int i = 2;
while (i<7)
{
if (i != 5)
i++;
else
cout << i++ << " ";
}
Що буде виведено на екран внаслідок виконання наступного фрагмента коду:
#include <iostream>
using namespace std;
class A{
int *a;
public:
A(int x)
{
a = new int(x);
cout << "A(" << x << ")\n";
}
A(const A &a1)
{
cout << "A(const A" << "&a1)\n";
a = new int(*(a1.a));
}
~A()
{
delete a;
cout << "~A()\n";
}
};
A f()
{
A a1(123);
return a1;
}
void main(){
f();
}
Який результат виконання наступного фрагмента коду:
char str[] = "Alphabet - a b c d e f";
char* ptr = strstr(str, "a");
while (ptr)
{
cout << ptr - str << '\t';
ptr = strstr(ptr + 1, "a");
}
Який результат виконання наступного фрагмента коду:
const int k = 5;
int mas[k] = { 1, 2, 4, 9, 0, 7 };
for (int i = 0; i<k; i += 3)
cout << mas[i] << " ";
return 0;