Mảng tin học

Mảng tin học

1st Grade

34 Qs

quiz-placeholder

Similar activities

Kwalifikacja A31 Part 2

Kwalifikacja A31 Part 2

1st - 5th Grade

33 Qs

Quiz strategi kewangan pasca-siswazah

Quiz strategi kewangan pasca-siswazah

KG - Professional Development

31 Qs

3.4 Test Keseimbangan Pasar dan Struktur Pasar Kls X

3.4 Test Keseimbangan Pasar dan Struktur Pasar Kls X

1st Grade

35 Qs

Usługi finansowe i ubezpieczenia

Usługi finansowe i ubezpieczenia

1st Grade - University

30 Qs

Finanzas

Finanzas

1st Grade

29 Qs

feedy

feedy

1st - 4th Grade

30 Qs

A.36 czerwiec 2019 Maćko

A.36 czerwiec 2019 Maćko

1st - 5th Grade

30 Qs

Mảng tin học

Mảng tin học

Assessment

Quiz

Business

1st Grade

Easy

Created by

Tran Quang Huy

Used 1+ times

FREE Resource

34 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Thuật toán nào đúng để tính tích các phần tử có giá trị là số hoàn hảo trong mảng ‘arr’ có 8 phần tử?

int tich=1;

          for(int i=0; i<8; i++)

          {

                    int tonghh=0;

                    for(int j=1; j<=arr[i]/2; j++)

                    if(arr[i]%j!=0) 

                              tonghh=tonghh+j;

                    if(tonghh ==arr[i])

                              tich*=arr[i];

          }

int tich=0;

          for(int i=0; i<8; i++)

          {

                    int tonghh=0;

                    for(int j=1; j<=arr[i]/2; j++)

                    if(arr[i]%j==0) 

                              tonghh=tonghh+j;

                    if(tonghh ==arr[i])

                              tich*=arr[i];

          }

int tich=1;

          for(int i=0; i<8; i++)

          {

                    int tonghh=1;

                    for(int j=1; j<=arr[i]/2; j++)

                    if(arr[i]%j==0) 

                              tonghh=tonghh+j;

                    if(tonghh ==arr[i])

                              tich*=arr[i];

        }

int tich=1;

          for(int i=0; i<8; i++)

          {

                    int tonghh=0;

                    for(int j=1; j<=arr[i]/2; j++)

                    if(arr[i]%j==0) 

                              tonghh=tonghh+j;

                    if(tonghh ==arr[i])

                              tich*=arr[i];

          }

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Thuật toán nào đúng để đếm các phần tử có giá trị là số hoàn hảo trong mảng ‘arr’ có 6 phần tử?

int demhh=0;

          for(int i=0; i<6; i++)

          {

                    int tonghh=0;

                    for(int j=1; j<=arr[i]/2; j++)

                    if(arr[i]%j!=0) 

                              tonghh=tonghh+j;

                    if(tonghh ==arr[i])

                                       demhh++;

          }

int demhh=0;

          for(int i=0; i<=6; i++)

          {

                    int tonghh=0;

                    for(int j=1; j<arr[i]/2; j++)

                    if(arr[i]%j==0) 

                              tonghh=tonghh+j;

                    if(tonghh ==arr[i])

                                       demhh++;

          }

int demhh=0;

          for(int i=0; i<6; i++)

          {

                    int tonghh=0;

                    for(int j=1; j<=arr[i]/2; j++)

                    if(arr[i]%j==0) 

                              tonghh=tonghh+j;

                    if(tonghh ==arr[i])

                                       demhh++;

          }

int demhh=0;

          for(int i=0; i<6; i++)

          {

                    int tonghh=0;

                    for(int j=1; j<=arr[i]/2; j++)

                    if(arr[i]%j==0) 

                              tonghh=tonghh+j;

                    if(tonghh =arr[i])

                                       demhh++;

          }

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Thuật toán nào đúng để hiển thị các phần tử có giá trị là số nguyên tố trong mảng ‘arr’ có 6 phần tử?

for(int i=0; i<6; i++)

          {

                    int dem=0;

                    for(int j=2; j<=sqrt(arr[i]);j++)

                    if(arr[i]%j==0) 

                             dem++;

                    if(dem=0)

                              cout<<arr[i]<<" ";

          }

for(int i=0; i<6; i++)

          {

                    int dem=0;

                    for(int j=2; j<=sqrt(arr[i]);j++)

                    if(arr[i]%j==0) 

                             dem++;

                    if(dem==2)

                              cout<<arr[i]<<" ";

          }

for(int i=0; i<6; i++)

          {

                    int dem=2;

                    for(int j=2; j<=sqrt(arr[i]);j++)

                    if(arr[i]%j==0) 

                             dem++;

                    if(dem==0)

                              cout<<arr[i]<<" ";

          }

for(int i=0; i<6; i++)

          {

                    int dem=0;

                    for(int j=2; j<=sqrt(arr[i]);j++)

                    if(arr[i]%j==0) 

                             dem++;

                    if(dem==0)

                              cout<<arr[i]<<" ";

          }

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Thuật toán nào đúng để tính tích các phần tử có giá trị là số nguyên tố trong mảng ‘arr’ có 7 phần tử?

