Code Purpose
Quiz by , created more than 1 year ago

OOP Quiz on Тест 4, created by Code Purpose on 02/05/2020.

606
0
0
Code Purpose
Created by Code Purpose about 4 years ago
Close

Тест 4

Question 1 of 10

1

На колку различни начини може да се повика функцијата:
int Volume(int x, int y , int z ) { return x*y*z;}
1

Select one of the following:

  • 1

  • 2

  • 3

  • 4

Explanation

Question 2 of 10

1

Како се вика стандардниот простор со имиња (namespace) за работа со функциите за стандарден влез и излез

Select one of the following:

  • stdio

  • std

  • iostream

  • cstring

Explanation

Question 3 of 10

1

Ако го имаме следниот код:
class X{
public: int *x;
X (int xx) { x = new int; *x = xx;}
};
X *obj = new X[3]
Како ќе пристапиме до вредноста на атрибутот x во овјектот obj?

Select one of the following:

  • obj->x

  • *(obj.x)

  • *(obj->x)

  • obj.x

Explanation

Question 4 of 10

1

Што ќе отпечати програмата
class C {
public: int a;
C() {
cout << "a ";
};
C(int aa) {
a = aa;
cout << "b ";
};
C(const C & c) {
a = c.a;
cout << "c ";
};
~C() {
cout << "d ";
};
};
int main() {
C c1, c2(c1), c3;
c1 = c3;
}

Select one of the following:

  • a c a d d d

  • a b d d d

  • a c b d d d

  • a b c b d d

Explanation

Question 5 of 10

1

Кој е валиден прототип за Copy конструктор на класата Circle:
class Circle { private: int x, y, r; public: … }

Select one of the following:

  • Circle {const Circle &circle};

  • Circle {const Circle *circle};

  • Circle {Circle &c};

  • Circle {const & Circle c};

Explanation

Question 6 of 10

1

Дефинирана е следната класа:
class Broj {
private: int x;
public: Broj(int xx = 1) {
x = xx;
cout << x;
}
Broj(const Broj & b) {
cout << b.x;
}
};
Што ќе отпечати по извршувањето на следниот програмски код:
Broj br1;
Broj br2(br1);
br1 = br2;

Select one of the following:

  • 11

  • X

  • 111

  • 1

Explanation

Question 7 of 10

1

Што треба да се вклучи во С++ за да се овозможи употреба на стандардните влезо-излезни текови?

Select one of the following:

  • #include <stdio.h>

  • #include <fstream>

  • #include <iostream>

  • #include <stdio>

Explanation

Question 8 of 10

1

Што ќе отпечати програмата:
class C {
public:
int x;
C() {
cout << "1 ";
}
C(const C & c) {
x = c.x;
cout << "2 ";
}
C & operator = (const C & c) {
x = c.x;
cout << “3“;
return *this;
}
};
int main() {
C a;
C b = a;
a = b;
return 0;
}

Select one of the following:

  • 1 3 3

  • 1 2 3

  • 1 3 2

  • 1 1 2

Explanation

Question 9 of 10

1

Даден е следниот код:
typedef struct Struktura {
int i;
}
Str;
typedef Str * pok;
Str prom;
pok prom_pok = *prom;

Која од следните наредби е валидна ?

Select one of the following:

  • prom_pok.i = 10;

  • prom_pok->i = 10;

  • Str->i = 10;

  • prom->i = 10;

Explanation

Question 10 of 10

1

Што е НЕ е точно:

Select one of the following:

  • Деструктор на дадена класа се повикува при излегување од блок за објект инсталиран во тој блок

  • Деструктор на дадена класа се повикува при излегување од функција со параметар што се пренесува по вредност;

  • Default конструктор се повикува при пренос на објект како аргумент (по вредност) на функција

  • Copy конструкторот се повикува при враќање на објект како резултат на функција

Explanation