12 Questions
Which of the following languages has a static type system?
Haskell
What is the primary characteristic of a static type system?
Types are determined at compile time
In the C++ statement const double rate = 3.5;
, when is the value of rate bound?
Compile time
What is the consequence of not deallocating memory in C after using malloc?
Memory leak
What is the equivalent feature in Haskell to a generator implemented using the yield keyword in C# or Python?
Lazy lists
What is the main reduction rule of the semantic of the λ-calculus?
β-reduction
What is the primary difference between the stack and the heap in terms of memory allocation?
The stack is used for static memory allocation, while the heap is used for dynamic memory allocation.
In the given C program, which of the following statements is true?
The heap memory allocated in line 7 will be freed when the process terminates.
What is the purpose of the free
function in the given C program?
To deallocate memory on the heap.
What is the type of the head
function in Haskell?
head :: [a] -> a
What is the purpose of the yield return
statement in the given C# generator?
To return a value from the generator.
How many times will the yield return
statement be invoked when the following code is executed?
7
Test your knowledge of programming languages, including their type systems and features. Identify languages with static or dynamic type systems, and match features to corresponding languages.
Make Your Own Quizzes and Flashcards
Convert your notes into interactive study material.
Get started for free