

Asas Sains Komputer Tingkatan 3
Presentation
•
Computers
•
4th - 5th Grade
•
Practice Problem
•
Hard
CHEGU AINUN NAJWA AZIZ
Used 5+ times
FREE Resource
5 Slides • 2 Questions
1
Perbezaan Pemboleh Ubah Sejagat & Setempat
Pemboleh ubah dan pemalar mungkin wujud dan akan digunakan untuk keseluruhan atur cara atau hanya bgai satu fungsi.Pembolehubah dan pemalar bagi pengaturcara terdiri daripada 2 skop iaitu :

2
Pemboleh ubah Sejagat (Global)
Hanya berfungsi dalam atur cara sahaja
Penggunaannya hanya lah SEMASA dalam fungsi atur cara sahaja. Apabila tatacara itu telah tamat, ruang memori yang diperuntukkan kepada pemboleh ubah & pemalar juga akan tamat.
3
Pemboleh ubah Setempat
Hanya berfungsi dalam subatur cara yang diisytiharkan.
Digunakan dalam fungsi 'di mana' pemboleh ubah diisytiharkan, bermula 'dari mana' pemboleh ubah diisytiharkan dan bila penamat akhir tatacara tersebut.
4
5
Contoh aturcara yang menggunakan p/ubah sejagat dan setempat
public class A {
int data = 50 ;
static int m = 100 ; ---------> pemboleh ubah sejagat
public static void main ( String [] args) { ;
int n= 90 ; ------------> pemboleh ubah setempat
}
} //end of class
6
Multiple Select
Berdasarkan atur cara di bawah, nyatakan jenis pemboleh ubah tersebut.
public class info {
static int k= 5; -----> pemboleh ubah ________
public static void main ( string[] arg) {
int m = 7; ---------> pemboleh ubah __________
sejagat
semua
setempat
kekal
7
Multiple Choice
Kenalpasti jenis pemboleh ubah dalam aturcara di bawah.
public class A {
static int nombor = 10 ;
double data = 50; ------------->p/ubah ??????
public static void main (String[] args) {
int n = 90;
int t = 190;
}
}
setempat
sejagat
nominal
biasa
Perbezaan Pemboleh Ubah Sejagat & Setempat
Pemboleh ubah dan pemalar mungkin wujud dan akan digunakan untuk keseluruhan atur cara atau hanya bgai satu fungsi.Pembolehubah dan pemalar bagi pengaturcara terdiri daripada 2 skop iaitu :

Show answer
Auto Play
Slide 1 / 7
SLIDE
Similar Resources on Wayground
7 questions
wujud benda
Presentation
•
3rd Grade
6 questions
IMBAS KEMBALI
Presentation
•
4th - 6th Grade
6 questions
IPS Keberagaman Budaya
Presentation
•
4th Grade
7 questions
The Pod Building Background
Presentation
•
5th - 6th Grade
8 questions
Keragaman Tarian Indonesia
Presentation
•
4th Grade
11 questions
Mengenal Kode Sensor , Variabel dan Operator
Presentation
•
5th Grade
12 questions
Photosynthesis
Presentation
•
4th Grade
11 questions
STEM - Electricity
Presentation
•
4th Grade
Popular Resources on Wayground
16 questions
Grade 3 Simulation Assessment 2
Quiz
•
3rd Grade
19 questions
HCS Grade 5 Simulation Assessment_1 2526sy
Quiz
•
5th Grade
10 questions
Cinco de Mayo Trivia Questions
Interactive video
•
3rd - 5th Grade
17 questions
HCS Grade 4 Simulation Assessment_2 2526sy
Quiz
•
4th Grade
24 questions
HCS Grade 5 Simulation Assessment_2 2526sy
Quiz
•
5th Grade
13 questions
Cinco de mayo
Interactive video
•
6th - 8th Grade
20 questions
Math Review
Quiz
•
3rd Grade
30 questions
GVMS House Trivia 2026
Quiz
•
6th - 8th Grade