Skip to content

Questions about Record (computer science)

Short answers, pulled from the story.

What is a record in computer science?

A record in computer science is a composite data structure made up of a collection of fields, which can differ in type but are typically fixed in number and sequence. It is also called a structure, struct, or user-defined type.

What is an example of a record in computer science?

A date can be stored as a record with a numeric year field, a month field represented as a string, and a numeric day-of-month field. A circle record can hold a numeric radius alongside a center point record with x and y coordinates.

How does a record differ from an array in computer science?

A record's fields are set by its definition and may be heterogeneous, holding different types, while an array is a collection of elements that all share the same type.

Which programming language was the first to widely support record types?

COBOL was the first widely used programming language to support record types, with sophisticated record definition facilities that included nested records and automatic field formatting.

When did Java and C# add record types to the language?

Java introduced records in Java 17, and C# introduced its own version of records as well, both aiming to simplify data aggregate classes with less boilerplate code.

What is the difference between a primary key and a secondary key in a computer science record?

A primary key is unique throughout all stored records, with no duplicates allowed, such as an employee number in an employee file. A secondary key, or alternate key, such as a department code, is not necessarily unique but can still be indexed to speed up lookups.