Lecture 7 Flashcards

1
Q

What are primitive data types?

A

Data types not defined in terms of other data types.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

List Java’s signed integer sizes.

A

Byte, short, int, long.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the literal form of a complex type in Python?

A

(7 + 3j)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the primary use of decimal data types?

A

Business applications for accuracy in financial calculations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the range of values for Boolean types?

A

True and false.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the design issues for character string types?

A

Whether they are primitive or array types and if their length should be static or dynamic.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What operations can be performed on character string types?

A

Assignment, copying, comparison, catenation, substring reference, pattern matching.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How are character strings handled in C and C++?

A

Not as primitives, but using char arrays and a library of functions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Provide an example of an enumeration type in C#.

A

enum days {mon, tue, wed, thu, fri, sat, sun}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a heterogeneous array?

A

An array where elements can be of different types.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a slice in the context of arrays?

A

A substructure or referencing mechanism for a portion of an array.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a record type?

A

A collection of different types of data elements, each identified by a name.
.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How are tuples different from records?

A

Tuple elements are unnamed, while record elements are named.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are list comprehensions in Python?

A

A concise way to create lists based on existing lists, with conditions and expressions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a union type?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Describe the two fundamental operations for pointers.

A

Assignment (setting a pointer’s value to an address) and dereferencing (accessing the value at the pointer’s address).

17
Q

What is a dangling pointer?

A

A dangling pointer is a pointer that no longer points to a valid memory location.

18
Q

What is type checking?

A

The process of ensuring that operands are of compatible types for an operator.

19
Q

Define strong typing in programming languages.

A

A language is strongly typed if it always detects type errors.

20
Q
A