int  tichnto=0;

          for(int i=0; i<7; i++)

          {

                    int dem=0;

                    for(int j=2; j<=sqrt(arr[i]);j++)

                    if(arr[i]%j==0) 

                             dem++;

                    if(dem==0)

                                       tichnto*=arr[i];

          }

int  tichnto=1;

          for(int i=0; i<7; i++)

          {

                    int dem=0;

                    for(int j=2; j<=sqrt(arr[i]);j++)

                    if(arr[i]%j==0) 

                             dem++;

                    if(dem==0)

                                       tichnto*=arr[i];

          }

int  tichnto=1;

          for(int i=0; i<7; i++)

          {

                    int dem=1;

                    for(int j=2; j<=sqrt(arr[i]);j++)

                    if(arr[i]%j==0) 

                             dem++;

                    if(dem==0)

                                       tichnto*=arr[i];

          }

int  tichnto=1;

          for(int i=0; i<7; i++)

          {

                    int dem=0;

                    for(int j=2; j<=sqrt(arr[i]);j++)

                    if(arr[i]%j=0) 

                             dem++;

                    if(dem==0)

                                       tichnto*=arr[i];

          }

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Thuật toán nào đúng để tính tổng các phần tử có giá trị là số nguyên tố trong mảng ‘arr’ có 5 phần tử?

int  tongnto=0;

          for(int i=0; i<5; i++)

          {

                    int dem=0;

                    for(int j=2; j<=sqrt(arr[i]);j++)

                    if(arr[i]%j==0) 

                             dem++;

                    if(dem==0)

                                       tongnto+=arr[i];

          }

int  tongnto=0;

          for(int i=0; i<5; i++)

          {

                    int dem=0;

                    for(int j=2; j<=sqrt(arr[i]);j++)

                    if(arr[i]%j==0) 

                             dem++;

                    if(dem==2)

                                       tongnto+=arr[i];

          }

int  tongnto=1;

          for(int i=0; i<5; i++)

          {

                    int dem=0;

                    for(int j=2; j<=sqrt(arr[i]);j++)

                    if(arr[i]%j==0) 

                             dem++;

                    if(dem==0)

                                       tongnto+=arr[i];

          }

int  tongnto=0;

          for(int i=0; i<5; i++)

          {

                    int dem=0;

                    for(int j=2; j<=abs(arr[i]);j++)

                    if(arr[i]%j==0) 

                             dem++;

                    if(dem==0)

                                       tongnto+=arr[i];

          }

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Thuật toán nào đúng để đếm số lượng các phần tử có giá trị là số nguyên tố trong mảng ‘arr’ có 5 phần tử?

int  demnto=0;

          for(int i=0; i<5; i++)

          {

                    int dem=0;

                    for(int j=2; j<=sqrt(arr[i]);j++)

                    if(arr[i]%j==0) 

                             dem++;

                    if(dem==0)

                                       demnto++;

          }

int  demnto=1;

          for(int i=0; i<5; i++)

          {

                    int dem=0;

                    for(int j=2; j<=sqrt(arr[i]);j++)

                    if(arr[i]%j==0) 

                             dem++;

                    if(dem==0)

                                       demnto++;

          }

int  demnto=A[0];

          for(int i=0; i<5; i++)

          {

                    int dem=0;

                    for(int j=2; j<=sqrt(arr[i]);j++)

                    if(arr[i]%j==0) 

                             dem++;

                    if(dem==0)

                                       demnto++;

          }

int  demnto=0;

          for(int i=0; i<5; i++)

          {

                    int dem=0;

                    for(int j=2; j<=sqrt(arr[i]);j++)

                    if(arr[i]%j==0) 

                             dem++;

                    if(dem==2)

                                       demnto++;

          }

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Thuật toán nào đúng để sắp xếp mảng `arr` có 8 phần tử theo thứ tự giảm dần bằng thuật toán sắp xếp chọn (Selection Sort)?

for (int i = 0; i < =7; i++) 

          {       

                   int max_idx = 1;   

                   for (int j = i + 1; j <= 8; j++)    

                   if (arr[j] > arr[max_idx])

                             max_idx = j;

                   int temp = arr[i];  

                   arr[i] = arr[max_idx];     

                   arr[max_idx] = temp;     

          }

for (int i = 0; i < 8; i++) 

          {       

                   int max_idx = 0;   

                   for (int j = i + 1; j < 9; j++)      

                   if (arr[j] > arr[max_idx])

                             max_idx = j;

                   int temp = arr[i];  

                   arr[i] = arr[max_idx];     

                   arr[max_idx] = temp;     

          }

for (int i = 0; i < 7; i++) 

          {       

                   int max_idx = i;    

                   for (int j = i + 1; j < 8; j++)      

                   if (arr[j] > arr[max_idx])

                             max_idx = j;

                   int temp = arr[i];  

                   arr[i] = arr[max_idx];     

                   arr[max_idx] = temp;     

          }

for (int i = 0; i < 7; i++) 

          {       

                   int max_idx = i;    

                   for (int j = i + 1; j < 8; j++)      

                   if (arr[j] < arr[max_idx])

                             max_idx = j;

                   int temp = arr[i];  

                   arr[i] = arr[max_idx];     

                   arr[max_idx] = temp;     

          }

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?