CompTIA Tech+ (FC0-U71)Software Development ConceptsMedium

A developer is writing a program to manage a list of tasks. Each task has a name, a due date, and a priority level. The developer wants to group these three pieces of information together so they can be treated as a single unit. Which programming concept is best suited for this?

  1. AA global variable
  2. BA simple array
  3. CAn object or struct
  4. DA nested loop
Show answer & explanation

Correct answer: C. An object or struct

An object (in object-oriented programming) or a struct (in other paradigms) allows you to encapsulate related data (attributes or properties) and sometimes functions (methods) into a single, cohesive unit. This perfectly suits the need to group a task's name, due date, and priority.

Why the other options are wrong

  • A. A global variable is about variable scope, not about grouping related data fields together.
  • B. A simple array can store multiple items but doesn't inherently group different types of related data under meaningful labels.
  • D. A nested loop is a control structure for iteration, not a data structuring concept.

Object/Struct

An object (or struct) is a composite data type that bundles data (attributes or properties) and/or methods (functions) into a single unit. It represents a real-world entity or concept within a program.

  • Encapsulates related data
  • Can include functions (methods)
  • Provides a blueprint (class) for creating instances

Memory trick: To group data into one, make an Object, it's done!

More Software Development Concepts questions