Elementary Data Types - scalar and composite types, properties of types and objects - Question Bank

1. The specific value held by a variable at a particular moment in time is a property of the:
A) Data type definition.
B) Object (instance).
C) Programming language compiler.
D) Memory address.
2. Which of the following data types is generally considered 'composite' because it can store a collection of elements?
A) Integer
B) Boolean
C) Array
D) Character
3. The 'behavior' of a data type, such as what operations can be performed on it, is part of its:
A) Syntax
B) Values
C) Properties (Semantics)
D) Name
4. What is the fundamental difference between a scalar type and a composite type?
A) Scalar types hold multiple values; composite types hold single values.
B) Scalar types hold single, indivisible values; composite types are made up of other types.
C) Scalar types are user-defined; composite types are built-in.
D) Scalar types are used for text; composite types are used for numbers.
5. 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:
A) Memory management.
B) Type safety.
C) Syntax rules.
D) Object identity.
6. The property defining the set of possible values for a `char` type typically includes:
A) All integers.
B) All floating-point numbers.
C) Characters, symbols, and control codes.
D) Boolean values only.
7. A `struct` in C is a classic example of a _________ data type.
A) Scalar
B) Primitive
C) Composite
D) Boolean
8. Which of the following is an example of a scalar type in C++?
A) std::vector
B) std::string
C) int
D) std::map
9. In programming, what is the relationship between a 'type' and an 'object'?
A) An object is a blueprint for a type.
B) A type is an instance of an object.
C) A type defines the characteristics, and an object is a concrete instance of that type.
D) Types and objects are synonymous.
10. The 'type' of a variable defines its:
A) Specific value at runtime.
B) Memory address.
C) Allowed values and operations.
D) Scope.
11. Which of the following best describes a 'composite type'?
A) A type representing a single fundamental value.
B) A type that cannot be manipulated directly.
C) A type constructed from other types.
D) A type limited to two possible values.
12. The set of operations like comparison (`<`, `>`, `==`) is a property of:
A) Specific objects only.
B) The data type definition.
C) Memory allocation.
D) Variable names.
13. A 'record' or 'struct' is a composite type because:
A) It holds a single, indivisible value.
B) It is defined by a sequence of elements of the same type.
C) It aggregates multiple fields, potentially of different types.
D) It is limited to storing only true or false.
14. What is a key property of scalar types regarding their values?
A) Values can be arbitrarily complex combinations of other types.
B) Values are atomic and cannot be broken down further.
C) Values are always represented as sequences.
D) Values are restricted to only boolean.
15. Consider a variable `pi` declared as `float`. The value `3.14159` is:
A) A property of the `float` type.
B) An object (instance) of the `float` type.
C) The definition of the `float` type.
D) The range of the `float` type.
16. Which term describes a data type that is not explicitly defined by the user but is provided by the programming language itself?
A) User-defined type
B) Abstract data type
C) Built-in type
D) Composite type
17. The concept of 'type compatibility' relates to:
A) Whether two types have the same name.
B) Whether values of one type can be used where a value of another type is expected.
C) The number of operations supported by two types.
D) The memory size of two types.
18. A 'tuple' in some programming languages is a _________ data type, similar to a fixed-size array or record.
A) Scalar
B) Primitive
C) Composite
D) Boolean
19. Which of the following is a property of the `String` type in most languages?
A) It represents a single, indivisible value.
B) It is typically implemented as a sequence of characters.
C) It can only hold numerical values.
D) It is always a fixed size.
20. When discussing 'objects', their 'state' typically refers to:
A) The methods available to the object.
B) The specific values held by the object's attributes at a given time.
C) The class definition from which the object was created.
D) The memory address of the object.
21. What is a defining characteristic of a type like `enum` (enumeration)?
A) It can hold any numerical value.
B) It represents a set of named scalar values.
C) It is inherently a composite type.
D) It is primarily used for floating-point calculations.
22. The ability to assign a value to a variable is an example of an:
A) Object property
B) Type property (operation)
C) Type definition
D) Object state
23. Which programming construct allows grouping related data items, potentially of different types, under a single name, forming a composite type?
A) Loop
B) Conditional statement
C) Class or Structure
D) Function
24. A pointer is often considered a _________ type, as it holds a memory address.
A) Composite
B) Scalar
C) Boolean
D) String
25. Which of the following is a common property that varies between different integer types (e.g., `short`, `int`, `long`)?
A) The set of operations they support (e.g., addition).
B) The range of values they can represent.
C) Whether they are scalar or composite.
D) Their fundamental purpose (representing whole numbers).
26. In the context of data types, 'type safety' refers to:
A) Ensuring all variables are initialized.
B) Preventing operations that are not valid for a given type.
C) Limiting the number of composite types allowed.
D) Guaranteeing that scalar types can be converted to composite types.
27. What is the main difference between a 'type' and an 'object' (or variable) in terms of properties?
A) Types define rules; objects are instances that follow the rules.
B) Objects define rules; types are instances that follow the rules.
C) Types are always scalar; objects are always composite.
D) Objects have a fixed set of operations; types have a variable set.
28. The 'size' of a data type (e.g., number of bytes it occupies in memory) is considered one of its:
A) Operations
B) Values
C) Properties
D) Syntax
29. Which of the following is a defining characteristic of a 'composite' type?
A) It can only hold one value.
B) Its definition is solely based on its name.
C) It is composed of other, simpler types.
D) It is limited to numerical values.
30. A data type that is built directly into the programming language, like `int` or `bool`, is often referred to as a:
A) Composite type
B) User-defined type
C) Primitive type
D) Abstract type
31. Which of the following is a common characteristic of 'scalar' types across different programming languages?
A) They are always user-defined.
B) They represent single, atomic values.
C) They are exclusively used for text manipulation.
D) They are always implemented as collections.
32. Consider a variable `age` declared as an integer. The value `30` assigned to `age` represents:
A) The type 'integer'.
B) A property of the 'integer' type.
C) An object (instance) of the 'integer' type.
D) The range of the 'integer' type.
33. What distinguishes an 'object' from a 'type' in object-oriented programming, concerning properties?
A) The type defines the structure and behavior; the object is an instance with specific data.
B) The object defines the structure; the type is an instance with specific data.
C) Types are scalar; objects are composite.
D) Objects have a fixed range; types have a variable range.
34. When we say an 'integer' type supports addition and subtraction, we are referring to its:
A) Range
B) Values
C) Operations
D) Representation
35. The property that defines the set of all possible values a variable of a certain type can hold is known as its:
A) Syntax
B) Semantics
C) Range
D) Name
36. Which of the following is NOT a property of a data type?
A) The range of values it can represent.
B) The operations that can be performed on its values.
C) The memory location of a specific variable of that type.
D) The way values of that type are represented internally.
37. A 'char' or 'character' data type typically holds:
A) A whole number.
B) A single letter, symbol, or digit.
C) A sequence of text.
D) A fractional number.
38. What is a 'struct' or 'record' in programming?
A) A single, indivisible value.
B) A collection of elements of potentially different types.
C) A sequence of characters.
D) A true or false value.
39. In many programming languages, what is the primary characteristic of a 'float' or 'double' type?
A) It stores a single character.
B) It represents a number with a fractional part.
C) It holds a sequence of bytes.
D) It is used for logical operations.
40. A 'string' data type, often used to represent text, is usually considered a _________ type.
A) Scalar
B) Atomic
C) Composite
D) Boolean
41. Which type typically represents true or false values?
A) Integer
B) Float
C) Boolean
D) Character
42. What is a fundamental property of a scalar type like an 'integer'?
A) It can store a sequence of characters.
B) It represents a single whole number.
C) It is composed of boolean values.
D) It can hold floating-point values.
43. An array is generally considered a _________ data type.
A) Scalar
B) Primitive
C) Composite
D) Abstract
44. Which programming language concept allows a single name to refer to multiple values, often of the same type, arranged in a sequence?
A) Variable
B) Constant
C) Array
D) Function
45. What does 'properties of objects' typically encompass?
A) The definition of the data type itself.
B) The specific value held by a variable and its current state.
C) The functions available to perform operations on the type.
D) The memory footprint of the type definition.
46. In programming, what are the 'properties of types' referring to?
A) The memory address where the type is stored.
B) The set of values a type can hold and the operations that can be performed on them.
C) The syntax used to declare variables of that type.
D) The default initial value assigned to variables of that type.
47. Which of these is a common example of a composite data type?
A) Boolean
B) Float
C) Character
D) Array
48. What is a composite data type?
A) A data type that cannot be broken down into smaller parts.
B) A data type that holds a single numerical value.
C) A data type formed by combining other data types.
D) A data type used for logical comparisons.
49. Which of the following is an example of a scalar data type?
A) Array
B) String
C) Integer
D) Structure
50. Which of the following best describes a scalar data type in programming?
A) A data type that can hold multiple values of different types.
B) A data type that represents a single, indivisible value.
C) A data type composed of other data types.
D) A data type used for complex mathematical operations.