Search Header Logo

MD1-Bài 10 - Mảng JS

Authored by kiếm mãi

English

University - Professional Development

Used 34+ times

MD1-Bài 10 - Mảng JS
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

Cho biết giá trị của các biến a và b sau khi thực hiện đoạn mã sau?

let x = [3,5,6,9];

let a = 0, b = 0;

for(let y in x){

if(y % 2 != 0) {

a+=y;

b++;

}

console.log(a);

console.log(b)

013

2

4

2

13

2

02

2

2.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

Cho biết phần tử cuối cùng của mảng a là gì sau khi thực hiện đoạn mã sau?

let a = ["John", "Mary", "Caly", "Tomy"];

a.sort();

Caly

Tomy

Mary

John

3.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

Đoạn mã sau in ra kết quả gì?

let a = [1,2,3,4,5,6,7,8,9];

let b = [];

a[9] = b[0];

console.log(a[9]);

0

undefined

9

null

4.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

Sau khi thực hiện đoạn mã sau thì mảng a sẽ có giá trị là:

let a = [1,9,3,2];

for(let i=0;i<a.length-1;i++){

for(let j=i+1;j<a.length;j++){

if(a[i] > a[j]){

let x = a[i];

a[i] = a[j];

a[j] = x; }

}

}

[1,9,3,2]

[1,2,3,9]

[2,3,9,1]

[9,3,2,1]

5.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

Sau khi thực hiện đoạn mã sau thì mảng a sẽ có giá trị là:

let a = [1,9,3,2];

for(let i=0;i<a.length-1;i++){

for(let j=i+1;j<a.length;j++){

if(a[i] < a[j]){

let x = a[i];

a[i] = a[j];

a[j] = x; }

}

}

[1,2,3,9]

[2,3,9,1]

[9,3,2,1]

[1,9,3,2]

6.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

 

Sau khi đoạn mã sau được thực hiện thì giá trị các phần tử của mảng a là:

let a = [4, 3, 5];

a[2] = a[1] * 4;

a[1] *= a.length;

[4,9,5]

[4,9,16]

[4,3,5]

[4,9,12]

7.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

 

 

Đoạn mã sau xuất ra kết quả trên màn hình là gì?

let x = [5, 6, 7, 8];

for(let a in x){

  if(x[a] % 2 == 0){

    break;

  }

 console.log(a);

}

0

5

1

2

Access all questions and much more by creating a free account

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

Already have an account?