COMPILER DESIGN

ADVANCED TOPICS IN COMPILER DESIGN

CODE GENERATION FOR OBJECT ORIENTED LANGUAGES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
The ____ do not contain the actual data stored in a variable, but they contain a reference to the variables.
A
Value Types
B
Reference Types
C
String Types
D
Null Types
Explanation: 

Detailed explanation-1: -Reference Type. The reference types do not contain the actual data stored in a variable, but they contain a reference to the variables. In other words, they refer to a memory location. Using multiple variables, the reference types can refer to a memory location.

Detailed explanation-2: -A reference type variable contains a reference to data stored in memory, also known as the heap. The heap is most often used for data that has a longer life. You can have more than one variable point to the same referenced data. Objects are an example of a reference type.

Detailed explanation-3: -There are two kinds of types in Visual Basic: reference types and value types. Variables of reference types store references to their data (objects), while variables of value types directly contain their data.

Detailed explanation-4: -All fundamental data types, Boolean, Date, structs, and enums are examples of value types. Examples of reference types include: strings, arrays, objects of classes, etc. To create reference types in C#, you can take advantage of these keywords: class, interface and delegate.

Detailed explanation-5: -In C#, a string is a reference type because it is an object that is stored on the heap rather than the stack. This means that when you create a string variable and assign it a value, you are creating a reference to an object on the heap that contains the string value.

There is 1 question to complete.