You are on page 1of 8

CHECKLIST

Lecture Checklist

Code 25e-BM/HR/HDCV/FSOFT
Version 1.0
Effective Date 7/1/2020
678174951.xlsx v1.7
Lecture Checklist
Project Code: "YES" 0
Reviewer(s): "NO" 0
Version of the work product: "N/A" 0
Review date:
Work product' size:
Effort spent on audit (person-hour):

#REF!
No Checked Items Assessment Notes Priority
1. Array and Control Flow
Array
Hiểu về đặc điểm của mảng tĩnh (Array) trong Java? - Không thể thay đổi kích thước (size) của mảng.
- Có thể lưu trữ được cả kiểu dữ liệu nguyên thủy (primitive) và đối tượng (object).
Vd: float[] numbers = new float[10]; => kiểu dữ liệu primitive
String[] names = new String[10]; => kiểu dữ liệu Object
- Mảng được đánh số từ 0.
1 - Có thể tạo mảng một chiểu hoặc đa chiều trong Java. Mandatory
Vd:
+ mảng 1 chiểu: int[] numbers;
+ mảng 2 chiều: int[][] numbers;

Đã thực hành sử dụng mảng tĩnh? - Khai báo:


+ Mảng 1 chiều: <data-type>[] <name> = new <data-type>[<size>];
Vd: int[] array1 = new int[10];
+ Mảng 2 chiều :
<data-type>[][] <name> = new <data-type>[<size1>][<size2>];
Vd: int[][] array2 = new int[2][3];
- Thêm dữ liệu cho array:
<nameArray>[<index>] = <value>;
Vd : array1[0] = 11;
array2[0][1] = 12;
2 Mandatory
- Truy xuất dữ liệu: theo cú pháp <arrayName>[<index>]
Vd: int element1 = array1[0]; // element1 = 11;
int element2 = array2[0][1]; // element2 = 12;
- Lấy ra size của array: theo cú pháp <arrrayName>.length
Vd: int size = array1.length; // size = 10;
int size1 = array2.length; //size1 = 2;
int size2 = array2[0].length; //size2 = 3;

Đã thực hành khai báo và sử dụng mảng tĩnh với kiểu đối tượng? VD:
String[] daysInWeek = new String[7]; //Khởi tạo một array có 7 phần tử.
daysInWeek[0] = "Monday";
daysInWeek[1] = "Tuesday";
daysInWeek[2] = "Wednesday";
daysInWeek[3] = "Thursday";
3 daysInWeek[4] = "Friday"; Mandatory
daysInWeek[5] = "Saturday";
daysInWeek[6] = "Sunday";
System.out.println(daysInWeek[2]); // in ra Wednesday
System.out.println(daysInWeek.length); // in ra 7

Đã thực hành duyệt mảng 1 chiều và 2 chiều? - Duyệt mảnh 1 chiều


int[] array= {1,2,3,4,5,6,7,8};
for(int i=0; i<array.length; i++){
System.out.println("array[ "+i +"] = "+ array[i]);
}
Hoặc
for(int element : array ){
System.out.println(element);
}
4 - Duyệt mảng 2 chiều Mandatory
int[][] array = {{1,2,3},{11,22,33}}; // mảng [2][2]
for(int i=0; i<array.length; i++){
for(int j=0; j< array[i].length; j++){
System.out.println("array[ "+i +"][ "+j+"]="+ array[i][j]);
}
}

Control Flow

02e-CL/DE/HDCV/FSOFT Internal use 3/8


678174951.xlsx v1.7
Đã hiểu và thực hành với if-else? - Cú pháp:
if (condition) { // condition : là một giá trị boolean
action1; // condition = true => action1 được thực thi.
} else {
action2; //condition = false => action2 được thực thi
}
- Vd với if-else block.
int num = 5;
if (num % 2 == 0) {
System.out.println(num + " is an even number");
5 } else { Mandatory
System.out.println(num + " is an odd number");
}
- Vd không có else block :
int num = 4;
if (num % 2 == 0) {
System.out.println(num + " is an even number");
}

Nắm được cấu trúc và thực hành với switch-case? VD:


String day = "Sunday";
switch(day) {
case "Sunday":
System.out.println("Go to the history class");
break;
case "Tuesday":
System.out.println("Go to the library");
break;
case "Wednesday":
System.out.println("Go to the math class");
break;
case "Thursday":
6 System.out.println("Go to the biological class");
break;
case "Friday":
System.out.println("Go to the dacing class ");
break;
default:
System.out.println("You are Free");
break;
}
=> sẽ in ra Go to the history class vì biến day đang có giá trị là Sunday.

Những kiểu dữ liệu nào có thể được sử dụng trong switch-case? - Kiểu dữ liệu nguyên thủy: byte, short, char, int.
- Các wrapper class tương ứng của các kiểu trên [Byte, Short, Character, Integer].
7 - Kiểu enums và String Mandatory

Hiểu về default block trong switch-case? - Block default là khối sẽ được gọi khi không có case nào match với dữ liệu truyền
vào. Block default là khối không bắt buộc trong switch-case.
- Vd:
String choice = "abc";
switch (check) {
case "No":
System.out.println("User selected No");
break;
case "Yes":
System.out.println("User selected Yes");
8 break; Mandatory
default:
System.out.println("Your choice is not available");
break;
}
=> sẽ in ra Your choice is not available vì giá trị của biến check không match với
case nào trong switch.

