Question & Answer: Consider a programming language with the following statements: x:= 3: y:= 2: z:= x + y: write (z) Execution of these…..

Programming languages:

Consider a programming language with the following statements: y: 2 x ty write (z Execution of these statements prints the value 5 on the console s this a declarative, imperative, or functional language? For each of these paradigms, very briefly explain why you think this example is or isnt a language from the given paradigm

Consider a programming language with the following statements: x:= 3: y:= 2: z:= x + y: write (z) Execution of these statements prints the value 5 on the console. Is this a declarative, imperative, or functional language? For each of these paradigms, very briefly explain why you think this example is or isn’t a language from the given paradigm.

Expert Answer

 This is a declarative language, because of the write statement, which we just declared. There is no definintion of write statement provided by us and computer knows how to write the data. Here we tell computer what to do.

It is a imperative language also, as we have specified the data step by step. First we declare the variables x and y and then add them into a variable z. This is a step by step approach, which tells computer how to do it.

It is not a functional language, because in functional languages, we use the functions and mathematical logic heavily. In that we try to convert the set of input to output by the use of different functions.

Still stressed from student homework?
Get quality assistance from academic writers!