NEW
Font size
WorksheetsASK FORM 2
Total questions: 56
Worksheet time: 28mins
Which of the following is another name for the octal number system?
Binary
Octal
Decimal
Hexadecimal
Which of the following is a hexadecimal number?
92H base 16
81K4 base 16
L25 base 16
BE4 base 16
Refer to the ASCII code table showing the mappings for H to M: for each character, the table lists decimal, binary, octal, and hexadecimal values. For example, H is shown as decimal 72, binary 01001000, octal 110, and hexadecimal 48; I is 73, 01001001, 111, 49; J is 74, 01001010, 112, 4A; K is 75, 01001011, 113, 4B; L is 76, 01001100, 114, 4C; M is 77, 01001101, 115, 4D. What hexadecimal number is represented by the ASCII code for the letter K?
75
4B
113
01001011
The flowchart shows a loop that: starts, prompts to input y, sets y to the entered number, checks the decision "y bukan abjad?" (y is not a letter?). If Yes, it loops back to input; if No, it ends. What loop control structure is involved?
if
for
while
repeat-until
The following are steps for finding errors in a program, but they are not in order. I Re-run the program II Fix the error III Perform a desk check IV Compare the program’s results with the algorithm Arrange these steps in the correct order.
I, II, III, IV
II, III, IV, I
III, IV, I, II
IV, III, II, I
The table explains the difference between a variable and a constant. Under Constant it says "Has a fixed value and does not change" and under Variable it shows X. What is X?
Has a value that can change
Has a value defined by a formula
Has a value that can be computed
Has a positive value
The following code segments for computing the volume of a cone are not in order. Choose the correct order. I jejari = int(input("Masukkan jejari:")) tinggi = int(input("Masukkan tinggi:")) II print("Isipadu kon ialah", round(isipadu, 2)) III pi = 3.142 IV isipadu = 1 / 3 * pi * jejari**2 * tinggi
II, I, III, IV
II, III, I, IV
III, I, IV, II
IV, III, II, I
What type of error occurs in the following code segment? a = int(12) b = int(0) c = a / b print(c)
Runtime error
Syntax error
Logic error
Carelessness error
The flowchart shows two decisions in sequence: First, "Syarat 1 dipenuhi?" (Condition 1 met?). If Yes, it checks "Syarat 2 dipenuhi?". If the second answer is No, "Pernyataan 1" executes; if Yes, "Pernyataan 2" executes. What is the control structure?
Sequence control structure
Selection control structure
Iteration control structure
Nested selection control structure
The following are steps for testing and debugging a program, but they are not in order. P Develop the program code Q Actual output obtained R Fix the program code S Error message displayed Arrange these steps in the correct order.
P, Q, R, S
Q, P, S, R
P, S, R, Q
Q, S, R, P
Berikut menunjukkan jadual penukaran nombor perlapangan kepada nombor perpuluhan untuk 3614 dalam asas 8. Nilai tempat digit perlapangan bagi 83 ialah berapa?
83 = 512
83 = 256
83 = 128
83 = 1024
Merujuk jadual penukaran bagi 3614 dalam asas 8, digit bagi lajur 8^2 ialah berapa?
6
3
1
4
Merujuk jadual penukaran bagi 3614 dalam asas 8, hasil darab untuk lajur 83 ialah berapa?
1536
512
384
1920
Berdasarkan jadual penukaran bagi 3614 dalam asas 8, jumlah ‘Hasil tambah’ dalam perpuluhan ialah berapa?
1932
1928
1940
1832
Nyatakan sama ada kenyataan ini BENAR atau PALSU: Bahasa Mesin dikenali sebagai kod mesin yang terdiri daripada urutan digit 0 dan 1, iaitu nombor perduaan.
Benar
Palsu
Nyatakan sama ada kenyataan ini BENAR atau PALSU: ASC11 ialah singkatan bagi American Standard Code for Internet Information.
Benar
Palsu
Nyatakan sama ada kenyataan ini BENAR atau PALSU: Bahagi dengan 8 dan gunakan bakinya.
Benar
Palsu
Nyatakan sama ada kenyataan ini BENAR atau PALSU: Mendarab digit dalam nombor perlapangan dengan nilai tempat nombor perlapangan.
Benar
Palsu
Nyatakan sama ada kenyataan ini BENAR atau PALSU: Bahagi dengan 16 dan gunakan bakinya.
Benar
Palsu
Nyatakan sama ada kenyataan ini BENAR atau PALSU: Pengumpulan tiga digit nombor perduaan dan tukarkan kepada nilai penilaian.
Benar
Palsu
Isikan tempat kosong: Manusia menggunakan sistem nombor …
perpuluhan
perduaan
ASCII
Code for Information Interchange
Isikan tempat kosong: Komputer menggunakan sistem nombor …
perduaan
perpuluhan
ASCII
Code for Information Interchange
Isikan tempat kosong: Kod yang mewakili setiap aksara pada papan kekunci dikenali sebagai …
ASCII
perduaan
perpuluhan
Code for Information Interchange
Isikan tempat kosong: Kod … adalah singkatan kepada American Standard …
ASCII; Code for Information Interchange
ASCII; Computer Information Index
perduaan; Code for Internet Information
perpuluhan; Character Input Interface
Rajah 1 menunjukkan atur cara mengira luas dan perimeter sebuah padang bola. Pilih pembetulan ralat logik yang betul bagi pengiraan perimeter.
perimeter = 2*(panjang + lebar)
perimeter = panjang * lebar
perimeter = panjang + lebar
perimeter = 2*panjang*lebar
Merujuk Rajah 1, apakah pembetulan yang betul untuk baris output perimeter?
Cetak pemboleh ubah perimeter: print("\n \n Perimeter padang bola ialah ", perimeter)
Cetak pemboleh ubah luas: print("\n \n Perimeter padang bola ialah ", luas)
Buang baris cetakan perimeter sepenuhnya
Tukar mesej kepada ‘Luas padang bola’ tanpa nilai
Pilih jenis ralat yang betul: Kesilapan dalam penggunaan bahasa pengaturcaraan.
Ralat sintaks
Ralat logik
Ralat masa larian
Pilih jenis ralat yang betul: Kesilapan semasa pembinaan algoritma dan ralat sukar dikesan kerana tiada paparan mesej ralat.
Ralat logik
Ralat sintaks
Ralat masa larian
Pilih jenis ralat yang betul: Kesilapan yang menyebabkan atur cara terhenti secara tiba-tiba tanpa diduga semasa ujian dijalankan.
Ralat masa larian
Ralat logik
Ralat sintaks
Tentukan sama ada padanan ini betul atau salah: print = float(input("Masukkan nama anda")) dipadankan dengan Ralat sintaks.
Betul
Salah
Tentukan sama ada padanan ini betul atau salah: x = a / 0 dipadankan dengan Ralat masa larian.
Betul
Salah
Tentukan sama ada padanan ini betul atau salah: bmi = berat*tinggi dipadankan dengan Ralat logik.
Betul
Salah
Tentukan sama ada padanan ini betul atau salah: c = str(a) + int(b) dipadankan dengan Ralat sintaks.
Betul
Salah
Lengkapkan atur cara yang menerima input nama, umur, serta mengira BMI berdasarkan tinggi dan berat. Pilih nilai yang betul untuk A dalam baris: nama = ……A…… (input("Masukkan nama anda: ")).
str
float
int
bmi
Lengkapkan atur cara. Pilih nilai yang betul untuk B dalam baris: berat = ………B…… (input("Masukkan berat anda dalam kg:"))
float
int
str
bmi
Lengkapkan atur cara. Pilih nama pemboleh ubah yang betul untuk C dalam baris: ……C…. = berat / (tinggi*tinggi)
bmi
nama
umur
berat
Lengkapkan atur cara. Pilih nilai yang betul untuk D dalam baris: print("Nama anda ialah", ……D……)
nama
bmi
umur
tinggi
The following box shows the exact output of a code segment: Output Berat pelajar 1:60 Berat pelajar 2 : 55 Purata berat pelajar dalam kg ialah:57.5 Based on this output, which code segment would correctly produce it?
print("Output")\nprint("Berat pelajar 1:60")\nprint("Berat pelajar 2 : 55")\nw1 = 60\nw2 = 55\npurata = (w1 + w2) / 2\nprint("Purata berat pelajar dalam kg ialah:" + str(purata))
w1 = 60\nw2 = 55\nprint("Output")\nprint("Berat pelajar 1 :", w1)\nprint("Berat pelajar 2 :", w2)\nprint("Purata berat pelajar dalam kg ialah:", (w1 + w2) / 2)
print("Output")\nw1 = input("Berat pelajar 1:")\nw2 = input("Berat pelajar 2 : ")\nprint("Purata berat pelajar dalam kg ialah:" + (w1 + w2) / 2)
print("Output")\nw1 = 60\nw2 = 55\npurata = (w1 + w2) // 2\nprint("Berat pelajar 1:60")\nprint("Berat pelajar 2 : 55")\nprint("Purata berat pelajar dalam kg ialah:" + str(purata))
A program displays quiz eligibility for a school prefect selection. It begins with this line: print("Atur cara memaparkan keputusan kuiz kelayakan pengawas.") The partially completed code uses placeholders P, Q, R, and S: markah = 1 while markah != 0: markah = Q(input("Masukkan satu nombor integer : ")) if markah == 0: R elif markah > 49: print("Tahniah, anda layak") S print("Maaf, anda tidak layak") Which statement should replace P to match the program’s on-screen guidance shown in the output box that says to enter 0 to stop?
print('Masukkan nombor SIFAR "0" jika ingin berhenti')
input('Masukkan nombor SIFAR "0" jika ingin berhenti')
markah = 0
print('Masukkan nombor SATU "1" jika ingin berhenti')
In the same partially completed program for displaying quiz eligibility (see code skeleton in the previous question), which built-in should replace Q so numerical input is read correctly for comparisons?
int
float
str
bool
In the same program, when the user enters 0, the program should thank the user before stopping. Which statement should replace R?
print("Terima kasih")
print("Maaf, anda tidak layak")
print("Tahniah, anda layak")
break
In the same program, after checking 'elif markah > 49', the code should ensure that the message 'Maaf, anda tidak layak' is printed for all other nonzero scores. Which keyword should replace S?
else:
if markah < 50:
elif markah <= 49:
continue
The following code segment is intended to find the average body weight of two pupils but contains errors (three circled regions in the image): m1 = float (input ("Masukkan berat (kg) murid 1 :") ) m2 = float ( ("Masukkan berat (kg) murid 1 :") ) purata = m + m / 2 print("Berat badan (kg)") print("Purata berat badan : ", round (purata, 1),"kg") Which correction best fixes the second assignment so the second pupil’s weight is read properly?
m2 = float(input("Masukkan berat (kg) murid 2 :"))
m2 = input(float("Masukkan berat (kg) murid 2 :"))
m2 = int(input("Masukkan berat (kg) murid 1 :"))
m2 = float("Masukkan berat (kg) murid 2 :")
In the same code, which replacement correctly computes the average of the two weights? The faulty line is 'purata = m + m / 2'.
purata = (m1 + m2) / 2
purata = m1 + m2 / 2
purata = (m1 * m2) / 2
purata = m1 / m2
In the same code, the final output should clearly display the rounded average with units. Which corrected print statement best meets this requirement?
print("Purata berat badan (kg):", round(purata, 1))
print("Purata berat badan:", purata, "kg", 1)
print("Purata berat badan (kg)" + round(purata, 1))
print(round(purata, 1))
The following table lists equivalent numbers used in data representation: Decimal number 897610 ; Hexadecimal number 231016 ; Binary number 00100011000100002 . State one use of the hexadecimal number system.
Encoding colors in web design such as #FF00AA
Measuring temperature on the Celsius scale
Writing paragraphs in natural language
Mixing audio waveforms in a DAW
Using the divide-by-16 method and remainders, determine the hexadecimal representation that is equivalent to the decimal number 897610 .
231016
239016
23A016
221016
Using four-bit grouping, determine the binary representation that is equivalent to the hexadecimal number 231016 .
00100011000100002
00100011000010002
00010011000100002
00100011100100002
The following program displays a comparison of a number entered by the user: nom=int(input("Masukkan nombor 1-9 : ")) if nom>0 and nom<5: print("Nombor adalah lebih kecil daripada 5.") elif nom ==5: print("Nombor adalah 5.") elif nom > 5 and nom <10: print("Nombor adalah lebih besar daripada 5.") else: print("Nombor bukan dalam lingkungan 1-9.") Identify the control structure used in this program.
Selection using if–elif–else
Definite iteration using for-loop
Recursion with a function call
Sequential execution without branches
Based on the program shown, what output is printed when the input is 6 ?
Number is greater than 5.
Number is less than 5.
Number is 5.
Number is not in the range 1-9.
Based on the program shown, what output is printed when the input is 0 ?
Number is not in the range 1-9.
Number is less than 5.
Number is greater than 5.
Number is 5.
Based on the program shown, what output is printed when the input is 11 ?
Number is not in the range 1-9.
Number is less than 5.
Number is greater than 5.
Number is 5.
Based on the program shown, what output is printed when the input is 2 ?
Number is less than 5.
Number is greater than 5.
Number is 5.
Number is not in the range 1-9.
A formula is provided for the surface area of a sphere: Surface area =4πj where π=3.142 and j is the radius. Based on this formula, which assignment correctly sets the value of the constant for π in code?
pi = 3.142
pi = 22/7 exactly
pi = 3.0
pi = "3.142" (a string)
Using the same sphere formula and constants given, which code line best computes the variable luas_sfera (surface area) from the radius variable jejari?
luas_sfera = 4*pi*jejari*jejari
luas_sfera = 2*pi*jejari
luas_sfera = pi*jejari*jejari
luas_sfera = (4/3)*pi*jejari*jejari*jejari
Which print statement correctly displays the computed surface area stored in luas_sfera?
print("Surface area is", luas_sfera)
print("Surface area is" + luas_sfera)
print(luas_sfera, "is the surface area", jejari)
print("Surface area:")
