Advanced Programming Language Concepts (CT006-3-3) Programming Paradigm
Tutorial -1 and 2
Question:
1. Define the imperative programming paradigm.
2. Compare imperative programming paradigm with functional programming paradigm.
3. List the programming languages support functional concepts.
4. Examine any FIVE (5) similarities and/ or differences between functional and imperative
programming paradigm.
5. Examine how the functional programming paradigm may be deployed in a programming
language that is fundamentally non-functional in nature. Provide suitable examples to
substantiate your answer.
6. Consider the following Java code.
import java.util.*;
public class Finder {
public static void main(String[] args) {
List<String> names =
Arrays.asList("Dory", "Gill", "Bruce", "Nemo");
findNemo(names);
}
public static void findNemo(List<String> names) {
boolean found = false;
for(String name : names) {
if(name.equals("Nemo")) {
found = true;
break;
}
}
if(found)
System.out.println("Found Nemo");
else
System.out.println("Sorry, Nemo not found");
}
}
Identify the programming style adopted in the above. Discuss how is this programming
style used comparatively with declarative/functional programming style. In the
discussion, the programming styles should be compared along with programming code,
respectively, in Java for the same problem.
Level 3 Asia Pacific University of Technology and Innovation Page 1 of 1