02e-CL/DE/HDCV/FSOFT Internal use 4/8


678174951.xlsx v1.7
Ý nghĩa của break trong switch-case? - Khi gặp từ khóa break, chương trình sẽ ngừng thực thi các đoạn code của các
case phía dưới nó và thoát ra khỏi switch block.
- Vd khi không có break:
String choice = "No";
switch (check) {
case "No":
System.out.println("User selected No");
case "Yes":
System.out.println("User selected Yes");
}
=> Kết quả:
User selected No
User selected Yes

- Vd khi có break:
9 String choice = "No"; Mandatory
switch (check) {
case "No":
System.out.println("User selected No");
break;
case "Yes":
System.out.println("User selected Yes");
}
=> Kết quả :
User selected No

Các kiểu cấu trúc lặp (loop) mà java hỗ trợ? Đặc điểm của từng loại? - Java hỗ trợ 3 kiểu loops: for, while, và do-while.
- For loop: thực hiện duyệt trên một dãy các giá trị. Dùng khi biết trước số lần lặp.
for(<khởi tạo>; <điều kiện> ; <update dữ liệu tăng hoặc giảm>){
// Công việc thực hiện sau mỗi lần lặp.
}
Vd: in ra các số chẵn trong khoảng từ 1 ->10
for (int i = 0; i <= 10; i += 2) {
System.out.println(i);
}

- While loop: sẽ thực hiện block code khi điều kiện trong while là true.
while (<condition>) {
// Công việc thực hiện sau mỗi lần lặp.
}
Vd: in ra các số chẵn trong khoảng từ 1 ->10
int i = 0;
while(i<=10) {
System.out.println(i);
10 i+=2; Mandatory
}

- Do-while loop: đảm bảo đoạn code sau lệnh 'do' sẽ được thực hiện ít nhất một
lần.
do {
// Công việc thực hiện sau mỗi lần lặp.
} while (<condition>);
Vd: tính tổng các số nguyên trong khoảng từ 1 ->10.
int sum = 0;
int i = 1;
do {
sum += i;
i++;
} while(i <=10)

Có thể sử dụng cấu trúc đặc biệt của for? - Cấu trúc khuyết thiếu 'khởi tạo': tức là bạn có thể khởi tạo biến từ bên ngoài for
như sau.
Vd: int i = 0;
for (; i < args.length; i++) {
// Statements
}
- Cấu trúc khuyết thiếu phần 'tăng/giảm biến': nếu khuyết thiếu phần này sẽ có khả
năng dẫn đến lặp vô hạn, do đó cần thực hiện lệnh này trong phần thân của for.
11 Vd: int i = 0;
for (; i < args.length;) {
// Statements
i++;
}

Sự khác nhau giữa for và while/do..while? - for: xác định trước số lần lặp.
- while/do..while: không xác định trước số lần lặp.
- while/do..while: trong phần thân luôn phải có lệnh làm thay đổi điều kiện, nếu
không sẽ lặp vô hạn.
12
- while: nếu điều kiện sai, có thể không lặp lần nào (không thực hiện các câu lệnh
sau while lần nào).
- do..while: luôn lặp ít nhất 1 lần dù điều kiện đúng hay sai.

02e-CL/DE/HDCV/FSOFT Internal use 5/8


678174951.xlsx v1.7
Hiểu và thực hành về break, continue? - break/ continue là một unlabeled :
+ break: thoát khỏi loop hiện tại.
+ continue: thực hiện bỏ qua toàn bộ công việc phía sau từ khóa continue trên
vòng lặp hiện tại để thực hiện lần lặp kế tiêp.
- Vd1:
for (int i = 1; i < 10; i++) {
if (i % 5 == 0) {
break;
}
System.out.print(i + ", ");
}
=>Sẽ in ra: 1, 2, 3, 4,
Giải thích: Tại vị trí i=5 => sẽ break ra khỏi for loop.

- Vd2: tính tổng các số lẻ trong khoảng từ 1 -> 10


13 int sum = 0; Mandatory
for (int i = 0; i <= 10; i++) {
if (i % 2 == 0) {
continue;
}
sum += i;
}
=> sum = 0+1+3+5+7+9 = 25
Giải thích: tại những lần lặp i nhận giá trị chia hết cho 2 => sẽ bỏ qua việc update lại
giá trị của biến 'sum' mà thực hiện tăng i lên 1 (i++) và thực hiện bước lặp kết tiếp.

* Comments

* Suggestion
[ ] - Pass
[ ] - Review again

02e-CL/DE/HDCV/FSOFT Internal use 6/8


678174951.xlsx v1.7

RECORD OF CHANGE
No Effective Date Version Change Description Reason Reviewer
1 N/A 1.0 Newly issue Apply for Lab/Assignment DieuNT1
2 1-Jul-20 1.0 Update Update for Release DieuNT1
3
4
5
6
7
8

02e-CL/DE/HDCV/FSOFT Internal use 7/8


678174951.xlsx v1.7

Approver
VinhNV
VinhNV

02e-CL/DE/HDCV/FSOFT Internal use 8/8

You might also like