Fisa De Lucru - Vectori

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Laurentiu_lambri
L
Laurentiu_lambri
Community Contributor
Quizzes Created: 6 | Total Attempts: 9,216
Questions: 10 | Attempts: 549

SettingsSettingsSettings
Fisa De Lucru - Vectori - Quiz

Fisa de lucru utila claselor a 10-a, neintensiv, pentru feedback la lectia vectori


Questions and Answers
  • 1. 

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

    • A.

      Int v[20];

    • B.

      Float v[10];

    • C.

      Double v[20];

    • D.

      Real v[15];

    Correct Answer
    C. Double v[20];
    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.

    Rate this question:

  • 2. 

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

    • A.

      Vector[5]=6.7;

    • B.

      Vector=10;

    • C.

      Vector[6]=vector[9];

    • D.

      Vector[0]=10;

    Correct Answer
    B. Vector=10;
    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.

    Rate this question:

  • 3. 

    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];

    • A.

      6

    • B.

      5

    • C.

      4

    • D.

      S-ar afisa un mesaj de eroare

    Correct Answer
    A. 6
    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.

    Rate this question:

  • 4. 

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

    • A.

      10

    • B.

      12

    • C.

      30

    • D.

      Nimic, executia ar genera un mesaj de eroare !

    Correct Answer
    B. 12
    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 "

    Rate this question:

  • 5. 

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

    • A.

      Cin>>x;

    • B.

      X[10]=10;

    • C.

      X[0]=0.75;

    • D.

      If(x[4]

    Correct Answer
    A. Cin>>x;
    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.

    Rate this question:

  • 6. 

    Fie secventa urmatoare, scrisa in limbaj pseudocod: pentru i=1, 5, 1 executa v[i] = v[i]+1 scrie v[i] sfarsit pentru Rescrieti secventa in C++.

  • 7. 

    Fie vectorul V=[ -1, 9, 4, 3, 0, 8, 2]. Daca vom sorta crescator aplicand metoda bulelor (interschimbare), cum va arata vectorul  dupa a treia traversare ? 

  • 8. 

    Fie vectorul V=[ -1, 9, 4, 3, 0, 8, 2]. Daca vom sorta crescator aplicand metoda selectiei, cum va arata vectorul  dupa a treia traversare ? 

  • 9. 

    Care dintre urmatoarele acceseaza corect primul element al unui vector din vectorul cu 100 de elemente f ?

    • A.

      F[1]

    • B.

      F[0]

    • C.

      F

    • D.

      F[first]

    Correct Answer
    B. F[0]
    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].

    Rate this question:

  • 10. 

    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 ?

    • A.

      S-ar afisa 3, 4, 2, 5, 3, 6, 8, 12

    • B.

      Nu s-ar executa

    • C.

      S-ar afisa 2, 5, 3, 6, 8, 12, 3, 4

    • D.

      S-ar afisa 2, 5, 3, 6, 8, 12, 4, 3

    Correct Answer
    C. S-ar afisa 2, 5, 3, 6, 8, 12, 3, 4
    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.

    Rate this question:

Quiz Review Timeline +

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
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.