πŸ’‘ Activity Solution

πŸ’‘ Activity Solution


1️⃣ What is a Variable, and why do we need it?

  • A variable is a container in memory that stores data temporarily while the program runs.
  • We need it to hold, update, and reuse information such as names, numbers, or results.


2️⃣ What is a Constant, and why do we need it?

  • A constant is a read-only container whose value cannot change once assigned.
  • We need it to protect fixed values (like Ο€ = 3.14) from being modified accidentally.


3️⃣ What is a Memory Cell?

  • A memory cell is a small storage unit in RAM that holds the binary bits of a variable’s value.


4️⃣ What is an Identifier?

  • An identifier is the name given to a variable or constant so the programmer can refer to it easily (e.g., Age, PI).


5️⃣ What is a Memory Address, and what is its relation to location in memory?

  • A memory address is the exact location of a memory cell inside the computer’s RAM.
  • Each variable is stored at a unique address β€” just like houses have unique addresses.


6️⃣ Which numbering system is used to represent memory addresses?

  • Memory addresses are represented in hexadecimal (base 16) form, e.g., 0x7FFF89A2.


7️⃣ Mention the primary types of variables.

  • Integer (Int) β†’ whole numbers (e.g., 25)
  • Float/Double β†’ decimal numbers (e.g., 3.14)
  • String β†’ text (e.g., "Omar")
  • Boolean β†’ True/False (e.g., True)


8️⃣ What are the number types, and give examples for each.

  • Integer (Int): Whole numbers (e.g., βˆ’10, 0, 150)
  • Float (Decimal): Numbers with fractions (e.g., 3.5, 7.25)


9️⃣ What is a String, and give an example of it.

  • A String stores text or characters, written between quotation marks.
    Example: "Hello World" or "Mohammed".


πŸ”Ÿ What is a Boolean, and give an example of it.

  • A Boolean represents True or False values used in decisions.
  • Example: IsStudent = True or HasLicense = False.


Complete and Continue  
Discussion

5 comments