NEW
Font size
WorksheetsPPL 223 - (QUIZ 3) Data Types and Structures
Total questions: 15
Worksheet time: 5mins
Which of the following is a primitive data type?
Array
Integer
Record
Class
What is the main characteristic of an array?
Elements of different types
Elements of the same type
Variable size
None of the above
Which data type is best suited for representing a single character?
Boolean
Integer
Float
Character
In a record, fields can be of:
Only primitive types
Only array types
Different types
Only string types
What is the purpose of a discriminant field in a variant record?
To hold multiple types simultaneously
To store metadata about the record
To determine which type of data is currently stored
To provide a default value for fields
Which type of type checking is done at compile-time?
Dynamic
Static
Run-time
Hybrid
In Python, what is the inferred type of the variable age in the following code? age = 25
String
Float
Integer
Boolean
Which statement is true about implicit typing?
Requires explicit type annotations
Reduces code readability
The type is inferred from the assigned value
Always results in type errors
Which of the following is an example of a floating-point number?
42
'A'
3.14
True
What is the primary benefit of using records in a program?
Reducing code execution time
Grouping related data
Simplifying arithmetic operations
Optimizing memory usage
Variant records can store different types of data simultaneously.
TRUE
FALSE
Type inference makes code more verbose.
TRUE
FALSE
In arrays, all elements must be of the same type.
TRUE
FALSE
Type checking ensures that operations on data types are valid.
TRUE
FALSE
A boolean data type can hold true or false values.
TRUE
FALSE
