Search Header Logo

Java chương 1

Authored by Phamthihuong Dtth

Mathematics

1st - 5th Grade

Used 2+ times

Java chương 1
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

10 sec • 1 pt

Câu lệnh xác định độ dài mảng buses là:

int buses[] = new int[5];

buses.length

buses.length()

buses.size

buses.size()

2.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

Cho biết kết quả:

String[] nums = new String[] { "1", "9", "10" };

Arrays.sort(nums);

System.out.println(Arrays.toString(nums));

[1, 9, 10]

[1, 10, 9]

[10, 1, 9]

3.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

Cho biết kết quả:

String[] os = new String[] { "Mac", "Linux", "Windows" };

Arrays.sort(os);

System.out.println(Arrays.binarySearch(os, "Mac"));

0

1

2

4.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

Cho biết kết quả:

public class Test{

        public static void main(String[] args){

                int[] a = new int[0];

                System.out.print(a.length);

        }

}

Sai a.length

lỗi vì size mảng không thể = 0

0

5.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

Cho biết kết quả:

public class Test{

        public static void main(String[] args){

                int[] x = new int[3];

                System.out.println("x[0] is " + x[0]);

        }

}

Lỗi vì mảng chưa khởi tạo

x[0] is 0

Lỗi không có giá trị x[0]

6.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

Cho kết quả: public class Test{

        public static void main(String args[]){

                double[] myList = {1, 5, 5, 5, 5, 1};

                double max = myList[0];

                int indexOfMax = 0;

                for(int i = 1; i < myList.length; i++){

                        if(myList[i] > max){

                                max = myList[i];

                                indexOfMax = i;

                        }

                }

                System.out.println(indexOfMax);

        }

}

0

2

1

7.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

Cho biết kết quả:

String s1 = "Java";

String s2 = "Java";

StringBuilder sb1 = new StringBuilder();

sb1.append("Ja").append("va");

System.out.println(s1 == s2);

System.out.println(s1.equals(s2));

System.out.println(sb1.toString() == s1);

System.out.println(sb1.toString().equals(s1));

in ra 1 lần true

in ra 2 lần true

in ra 3 lần true

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?