Bitzu

FC0-U71 ยท Software development concepts

Functions and objects

Reusable functions with parameters and return values, and objects with properties and methods (object-oriented ideas).

Key points

  • A function is a named, reusable block of code.
  • It can take parameters (inputs) and may return a value to the caller.
  • An object bundles related data (properties) with actions (methods) in one unit, for example a car with the property color and the method accelerate().
  • A class is the blueprint, and each object created from it is an instance.
  • Object-oriented methods organize programs around such objects.

Practice questions

Single choice

What are the named inputs listed in a function's definition called?

  1. Properties
  2. Loops
  3. Constants
  4. Parameters
Show answer

Answer: D. Parameters

Parameters are the named placeholders for values a function receives. Properties belong to objects, and loops repeat code.

Select all that apply

Which of these are properties (data) of a Car object?

  1. color
  2. currentSpeed
  3. fuelLevel
  4. start()
  5. brake()
Show answer

Answer: A. color, B. currentSpeed, C. fuelLevel

Properties store the state of an object: color, speed and fuel. start() and brake() are actions, so they are methods.

True or false

True or false: every function must return a value to its caller.

Show answer

Answer: False

False. Some functions only perform an action, such as printing a message, and return nothing useful.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More FC0-U71 topics in this module