NEMERLE Flashcards

(16 cards)

1
Q

It allows the compiler to automatically determine the type of a variable based on the assigned value.

NEMERLE

A

Type Inference

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

The keyword used to declare a variable whose value cannot be changed once assigned.

NEMERLE

A

def

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

The primary selection tool in Nemerle that allows branching based on the structure, type, or value of data.

NEMERLE

A

match

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

The keyword used to declare variables that allow for reassignment and modifications.

NEMERLE

A

mutable

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

The Polish university where Nemerle originated as an academic project in 2003.

NEMERLE

A

University of Wrocław

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

In Nemerle, the semicolon (;) is always mandatory, even if the expression is on a new line.
True or False

A

False – The semicolon is often optional if the expression is on a new line

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

Variables in Nemerle are mutable by default.
True or False

A

False – Variables are immutable by default unless declared with mutable.

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

Nemerle runs directly on hardware without a virtual execution environment.
True or False

A

False – Nemerle runs on the .NET Common Language Runtime (CLR), not directly on hardware.

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

The def keyword requires the programmer to explicitly declare the variable type
True or False

A

False – def enables type inference; explicit typing is optional.

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

Nemerle supports both object-oriented and functional programming paradigms.
True or False

A

True – Nemerle supports object-oriented and functional programming

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

What will be the output of the following code?

def a = 7;
def b = 2;
WriteLine(a + b * 3);

Nemerle

A

13
Multiplication has higher precedence. 7 + (2 * 3) = 7 + 6 = 13.

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

Identify the error in the following code and explain why it occurs.

def x = 5;
x = 10;
WriteLine(x);

Nemerle

A

The error occurs because x is immutable by default. Reassigning x = 10; is invalid. To fix it, declare the variable as mutable:
mutable x = 5;

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

Identify the problem in the following code:
def name : int = "Nemerle";

Nemerle

A

Type mismatch error.
The variable is declared as int but assigned a string.

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

Analyze the return logic of the following code. In Nemerle, why is an explicit return keyword not strictly necessary in this method body?

public GetLogCount() : int
{
       def count = 5;
       count
}

Nemerle

A

The last line of a block is the return value.
In Nemerle, explicit return is optional because the result of the last expression in a block is automatically returned.

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

What is the final boolean value of result, and which specific category of operators is being used for &&?
def count = (10 > 5) && (5 == 5);

Nemerle

A

True
Logic (or Boolean) operators. The expression evaluates to true because both conditions are met, using the Logical AND operator.

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

Kamil Skalski, Michał Moskal, and Paweł Olszta.