Docsity

PYTHON PROGRAMMING: VARIABLES, DATA TYPES, AND FUNCTIONS ACTUAL QUESTIONS AND CORRECT ANSW, Exams of Medicine

Toggle sidebar
bg1
1
PYTHON PROGRAMMING: VARIABLES, DATA TYPES, AND
FUNCTIONS ACTUAL QUESTIONS AND CORRECT ANSWERS
1. Question: Variable
Answer: A named item such as "x" or "num_people" that holds
a value.
2. Question: Assignment statement
Answer: Assigns a variable with a value (e.g., x = 5). Left side
must be a variable, right side can be an expression.
3. Question: Incrementing
Answer: Increasing a variable's value by 1 (e.g., x = x + 1).
4. Question: Identifiers (name)
Answer: A sequence of letters, digits, and underscores (must
start with a letter or underscore, no punctuation).
Used for naming variables, functions, etc.
5. Question: Reverse words (keywords)
Answer: Reserved words that are part of the programming
language and cannot be used as identifiers.
6. Question: Object
Answer: Represents a value and is automatically created by
the interpreter (e.g., x = 4 creates an object
representing 4).
7. Question: Properties of an Object
Answer: Characteristics that describe an object: value, type,
mutability, and identity.
8. Question: Value (object property)
Answer: The actual data associated with the object (e.g., 20,
"abc", 55).
9. Question: Type (object property)
Answer: The kind of object, such as a string or integer.
pf3
pf4

Partial preview of the text

Download PYTHON PROGRAMMING: VARIABLES, DATA TYPES, AND FUNCTIONS ACTUAL QUESTIONS AND CORRECT ANSW and more Exams Medicine in PDF only on Docsity!

PYTHON PROGRAMMING: VARIABLES, DATA TYPES, AND

FUNCTIONS ACTUAL QUESTIONS AND CORRECT ANSWERS

  1. Question: Variable Answer: A named item such as "x" or "num_people" that holds a value.
  2. Question: Assignment statement Answer: Assigns a variable with a value (e.g., x = 5). Left side must be a variable, right side can be an expression.
  3. Question: Incrementing Answer: Increasing a variable's value by 1 (e.g., x = x + 1).
  4. Question: Identifiers (name) Answer: A sequence of letters, digits, and underscores (must start with a letter or underscore, no punctuation). Used for naming variables, functions, etc.
  5. Question: Reverse words (keywords) Answer: Reserved words that are part of the programming language and cannot be used as identifiers.
  6. Question: Object Answer: Represents a value and is automatically created by the interpreter (e.g., x = 4 creates an object representing 4).
  7. Question: Properties of an Object Answer: Characteristics that describe an object: value, type, mutability, and identity.
  8. Question: Value (object property) Answer: The actual data associated with the object (e.g., 20, "abc", 55).
  9. Question: Type (object property) Answer: The kind of object, such as a string or integer.
  1. Question: Mutability Answer: Indicates if an object's value can be changed. (Strings and integers are immutable.)
  2. Question: Identity Answer: A unique identifier that describes an object. Every object has its own number identifier.
  3. Question: Garbage Collection Answer: Automatic process of deleting unused objects to free memory space.
  4. Question: Name Binding Answer: The process of associating names with interpreter objects. An object can have more than one name bound to it.
  5. Question: Floating point Answer: A real number containing a decimal (e.g., 98.0, -88888.111).
  6. Question: Floating point literal Answer: Written with a fractional part, even if that fraction is 0 (e.g., 0.0, 1.0).
  7. Question: Overflow Answer: Occurs when a value is too large to fit in memory (e.g., trying to store 2.0^1024).
  8. Question: Expression Answer: A combination of items (variables, literals, operators) that evaluates to a value.
  9. Question: Literal Answer: A specific value in code (e.g., 2).
  10. Question: Operator Answer: A symbol that performs a built-in calculation (e.g., +, -, ** for exponent).
  1. Question: randrange() Answer: Generates random integers within a specified range.
  2. Question: Unicode Answer: Represents every possible character as a unique number (code point).
  3. Question: Newline character Answer: Indicates the end of a line of text (\n).