Fisa De Lucru - Vectori

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Laurentiu_lambri
L
Laurentiu_lambri
Community Contributor
Quizzes Created: 6 | Total Attempts: 10,095
| Attempts: 592 | �ntrebri: 7
Please wait...

Question 1 / 7
0 %
0/100
Score 0/100
1. Care dintre urmatoarele acceseaza corect primul element al unui vector din vectorul cu 100 de elemente f ?

Explanation

The correct answer is f[0]. In programming, the indexing of an array or vector starts from 0, so the first element of the vector f would be accessed using f[0].

Submit
Please wait...
About This Quiz
Fisa De Lucru - Vectori - Quiz

Personalize your quiz and earn a certificate with your name on it!
2. Fie urmatoarea secventa de program: ... aux1=a[0]; aux2=a[1]; for(i=2;i<n;i++)     a[i-2]=a[i]; a[n-2]=aux1; a[n-1]=aux2; for(i=2;i<n;i++)     cout<<a[i]; ... Ce efect ar avea executia sa, daca vectorul a ar contine initial valorile: 3, 4, 2, 5, 3, 6, 8, 12 ?

Explanation

The given program performs a rotation operation on the array 'a'. It first stores the first two elements of the array in 'aux1' and 'aux2'. Then, it shifts the elements of the array to the left by 2 positions, starting from the third element. After that, it assigns the values of 'aux1' and 'aux2' to the last two positions of the array. Finally, it prints the elements of the array starting from the third position. Therefore, the program would output: 2, 5, 3, 6, 8, 12, 3, 4.

Submit
3. Fie declararea int vector[10]; care dintre urmatoarele operatii este incorecta ?

Explanation

The correct answer is "vector=10;". This is incorrect because you cannot assign a single value to an entire array. The correct way to assign a value to an array is by specifying the index, as shown in the other options.

Submit
4.    Care dintre variantele de mai jos reprezinta o declaratie corecta a unui vector cu 20 de elemente, numere reale ?   

Explanation

The correct answer is "double v[20];" because it declares a vector named "v" with 20 elements of type double, which are real numbers.

Submit
5. Fie urmatoarea secventa de program: ... int i; float a[20]; a[0]=1; for (i=1;i<=15;i=i+1)    a[i]=a[i-1]+1; ... Ce se valoare s-ar afisa prin instructiunea: cout<<a[5];

Explanation

The given program initializes an array 'a' with 20 float elements and assigns the value 1 to the first element, a[0]. Then, it enters a for loop where it iterates from i=1 to i=15. In each iteration, it assigns the value of the previous element incremented by 1 to the current element. Therefore, a[5] would have a value of 6.

Submit
6. Executia careia dintre urmatoarele instructiuni va genera un mesaj de eroare, stiind ca x este declarat astfel: float x[20] ?

Explanation

The given code will generate an error because it is trying to input a value into an entire array using the cin statement. However, cin can only be used to input a single value, not an entire array. To input values into an array, a loop or individual assignments for each element of the array should be used.

Submit
7. Fie secventa de program: ... int a[20],n.i,s; cin>>n; for(i=0;i<n;i++)

Explanation

The given sequence of code declares an integer array "a" of size 20, and three integer variables "n", "i", and "s". It then takes input for the variable "n". The for loop iterates from 0 to "n-1". However, there is a syntax error in the code. The comparison operator used in the for loop condition should be "

Submit
View My Results

Quiz Review Timeline (Updated): Mar 19, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 19, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Mar 10, 2010
    Quiz Created by
    Laurentiu_lambri
Cancel
  • All
    All (7)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Care dintre urmatoarele acceseaza corect primul element al unui vector...
Fie urmatoarea secventa de program:...
Fie declararea int vector[10]; care dintre urmatoarele operatii este...
   Care dintre variantele de mai jos reprezinta o...
Fie urmatoarea secventa de program:...
Executia careia dintre urmatoarele instructiuni va genera un mesaj de...
Fie secventa de program:...
Alert!

Advertisement