← Powrót do bazy
Arkusze • Programowanie
Test teoretyczny C/C++ – przykładowe pytania
Czas
Free
Zadania
18
Pytanie 1 z 18
6%
Biblioteka w języku C/C++:
Lista pytań w tym arkuszu
1
Biblioteka w języku C/C++:
→
2
Wskaż typy całkowite w języku C/C++:
→
3
Koniec łańcucha znaków w języku C jest opisywany za pomocą:
→
4
Po uruchomieniu poniższy program wypisze:
#include
int main()
{
float a;
a=15.2;
printf("%.2f",a);
return 0;
}
→
5
Po uruchomieniu poniższy program wypisze:
#include
int main(int argc, char *argv[]) {
int i;
for(i=2; i<4; i *= 2)
std::cout<
→
6
Po uruchomieniu poniższy program wypisze:
#include
#define D 1
int main(int argc, char *argv[]) {
int a=1, b=4, d=0;
#ifdef D
d = a+b;
#endif
d = d-5;
std::cout<
→
7
Po uruchomieniu poniższy program wypisze:
#include
int main(int argc, char *argv[]) {
int a[5] = {5, 1, 15, 20, 25};
int i=2.5, j, m;
i++;
j = a[3]++;
m = a[i];
std::cout<
→
8
Poniższy program?
#include
int main() {
int a=1, b=4, c, d;
c = a<<2;
d = c | b;
printf("%d,%d", c, d);
return 0;
}
→
9
Poniższy program?
#include
void f(int i) {
std::cout<1)
f(i-1);
else
return;
}
int main(int argc, char *argv[]) {
f(3);
return 0;
}
→
10
W jaki sposób otworzyć plik tekstowy do zapisu?
→
11
Poniższy program?
#include
#include
using namespace std;
class Bazowa {
string s;
public:
Bazowa() { s="Hello";}
Bazowa(string s) : s("W"){ }
void Print() { cout << s; }
};
int main() {
Bazowa *o = new Bazowa("H");
o->Print();
}
→
12
Poniższy program?
#include
#include
using namespace std;
class BaseClass {
public:
int *ptr;
BaseClass(int i) { ptr = new int(i); }
~BaseClass() { delete ptr; delete ptr;}
void Print() { cout << *ptr; }
};
int main() {
BaseClass o(10);
o.Print();
}
→
13
Poniższy program?
#include
#include
using namespace std;
class B;
class A {
int wiek;
public:
A () { wiek=50; };
friend void Print(A &a, B &b);
};
class B {
string name;
public:
B () { name="Adam"; };
friend void Print(A &a, B &b);
};
void Print(A &a, B &b) {
cout<
→
14
Poniższy program?
#include
#include
using namespace std;
class A {
public:
void Print() { cout<< "A";}
};
class B:public A {
public:
void Print() { cout<< "B"; }
};
class C:public A {
public:
void Print() { cout<< "C"; }
};
int main() {
B obj2;
C obj3;
A *obj;
obj = &obj2;
obj->Print();
obj = &obj3;
obj->Print();
}
→
15
Poniższy program?
#include
#include
using namespace std;
#include
using namespace std;
template
myType GetMax (myType a, myType b) {
return (a>b?a:b);
}
int main () {
cout << GetMax(10,5);
return 0;
}
→
16
Poniższy program?
#include
using namespace std;
int main () {
int c=1;
try
{
switch (c)
{
case 1:
throw 20;
case 2:
throw 5.2f;
case 3:
throw 'a';
}
}
catch (float e)
{ cout << "float" ; }
catch (...)
{ cout << "..."; }
return 0;
}
→
17
Poniższy program?
#include
#include
using namespace std;
int main () {
std::vector v;
v.reserve(10);
v.push_back(15);
cout<
→
18
Poniższy program?
#include
#include
→