๐Ÿ’ก 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

0 comments