Professional Documents
Culture Documents
Primjer Kolokvija
Primjer Kolokvija
1 #include <iostream>
2 using namespace std;
3 int main()
4 {
5 int broj;
6 cout<<"Upisi broj:";
7 cin>>broj;
8 if (broj%2=0)
9 cout<<"Broj je paran"<<endl;
10 else
11 cout<<"Broj je neparan"<<endl;
12 system("pause");
13 return 0;
14 }
2.
Marks: 1
Koja od slijedećih riječi ne označava tip varijable:
Choose one answer.
a. float
b. char
c. int
d. real
e. bool
3.
Marks: 2
#include <iostream>
using namespace std;
int main () {
int a=1, c=3, d=4;
if(c=1){ cout<<"test";}
if(a==c){
cout<<"test";
}
cout<<d<<endl;
system("pause");
return 0;
}
4.
Marks: 1
a. ?
b. +=
c. ?=
d. ==
e. =
5.
Marks: 1
a. 10
b. 0
c. 100
d. ništa od navedenog
e. 1
6.
Marks: 2
1 #include <iostream>
2 using namespace std;
3 int main()
4 {
5 int broj;
6 cout<<"Upisi broj:";
7 cin>>broj;
8 if (broj%2==0);
9 cout<<"Broj je paran"<<endl;
10 else
11 cout<<"Broj je neparan"<<endl;
12 system("pause");
13 return 0;
14 }
7.
Marks: 2
Ako je su vrijednosti varijabli a=1, b=2, c=3 koji je numerički rezultat slijedećeg izraza: 0
a>b>c
8.
Marks: 2
#include <iostream>
using namespace std;
int main () {
int a = 6;
float b=6.;
cout << a/4;
float c=a/4;
cout << c;
c = (float)a/4;
cout << c;
c=b*a; cout << c/4;
system ("pause");
return 0;
}
9.
Marks: 1
a. _1a
b. a_jedan
c. 1_a
d. a_1
e. jedan_a
10.
Marks: 1
a. {}
b. []
c. /* */
d. ()
e. //
11.
Marks: 2
#include <iostream>
using namespace std;
int main()
{
int x=1;
if(x==1) cout<<1;
if(x==2) cout<<2;
else cout<<3;
system("pause");
return 0;
}
b. 13
c. 1
d. 2
e. 12
12.
#include <iostream>
using namespace std;
int main () {
int a=1, b=2, c, d;
c=++a;
d=c++;
cout<<"a,b,c,d"<<"endl";
cout<<c--<<d;
system("pause");
return 0;
}
13.
Marks: 2
1 #include <iostream>
2 using namespace std;
3 int main()
4 {
5 int broj
6 cout<<"Upisi broj:";
7 cin>>broj;
8 if (broj%2==0)
9 cout<<"Broj je paran"<<endl;
10 else
11 cout<<"Broj je neparan"<<endl;
12 system("pause");
13 return 0;
14 }
14.
Marks: 1
a. predprocesorske naredbe
b. postprocesorske naredbe
c. kompajlerske naredbe
d. procesorske naredbe
e. prevoditeljske naredbe
15.
Upišite broj linije u kojoj se nalazi greška? – 6 poslije << fali bilo sta
1 #include <iostream>
2 using namespace std;
3 int main()
4 {
5 int broj;
6 cout<<"Upisi broj:"<<;
7 cin>>broj;
8 if (broj%2==0)
9 cout<<"Broj je paran"<<endl;
10 else
11 cout<<"Broj je neparan"<<endl;
12 system("pause");
13 return 0;
14 }
16.
Marks: 4
Napišite program koji traži od korisnika da upiše jedan dvoznamenkasti broj,a onda
ispiše taj broj unatrag (npr. 23 -> 32)
#include <iostream>
int main () {
cin>>b;
c=b/10;
c=c%10;
d=b%10;
cout<<endl<<d<<c<<endl;
system ("pause");
return 0;}
17.
Marks: 2
#include <iostream>
using namespace std;
int main()
{
int x=1;
int y=x++,z=++x;
cout<<"2+2"<<"="<<2+2;
cout<<x<<y;
system("pause");
return 0;
}
18.
Marks: 1
a. a+2=2
b. a=a+2
c. 2=+a
d. a=+2
e. a=2
19.
Marks: 1
Ako na početku programa ne navedemo liniju #include <iostream> u programu nećemo moći
koristiti naredbu:
a. return
b. if
c. cout
d. int
e. switch