Questão 1
Questão
Што ќе се испечати по извршуванње на следниот програмски код:
enum numbers { a, b, c=3, d=7, e, f };
int main(){
numbers n = a;
cout << n << " ";
n=b; cout << n << " "; n = c; cout << n << " ";
n=d; cout << n << " "; n = e; cout << n << " ";
n=f; cout << n << " ";
return 0;
}
Responda
-
0 0 3 7 0 0
-
0 1 3 7 8 9
-
1 2 3 7 8 9
-
0 1 2 3 4 5
Questão 2
Questão
Што треба да се вклучи бо С++ програма за да се овозможи употреба на стандардните влезно-излезни текови?
Responda
-
#include <stdio.h>
-
#include <fstream>
-
#include <iostream>
-
#include <stdio>
Questão 3
Questão
Дефинирана е класата:
class A{ double i;
public: A(double ii = 0.0) {}
const A operator -(const A& a1)
{return A(i - a1.i); }
friend const A operator+(const A& a1, const A& a2)
{ return A(a1.i + a2.i); }};
int main()
{
A a(2.3), b(3.5), c;
...
return 0;
}
Која од селдните наредби не е валидна?
Responda
-
c = a + 8.2;
-
c = 3.4 - b;
-
c = b - 4.6;
-
c = 7.6 + a;
Questão 4
Questão
Дадени се функциите:
int f(int x) { return x/4; }
float f(float x) { return x/4; }
Што ке се испечати по извршување на наредвите:
int x=8.4; cout<<f(x);
Questão 5
Questão
class Pravoagolnik{
int a,b;
public:
Pravoagolnik(int a, int b=6){
this->a=a;
this->b=b;
}
};
Questão 6
Questão
На колку различни начини може да се повика функцијата:
int Volume(int x, int y, int z=3) { return x*y*z;}
Questão 7
Questão
Ако меморијата вила оцлободена од кодот delete[] niza, како била резервирана:
Responda
-
int *niza = new int
-
int* niza = new int[10]
-
int niza = new int [10]
-
int niza[10]
Questão 8
Questão
Која е валиден прототип за Copy констркуктор на класата Krug:
class Krug{ private: int a, b, c; public: ...... }
Responda
-
Krug {const & Krug s};
-
Krug {const Krug *s};
-
Krug {Krug &s};
-
Krug {const Krug &s};
Questão 9
Questão
Што ке се испечати по извршуванње на следниот програмски код:
class K{
private: int k;
public: void SetK(int kk) {k=kk;}
int GetK(){return k;}
};
int main(){
K y, *py; py = &y; py->SetK(10); y.SetK(100);
cout << (*py).GetK()<<endl;
return 0;
}
Questão 10
Questão
Како се пристапува до името (name) на првиот елемент на полето emp во структурата comp:
struct Employee { char name[100]; };
struct Company { Employee emp[50]; } comp;
Responda
-
comp.emp[0].name
-
omp->emp[0]->name;
-
Company::emp[0].name;
-
comp.emp.name[0];