Elementary Data Types - scalar and composite types, properties of types and objects - One Line Questions
1.
Which of the following best describes a scalar data type in programming? —
A data type that represents a single, indivisible value.
2.
What is a composite data type? —
A data type formed by combining other data types.
3.
Consider a variable `pi` declared as `float`. The value `3.14159` is: —
An object (instance) of the `float` type.
4.
What is a 'struct' or 'record' in programming? —
A collection of elements of potentially different types.
5.
Which of the following best describes a 'composite type'? —
A type constructed from other types.
6.
A 'char' or 'character' data type typically holds: —
A single letter, symbol, or digit.
7.
The property defining the set of possible values for a `char` type typically includes: —
Characters, symbols, and control codes.
8.
In programming, what is the relationship between a 'type' and an 'object'? —
A type defines the characteristics, and an object is a concrete instance of that type.
9.
Which of the following is an example of a scalar data type? —
Integer
10.
Which of these is a common example of a composite data type? —
Array
11.
A pointer is often considered a _________ type, as it holds a memory address. —
Scalar
12.
A data type that is built directly into the programming language, like `int` or `bool`, is often referred to as a: —
Primitive type
13.
The specific value held by a variable at a particular moment in time is a property of the: —
Object (instance).
14.
In the context of data types, 'type safety' refers to: —
Preventing operations that are not valid for a given type.
15.
Which type typically represents true or false values? —
Boolean
16.
Which of the following data types is generally considered 'composite' because it can store a collection of elements? —
Array
17.
What is a defining characteristic of a type like `enum` (enumeration)? —
It represents a set of named scalar values.
18.
Which of the following is a defining characteristic of a 'composite' type? —
It is composed of other, simpler types.
19.
What is a fundamental property of a scalar type like an 'integer'? —
It represents a single whole number.
20.
A 'record' or 'struct' is a composite type because: —
It aggregates multiple fields, potentially of different types.
21.
Which of the following is a property of the `String` type in most languages? —
It is typically implemented as a sequence of characters.
22.
In many programming languages, what is the primary characteristic of a 'float' or 'double' type? —
It represents a number with a fractional part.
23.
Which programming construct allows grouping related data items, potentially of different types, under a single name, forming a composite type? —
Class or Structure
24.
When a program checks if an operation is valid for a given variable's type (e.g., dividing a string by a number), it is enforcing: —
Type safety.
25.
The ability to assign a value to a variable is an example of an: —
Type property (operation)
26.
The 'size' of a data type (e.g., number of bytes it occupies in memory) is considered one of its: —
Properties
27.
When we say an 'integer' type supports addition and subtraction, we are referring to its: —
Operations
28.
An array is generally considered a _________ data type. —
Composite
29.
A 'string' data type, often used to represent text, is usually considered a _________ type. —
Composite
30.
A 'tuple' in some programming languages is a _________ data type, similar to a fixed-size array or record. —
Composite
31.
A `struct` in C is a classic example of a _________ data type. —
Composite
32.
What is the fundamental difference between a scalar type and a composite type? —
Scalar types hold single, indivisible values; composite types are made up of other types.
33.
The set of operations like comparison (`<`, `>`, `==`) is a property of: —
The data type definition.
34.
The 'type' of a variable defines its: —
Allowed values and operations.
35.
Which of the following is an example of a scalar type in C++? —
int
36.
The property that defines the set of all possible values a variable of a certain type can hold is known as its: —
Range
37.
The 'behavior' of a data type, such as what operations can be performed on it, is part of its: —
Properties (Semantics)
38.
What does 'properties of objects' typically encompass? —
The specific value held by a variable and its current state.
39.
In programming, what are the 'properties of types' referring to? —
The set of values a type can hold and the operations that can be performed on them.
40.
When discussing 'objects', their 'state' typically refers to: —
The specific values held by the object's attributes at a given time.
41.
Which of the following is NOT a property of a data type? —
The memory location of a specific variable of that type.
42.
Which of the following is a common property that varies between different integer types (e.g., `short`, `int`, `long`)? —
The range of values they can represent.
43.
Consider a variable `age` declared as an integer. The value `30` assigned to `age` represents: —
An object (instance) of the 'integer' type.
44.
What distinguishes an 'object' from a 'type' in object-oriented programming, concerning properties? —
The type defines the structure and behavior; the object is an instance with specific data.
45.
Which of the following is a common characteristic of 'scalar' types across different programming languages? —
They represent single, atomic values.
46.
What is the main difference between a 'type' and an 'object' (or variable) in terms of properties? —
Types define rules; objects are instances that follow the rules.
47.
Which term describes a data type that is not explicitly defined by the user but is provided by the programming language itself? —
Built-in type
48.
What is a key property of scalar types regarding their values? —
Values are atomic and cannot be broken down further.
49.
Which programming language concept allows a single name to refer to multiple values, often of the same type, arranged in a sequence? —
Array
50.
The concept of 'type compatibility' relates to: —
Whether values of one type can be used where a value of another type is expected.