0% found this document useful (0 votes)
40 views3 pages

Bac Info Test 1

The document contains pseudocode solutions to problems from a computer science exam. 1) The first section contains multiple choice questions. 2) The second section involves calculating the sum of the digits of a number in reverse order and calculating the distance between three points. 3) The third section involves finding the largest prime factor of a number, generating an array of increasing numbers, and writing a series of numbers to a file by dividing successive numbers by 3.

Uploaded by

Silviu L
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views3 pages

Bac Info Test 1

The document contains pseudocode solutions to problems from a computer science exam. 1) The first section contains multiple choice questions. 2) The second section involves calculating the sum of the digits of a number in reverse order and calculating the distance between three points. 3) The third section involves finding the largest prime factor of a number, generating an array of increasing numbers, and writing a series of numbers to a file by dividing successive numbers by 3.

Uploaded by

Silviu L
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

OBSERVATIE : Am folosit acoladele in pseudocod pentru a putea intelege algoritmul.

Examenul de bacalaureat naţional 2020


Proba E. d)
Informatică Limbajul C/C++
Testul 1

Subiectul I

1) a
2) b
3) d
4) d
5) c

Subiectul al II-lea
1) a) 2020
b) (19,43 ) ; (29,46)
c) int main( )
{ int n, p, m, k, x, c, i;
p=1; m=0; k=0; // -1p
cout<<”n=”;
cin>>n;
while ( n!=0)
{ cin>>x;
for(i=1; i<=k; i++)
x=x/10;
if (x!=0 )
c=x%10;
else
c=n%10;
m=c*p+m;
n=n/10;
p=p*10;
k=k+1;
}
cout<<m;
return 0;
}
d) citeste n
p←1; m←0; k←0
cat timp n≠0 executa
{ citeste x
x←[x/p]
daca x≠0 atunci
c←x%10
altfel
OBSERVATIE : Am folosit acoladele in pseudocod pentru a putea intelege algoritmul.

c←n%10
m←c*p+m
n←[n/10]
p←p*10; k←k+1
}
scrie m

2) float tAx, tAy, tBx, tBy, tCx, tCy, m;


cin>>tAx>>tAy>>tBx>>tBy>>tCx>>tCy;
m=pow(tBx-tAx, 2)+ pow( tBy-tAy, 2);
cout<<m;
3) 2

Subiectul al III-lea

1) citeste n (numar natural nenul)


d←2
max←0
cat timp n>1 executa
{ p←0
cat timp n%d=0 executa
{ p←p+1
n←n/d
}
daca p>0 atunci
daca p≥ max atunci
{ max←p
k←d
}
d←d+1
}
scrie k max

2) int main( ) // -5p


{ int n, k, i, v[21], m, a;
cout<< “n=”;
cin>>n;
cout<<”k=”;
cin>>k;
m=0;
n=n*k; //int x=k;
while (m<= n)
{ a=0;
while (a<k) // while (a<x)
{ v[++m]=k;
OBSERVATIE : Am folosit acoladele in pseudocod pentru a putea intelege algoritmul.

a++;
}
k++;
}

for (i=1; i<=n; i++)


cout<< v[i]<<” “ ; //3 3 3 4 4 4 4 5 5 5 5 5
return 0;
}

3) #include <iostream.h>
#include<fstream>
using namespace std;
int main( )
{ long x;
ofstream fout (“bac.txt”);
cout<<”x=”;
cin>>x;
while (x!=0)
{ fout<<x<<” “ ;
x= (x+1)/3;
}
fout<<1;
fout.close( );
return 0;
}

You might also like