Câu 1: Cho biết kết quả của đoạn mã sau:
int a1[] = {1,3,4,5};
int a2[][] = {{1,2,3},{4,5,6}};
a1[1] = a2[2][1];
a1[4] = a2[2][2];
for(int i = 0;i<a1.length;i++){
System.out.println(a1[i]);
}
Java-ArrayMethod
Quiz
•
Fun, Professional Development
•
1st - 5th Grade
•
Medium
Kiều Thị
Used 33+ times
FREE Resource
8 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Câu 1: Cho biết kết quả của đoạn mã sau:
int a1[] = {1,3,4,5};
int a2[][] = {{1,2,3},{4,5,6}};
a1[1] = a2[2][1];
a1[4] = a2[2][2];
for(int i = 0;i<a1.length;i++){
System.out.println(a1[i]);
}
Lỗi biên dịch
Xảy ra lỗi ArrayIndexOutOfBoundsException
1,5,4,5
1,5,4,5,6
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Lệnh nào để lấy ra độ dài của mảng là gì ?
length
size()
length()
size
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Cho biết kết quả của đoạn mã sau?
int[] x = {1, 3, 7, 9};
for(int a : x){
System.out.print(a);
if(a % 2 != 0){
break;
}
}
1, 3, 5, 7
1
3, 5, 7
Không có đáp án đúng
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Cho biết kết quả của đoạn mã sau?
int[] x = {5,6,7,8,9};
for(int a : x){
System.out.print(a) ;
}
5,6,7,8
5,6,7,8,9
a, a, a, a, a
a
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Cho biết kết quả đoạn mã sau:
int index = -1, a[] = {1,2,3,4};
for(int i=0;i<a.length();i++){
if(a[i] == 2){
index = i;
}
}
0
1
Lỗi biên dịch
2
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Cho biết kết quả của đoạn mã sau:
public static int tinhTong(int a[]){
int s = 0;
for (int i = 0;i<a.length;i++){
s+= a[i];
}
return s;
}
public static void main(String[] args) {
int a[] = {1,3,4,5};
System.out.println(tinhTong(a));
}
Lỗi biên dịch
13
12
10
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Khai báo nào sau đây có kiểu trả về là true/false?
public static boolean a();
public static int a();
public static long a1();
public static void a();
8.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Cho biết kết quả của đoạn mã sau?
static void swap(int i,int j){
int temp=i;
i=j;
j=temp;
}
public static void main(String[] args){
int i=1;
int j=2;
swap(i,j);
System.out.println( i + " j = " + j);
}
1, 2
2, 1
1, 1
2, 2
7 questions
Tuần 1 tháng 9
Quiz
•
1st Grade
10 questions
Lesson 10 - Decision control statements
Quiz
•
5th - 8th Grade
10 questions
Java Quiz
Quiz
•
3rd Grade
10 questions
Java advance
Quiz
•
2nd Grade
10 questions
Лекция №1. Основы Java.
Quiz
•
1st Grade
10 questions
Quiz 1 coursera python
Quiz
•
1st - 5th Grade
10 questions
PROGRAMACION MODULAR DE VECTORES Y MATRICES
Quiz
•
1st - 5th Grade
10 questions
Toán lớp 3
Quiz
•
3rd Grade
10 questions
Chains by Laurie Halse Anderson Chapters 1-3 Quiz
Quiz
•
6th Grade
20 questions
math review
Quiz
•
4th Grade
15 questions
Character Analysis
Quiz
•
4th Grade
12 questions
Multiplying Fractions
Quiz
•
6th Grade
30 questions
Biology Regents Review #1
Quiz
•
9th Grade
20 questions
Reading Comprehension
Quiz
•
5th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
50 questions
Biology Regents Review: Structure & Function
Quiz
•
9th - 12th Grade
10 questions
Candy
Quiz
•
4th - 8th Grade
10 questions
Fact Check Ice Breaker: Two truths and a lie
Quiz
•
5th - 12th Grade
10 questions
Disney Characters
Quiz
•
2nd Grade
71 questions
Logos
Quiz
•
3rd Grade - University
39 questions
4th Grade Math Review
Quiz
•
4th - 5th Grade
69 questions
McKee Teacher Trivia
Quiz
•
5th Grade
20 questions
Summer Trivia
Quiz
•
5th Grade
15 questions
Summer Trivia
Quiz
•
5th - 8th Grade