![]() |
Đề thi SWT301 Software Testing SU25 Đại học FPT |
Hôm nay, kỳ thi chính thức môn SWT301 - Software Testing kỳ SU25 tại Đại học FPT vừa kết thúc, và thật sự là một trải nghiệm khó quên. Đề thi năm nay toàn câu hỏi "out tầm ôn tập", khiến không ít sinh viên trong phòng thi phải "đứng hình". Là người trực tiếp dự thi, mình - TruongDevs - vừa ra khỏi phòng thi đã phải chia sẻ ngay để anh em FPTU biết độ “gắt” của môn này.
Trong bài viết này, mình sẽ chia sẻ đề thi SWT301 SU25 được lụm lặt trên internet chứ tui hỏng có dám cheat và kèm đáp án chi tiết (mang tính chất tham khảo), kèm theo vài cảm nhận cá nhân về mức độ khó, những câu hỏi gây “xoắn não” và kinh nghiệm rút ra cho các kỳ sau. Hy vọng bài viết lan tỏa tinh thần học thật, thi thật, giúp các bạn chuẩn bị kỹ hơn, không bị “hớ” như mình hôm nay.
Đề thi SWT301 SU25 - mã đề SWT301_SU25_PE1_190415
Instructions:
- You need to know at least one programming language to perform reasonably well on certain exam questions.
- Students are not allowed to use IDEs such as NetBeans, IntelliJ IDEA, or similar software to do the test.
- All the answers must be written in the provided template file, in English and reflect this exam paper. If your answers to the questions in this exam paper have any keywords not related to this electronic exam paper, the answers to the questions will get ZERO. If you do not use the provided template file to answer the exam you take today, your exam will get ZERO.
Question 1 (3 points)
Review the following class and find (at least) 6 issues in the code (i.e., coding practice, compile errors, potential logical issue, etc.) (Use question 1 template)
Steps for Matrix Multiplication in Java
- Define matrix dimensions – Ensure the number of columns in the first matrix matches the number of rows in the second matrix.
- Multiply and sum elements – For each element in the resulting matrix, take the dot product of the corresponding row from the first matrix and the column from the second matrix.
- Construct the result matrix – Place the computed values into their respective positions in the new matrix.
class matrixMultiplication {
public static int[][] multiplyMatrices(int[][] A, int[][] B) {
int m = A.length; int n = A[0].length; int p = B[0].length;
if (A[0].length = B.length)
throw new IllegalArgumentException("The number of columns of matrix A must equal the number of rows of matrix B.");
}
int[][] C = new int[m][p];
for (int i = 0; i < m; i++) {
for (int j = 0; j < p; j++) {
for (int k = 0; k < n; k++) {
C[i][j] = A[i][k] * B[k][j];
}
}
}
return C;
}
public static void printMatrix(int[][] matrix) {
for (int[] row : matrix) {
for (int val : row) {
System.out.print(val && " ");
}
System.out.println();
}
}
public static void main(String[] args) {
int[][] A = {{1, 2, 3}, {4, 5, 6}};
int[][] B = {{7, 8}, {9, 10}, {11, 12}};
int[][] C = multiplyMatrices(A, B);
System.out.println("Result Matrix:");
printMatrix(C);
}
}
Question 2 (3 points)
Assuming you are assigned to conduct the component test for the method below, please design and create the minimum component test cases (Unit Test case) needed to achieve 100% statement coverage and 100% decision coverage. (Use question 2 template)
public double calculateShippingFee(String size, double distance, String method) {
double ratePerSizePerKm;
switch (size.toLowerCase()) {
case "small":
ratePerSizePerKm = 1000;
break;
case "medium":
ratePerSizePerKm = 3000;
break;
case "large":
ratePerSizePerKm = 5000;
break;
default:
throw new IllegalArgumentException("Invalid Koi fish size");
}
double methodMultiplier;
switch (method.toLowerCase()) {
case "air":
methodMultiplier = 2.0;
break;
case "road":
methodMultiplier = 1.0;
break;
case "water":
methodMultiplier = 1.5;
break;
default:
throw new IllegalArgumentException("Invalid shipping method");
}
double shippingFee = distance * ratePerSizePerKm * methodMultiplier;
return shippingFee;
}
Question 3 (4 points)
You are assigned to do the functional (black-box) test for Calculating Food Amount function. Writing test cases for this function with the content described below. (Use question 3 template)
Function Description
This function is used to calculate the daily amount of food for Koi fish in the pond to help them grow well, prevent waste, and maintain water quality.
Screen Layout
![]() |
Đề thi câu 3 SWT301 - SU25 |
Function Detail:
- Total Fish Weight (kg): total weight of fish in the pond. This is a required field, number > 0.
- Water Temperature (°C): water temperature in the pond. This field is required and selected from the list with values as shown in Table 1.
- Feeding Rate (% of Fish Weight): feeding rate based on total weight of fish in the pond. This field is required, number >= 0.
-
When the user clicks the "Calculate" button, the system will perform the following actions sequentially:
- Check for valid data in Total Fish Weight (kg):
- If the field is empty, the system displays the error message "Total Fish Weight (kg) is required".
- If the data is invalid, the system displays the error message "Total Fish Weight (kg) is number > 0".
- Similar for Water Temperature (°C) and Feeding Rate (% of Fish Weight).
- Check for valid data in Feeding Rate based on Water Temperature as shown in Table 1:
- If the field is less than the value range, the system displays the error message "Daily food amount is not enough for fish".
- If the field is greater than the value range, the system displays the error message "Excess amount of food given to fish daily".
- If the field is within the value range, the system displays the corresponding message in the Notification column of Table 1.
- If the above conditions are met, the system displays the message "Total daily food amount of Koi pond: " + "Total Fish Weight (kg)" × "Feeding Rate" / 100 + " kg".
- Check for valid data in Total Fish Weight (kg):
Water Temperature (°C) | Feeding Rate (% of Fish Weight) | Notification |
---|---|---|
Below 10°C | 0% | Metabolism slows down; fish cannot digest well. |
10 - 15°C | 0.5 - 1% | Feed minimal, easily digestible food (wheat germ, algae). |
15 - 20°C | 1 - 2% | Reduce protein, focus on digestible food. |
20 - 25°C | 2 - 3% | Growth stage, increase protein. |
25 - 30°C | 3 - 5% | Fastest growth phase, requires high protein. |
Above 30°C | 2 - 3% | Fish eat less due to lower oxygen levels. |
Đáp án tham khảo đề thi PE SWT301 SU25
Question 1 Solution
Issue No | Description | Line | Detail |
---|---|---|---|
1 | Class name not following Java Naming Convention | 1 | class matrixMultiplication → Should be class MatrixMultiplication |
2 | Wrong operator used in if condition (assignment instead of comparison) | 5 | if (A[0].length = B.length) → Should be if (A[0].length != B.length) |
3 | Extra closing bracket '}' causes compile error | 6 | Remove extra } after throw statement |
4 | Wrong formula for matrix multiplication (value overwritten) | 12 | C[i][j] = A[i][k] * B[k][j]; → Should be C[i][j] += A[i][k] * B[k][j]; |
5 | Invalid use of logical operator when printing matrix | 22 | System.out.print(val && " "); → Should be System.out.print(val + " "); |
6 | No null or empty input validation for matrices | 3-5 | Add check: if (A == null || B == null || A.length == 0 || B.length == 0) throw new IllegalArgumentException(...); |
7 | Class should be public as per best practice | 1 | Should be declared as public class MatrixMultiplication |
8 | Variable names are not descriptive enough (coding style) | 3 | Use descriptive names: rowsA, colsA, colsB instead of m, n, p |
Question 2 Solution
![]() |
Đáp án câu 2 đề thi PE SWT301 SU25 mới nhất |
Question 3 Solution
ID | Test Case Description | Pre-Condition | Test Case Procedure | Expected Output | Result | Test date (dd/mm/yyyy) | Note |
---|---|---|---|---|---|---|---|
TC001 | Test valid input | Total Fish Weight=10kg, Water Temp=10-15°C, Feeding Rate=1% | 1. Input Weight=10kg 2. Select Temp=10-15°C 3. Input Rate=1% 4. Click Calculate |
Message: Total daily food amount of Koi pond: 10*1/100=0.1kg | Pass | 30-Jul | Normal Flow |
TC002 | Weight=0 | Weight=0, Temp=10-15°C, Rate=1% | 1. Input Weight=0 2. Select Temp=10-15°C 3. Input Rate=1% 4. Click Calculate |
Message: Total Fish Weight (kg) is number > 0 | Untest | 30-Jul | Normal Flow |
TC003 | Weight missing | No Weight, Temp=10-15°C, Rate=1% | 1. Leave Weight blank 2. Select Temp=10-15°C 3. Input Rate=1% 4. Click Calculate |
Message: Total Fish Weight (kg) is required | Untest | 30-Jul | Normal Flow |
TC004 | Temperature missing | Weight=5kg, No Temp, Rate=1% | 1. Input Weight=5kg 2. Leave Temp blank 3. Input Rate=1% 4. Click Calculate |
Message: Water Temperature is required | Untest | 30-Jul | Normal Flow |
TC005 | Feeding rate missing | Weight=5kg, Temp=20-25°C, No Rate | 1. Input Weight=5kg 2. Select Temp=20-25°C 3. Leave Rate blank 4. Click Calculate |
Message: Feeding Rate is required | Untest | 30-Jul | Normal Flow |
TC006 | Feeding rate negative | Weight=5kg, Temp=20-25°C, Rate=-1% | 1. Input Weight=5kg 2. Select Temp=20-25°C 3. Input Rate=-1% 4. Click Calculate |
Message: Feeding Rate must be number >=0 | Untest | 30-Jul | Normal Flow |
TC007 | Feeding rate too low | Weight=5kg, Temp=20-25°C, Rate=1% | 1. Input Weight=5kg 2. Select Temp=20-25°C 3. Input Rate=1% 4. Click Calculate |
Message: Daily food amount is not enough for fish | Pass | 30-Jul | Normal Flow |
TC008 | Feeding rate too high | Weight=5kg, Temp=20-25°C, Rate=6% | 1. Input Weight=5kg 2. Select Temp=20-25°C 3. Input Rate=6% 4. Click Calculate |
Message: Excess amount of food given to fish daily | Pass | 30-Jul | Normal Flow |
TC009 | Temp below 10°C valid rate | Weight=5kg, Temp<10°C, Rate=0% | 1. Input Weight=5kg 2. Select Temp<10°C 3. Input Rate=0% 4. Click Calculate |
Message: Metabolism slows down; fish cannot digest well | Pass | 30-Jul | Normal Flow |
TC010 | Temp 10-15°C valid rate | Weight=5kg, Temp=10-15°C, Rate=0.5% | 1. Input Weight=5kg 2. Select Temp=10-15°C 3. Input Rate=0.5% 4. Click Calculate |
Message: Feed minimal, easily digestible food (wheat germ, algae) | Pass | 30-Jul | Normal Flow |
TC011 | Temp 15-20°C valid rate | Weight=5kg, Temp=15-20°C, Rate=2% | 1. Input Weight=5kg 2. Select Temp=15-20°C 3. Input Rate=2% 4. Click Calculate |
Message: Reduce protein, focus on digestible food | Pass | 30-Jul | Normal Flow |
TC012 | Temp 20-25°C valid rate | Weight=5kg, Temp=20-25°C, Rate=2.5% | 1. Input Weight=5kg 2. Select Temp=20-25°C 3. Input Rate=2.5% 4. Click Calculate |
Message: Growth stage, increase protein | Pass | 30-Jul | Normal Flow |
TC013 | Temp 25-30°C valid rate | Weight=5kg, Temp=25-30°C, Rate=4% | 1. Input Weight=5kg 2. Select Temp=25-30°C 3. Input Rate=4% 4. Click Calculate |
Message: Fastest growth phase, requires high protein | Pass | 30-Jul | Normal Flow |
TC014 | Temp >30°C valid rate | Weight=5kg, Temp>30°C, Rate=3% | 1. Input Weight=5kg 2. Select Temp>30°C 3. Input Rate=3% 4. Click Calculate |
Message: Fish eat less due to lower oxygen levels | Pass | 30-Jul | Normal Flow |
Download file Excel đáp án đầy đủ
Bạn có thể tải đáp án đầy đủ ngay bên dưới!
DownloadKết luận
Bài viết trên đã tổng hợp đầy đủ Đề Thi SWT301 (Software Testing) Đại học FPT Kỳ SU25 chính thức, kèm theo đáp án chi tiết và dễ hiểu. Hy vọng tài liệu này sẽ giúp các bạn sinh viên ngành Công nghệ Thông tin nắm vững kiến thức môn kiểm thử phần mềm, luyện tập trước kỳ thi và đạt kết quả tốt nhất.
Đừng quên theo dõi Truongdevs.com để cập nhật thêm nhiều đề thi chính thức FPTU mới nhất, tài liệu ôn luyện, và mẹo học tập hiệu quả cho sinh viên IT.
Lưu ý:
Nội dung đáp án chỉ mang tính chất tham khảo cho nên không có việc chính xác 100%, mục đích là giúp định hướng ôn tập, không thay thế việc tự học và thực hành kiến thức môn học.
Trong quá trình trải nghiệm nếu có bất kỳ vấn đề gì các bạn hãy bình luận hoặc gửi form liên hệ để mình hỗ trợ kịp thời nhé! Cảm ơn các bạn thật nhiều.