Lecture 7 Flashcards
What are primitive data types?
Data types not defined in terms of other data types.
List Java’s signed integer sizes.
Byte, short, int, long.
What is the literal form of a complex type in Python?
(7 + 3j)
What is the primary use of decimal data types?
Business applications for accuracy in financial calculations.
What is the range of values for Boolean types?
True and false.
What are the design issues for character string types?
Whether they are primitive or array types and if their length should be static or dynamic.
What operations can be performed on character string types?
Assignment, copying, comparison, catenation, substring reference, pattern matching.
How are character strings handled in C and C++?
Not as primitives, but using char arrays and a library of functions.
Provide an example of an enumeration type in C#.
enum days {mon, tue, wed, thu, fri, sat, sun}
What is a heterogeneous array?
An array where elements can be of different types.
What is a slice in the context of arrays?
A substructure or referencing mechanism for a portion of an array.
What is a record type?
A collection of different types of data elements, each identified by a name.
.
How are tuples different from records?
Tuple elements are unnamed, while record elements are named.
What are list comprehensions in Python?
A concise way to create lists based on existing lists, with conditions and expressions.
What is a union type?
A union is a data structure that can store different types of data, but only one type at a time. Because they share the same memory location