QUESTION 1
An array of nums stores the following values in the range of 1-5:
Write a Java program to store the above values in the array. Then, the following output will be produced by the program. Your program must use a loop and selection structure such as if-else.
1: 0
2: 1
3: 2
4: 3
5: 1
[Explanation about the output: There are no 1’s in the array nums, there is one 2, there are two 3’s, there are three 4’s, and there is one 5]
Suatu tatasusunan nums menyimpan nilai-nilai berikut dalam julat 1-5:
Tuliskan satu aturcara Java untuk menyimpan semua nilai di atas dalam tatasusunan. Kemudian, output berikut akan dipaparkan oleh aturcara ini. Aturcara anda mesti menggunakan gelung dan struktur pilihan seperti if-else.
1: 0
2: 1
3: 2
4: 3
5: 1
[Penjelasan berkenaan output: Tiada nilai 1 dalam tatasusunan nums, terdapat satu 2, ada dua 3, tiga 4 dan satu 5]
QUESTION 2
Complete the THREE tasks below/ Lengkapkan TIGA task berikut.
TASK 1
On the course page of this course in my inspire, click “Explore 1” as shown below.
Then, do the following activities:
Do the Pre-Test (1)
- There will be 5 MCQ questions
- You need to answer one question at a time.
- Time limit: 3 minutes with a single attempt per question
- No marks for the pre-test. It is merely for self-assessmentExplore the “explorelet”
- Complete the lesson
- Put your reflection (for example share what you have learned) and/or question and try to answer questions of your peers. You may post more than one message
- Note: “explore” will only appear after you have completed the above pre-testFinally, do the Post-Test (1) (5 marks)
- There will be 5 MCQ questions. In order to score good marks, ensure that you have first interacted with the explore
- You need to answer one question at a time
- Time limit: 3 minutes with a single attempt per question
Note: The post-test will only appear after you have completed the pre-test and “explorelet”