Mảng tin học

Mảng tin học

1st Grade

34 Qs

quiz-placeholder

Similar activities

strategy formulating a plan for success and problem solving

strategy formulating a plan for success and problem solving

1st - 10th Grade

33 Qs

Variables de procesos

Variables de procesos

1st - 3rd Grade

30 Qs

Financial Institutions - Saving&Borrowing

Financial Institutions - Saving&Borrowing

1st - 2nd Grade

35 Qs

Ley de comercio exterior

Ley de comercio exterior

1st - 12th Grade

30 Qs

Konrad Wallenrod

Konrad Wallenrod

KG - Professional Development

30 Qs

Đề 8 QG 2

Đề 8 QG 2

1st Grade

29 Qs

prinsip perakaunan

prinsip perakaunan

1st - 3rd Grade

31 Qs

Examen 2da Emprendimiento

Examen 2da Emprendimiento

1st Grade

36 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

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?