Practice Assignment: Identify Paradigms in Languages
Practice Assignment: Identify Paradigms in Languages
Practice identifying programming paradigms used by different languages, code styles, and real-world programming situations.
Assignment Objective
The objective of this assignment is to help students identify different programming paradigms used in programming languages and code examples.
Students will analyze programming languages, short code descriptions, and real-world situations to decide whether they represent imperative, procedural, object-oriented, functional, declarative, or event-driven programming.
Learning Outcomes
After completing this assignment, students will be able to:
Students Will Learn To
- Identify the main idea of common programming paradigms.
- Recognize imperative programming from step-by-step logic.
- Recognize procedural programming from function-based organization.
- Recognize object-oriented programming from classes and objects.
- Recognize functional programming from pure functions and transformations.
- Recognize declarative programming from result-focused expressions.
- Recognize event-driven programming from events and handlers.
- Understand that many programming languages support multiple paradigms.
- Choose a suitable paradigm for different programming situations.
- Explain the reason behind their paradigm identification.
Assignment Scenario
You are helping a group of beginner programmers understand how different programming languages support different programming styles.
Your task is to study the given languages and examples, then identify which programming paradigm is most suitable or most visible in each case.
Quick Revision Before Starting
| Paradigm | Main Idea | Identification Clue |
|---|---|---|
| Imperative Programming | Step-by-step instructions. | Uses loops, assignments, and explicit control flow. |
| Procedural Programming | Program divided into procedures or functions. | Uses reusable functions to organize tasks. |
| Object-Oriented Programming | Program organized around objects. | Uses classes, objects, methods, inheritance, encapsulation. |
| Functional Programming | Program organized around functions and transformations. | Uses pure functions, map, filter, reduce, immutability. |
| Declarative Programming | Describes what result is required. | Uses queries, rules, configurations, or result-focused expressions. |
| Event-driven Programming | Program responds to events. | Uses events, listeners, callbacks, handlers, button clicks. |
Assignment Instructions
What Students Need to Do
- Read each question carefully.
- Identify the most suitable programming paradigm.
- Write a short reason for your answer.
- If a language supports more than one paradigm, mention it as multi-paradigm.
- Use proper terminology such as class, object, function, event, handler, query, loop, and transformation.
- Do not only memorize language names. Focus on the code style or problem-solving approach.
Part A: Identify Paradigms by Language
Identify the commonly associated paradigm or paradigms for each language.
| No. | Language / Technology | Paradigm | Reason |
|---|---|---|---|
| 1 | C | ____________________ | ____________________ |
| 2 | C++ | ____________________ | ____________________ |
| 3 | Java | ____________________ | ____________________ |
| 4 | Python | ____________________ | ____________________ |
| 5 | JavaScript | ____________________ | ____________________ |
| 6 | SQL | ____________________ | ____________________ |
| 7 | HTML | ____________________ | ____________________ |
| 8 | CSS | ____________________ | ____________________ |
| 9 | Haskell | ____________________ | ____________________ |
| 10 | Prolog | ____________________ | ____________________ |
Part B: Identify Paradigm from Code Style
Read each code-style description and identify the paradigm.
Question 1
A program creates a variable total.
Then it loops through a list of marks.
For each mark, it adds the value to total.
Finally, it displays total.
Paradigm: ____________________
Reason: ____________________
Question 2
A program defines a function calculateAverage().
The function receives total and count.
It returns total / count.
The same function is reused in multiple places.
Paradigm: ____________________
Reason: ____________________
Question 3
A program creates a Student class.
Each student object has name, rollNumber, and marks.
The object also has a method calculateGrade().
Paradigm: ____________________
Reason: ____________________
Question 4
A program uses FILTER marks WHERE mark >= 50.
It does not manually describe the loop.
It only describes the required result.
Paradigm: ____________________
Reason: ____________________
Question 5
A program waits for a user to click the Submit button.
When the button is clicked, a function validates the form.
Paradigm: ____________________
Reason: ____________________
Question 6
A program uses map, filter, and reduce.
It avoids changing the original list.
It creates new transformed data.
Paradigm: ____________________
Reason: ____________________
Part C: Match the Language with the Paradigm
Match the items from Column A with the most suitable item from Column B.
| Column A | Column B |
|---|---|
| 1. SQL | A. Object-Oriented Programming |
| 2. Java class and object style | B. Declarative Programming |
| 3. Button click handler | C. Functional Programming |
| 4. Pure function with no side effects | D. Event-driven Programming |
| 5. Step-by-step loop and assignment | E. Imperative Programming |
Answers:
1 → ______
2 → ______
3 → ______
4 → ______
5 → ______
Part D: Complete the Paradigm Table
Complete the following table using suitable examples.
| Paradigm | Main Feature | Example Language / Technology | Example Use Case |
|---|---|---|---|
| Imperative | ____________________ | ____________________ | ____________________ |
| Procedural | ____________________ | ____________________ | ____________________ |
| Object-Oriented | ____________________ | ____________________ | ____________________ |
| Functional | ____________________ | ____________________ | ____________________ |
| Declarative | ____________________ | ____________________ | ____________________ |
| Event-driven | ____________________ | ____________________ | ____________________ |
Part E: Analyze Multi-Paradigm Languages
Some languages support more than one paradigm. Such languages are called multi-paradigm languages.
For each language below, write at least two paradigms it can support.
| Language | Paradigm 1 | Paradigm 2 | Paradigm 3 |
|---|---|---|---|
| Python | ____________________ | ____________________ | ____________________ |
| JavaScript | ____________________ | ____________________ | ____________________ |
| C++ | ____________________ | ____________________ | ____________________ |
| Ruby | ____________________ | ____________________ | ____________________ |
| Kotlin | ____________________ | ____________________ | ____________________ |
Part F: Short Answer Questions
Why is Java commonly associated with object-oriented programming?
Answer: ____________________________________________________________
Why is SQL considered declarative?
Answer: ____________________________________________________________
Why can Python be called a multi-paradigm language?
Answer: ____________________________________________________________
Why is JavaScript commonly used in event-driven programming?
Answer: ____________________________________________________________
What is the difference between procedural and object-oriented programming?
Answer: ____________________________________________________________
Part G: Identify the Paradigm from Pseudocode
Example 1
ENTRY POINT
SET count = 0
WHILE count < 5
DISPLAY count
SET count = count + 1
END WHILE
END ENTRY POINT
Paradigm: ____________________
Reason: ____________________
Example 2
FUNCTION calculateDiscount(price)
RETURN price * 0.10
END FUNCTION
FUNCTION calculateFinalPrice(price)
RETURN price - calculateDiscount(price)
END FUNCTION
Paradigm: ____________________
Reason: ____________________
Example 3
CLASS Product
PROPERTY name
PROPERTY price
METHOD displayDetails()
DISPLAY name
DISPLAY price
END METHOD
END CLASS
Paradigm: ____________________
Reason: ____________________
Example 4
products = FILTER products WHERE price < 500
Paradigm: ____________________
Reason: ____________________
Example 5
WHEN user clicks "Add to Cart"
ADD product TO cart
UPDATE cart count
END WHEN
Paradigm: ____________________
Reason: ____________________
Part H: Case Study Questions
Case Study 1: Online Shopping Website
An online shopping website has products, customers, carts, and orders. Each product has properties like name, price, and stock. The website also reacts when users click buttons such as Add to Cart and Checkout.
Identify two paradigms used in this system and explain why.
Paradigm 1: ____________________
Reason: ____________________
Paradigm 2: ____________________
Reason: ____________________
Case Study 2: Student Result System
A student result system stores student marks, calculates total, average, and grade. It also uses a query to find students who scored above 80.
Identify two paradigms used in this system and explain why.
Paradigm 1: ____________________
Reason: ____________________
Paradigm 2: ____________________
Reason: ____________________
Case Study 3: Simple Game
A simple game responds to key presses, mouse clicks, timer events, and collision events. When the player presses the space key, the character jumps.
Identify the main programming paradigm.
Paradigm: ____________________
Reason: ____________________
Bonus Challenge
Choose any one programming language you know and write a short paragraph explaining which paradigms it supports.
My chosen language: ____________________
Explanation:
____________________________________________________________
____________________________________________________________
____________________________________________________________
Expected Skills Demonstrated
By Completing This Assignment, Students Show That They Can
- Identify programming paradigms from language names.
- Identify paradigms from code style.
- Explain why a code example belongs to a paradigm.
- Understand multi-paradigm language behavior.
- Compare different programming styles.
- Apply paradigm knowledge to real-world situations.
Evaluation Rubric
| Criteria | Marks | Description |
|---|---|---|
| Paradigm Identification | 25 | Correctly identifies paradigms from language names and examples. |
| Reasoning | 25 | Provides clear reasons for each answer. |
| Concept Understanding | 20 | Shows understanding of imperative, procedural, OOP, functional, declarative, and event-driven paradigms. |
| Case Study Analysis | 15 | Applies paradigm knowledge to real-world scenarios. |
| Presentation and Clarity | 10 | Answers are neat, readable, and well organized. |
| Bonus Challenge | 5 | Explains one multi-paradigm language with examples. |
Common Mistakes to Avoid
Mistakes
- Thinking one language can have only one paradigm.
- Calling every function-based program functional programming.
- Confusing procedural programming with object-oriented programming.
- Thinking declarative programming means no internal work happens.
- Identifying paradigm only by language name and ignoring code style.
- Forgetting that event-driven programming depends on events and handlers.
- Writing only the paradigm name without explaining the reason.
Better Habits
- Look for clues in the code style.
- Check whether the code uses objects, functions, events, rules, or step-by-step logic.
- Use the term multi-paradigm when more than one paradigm applies.
- Explain answers using keywords such as loop, class, object, event, handler, query, pure function, and filter.
- Focus on reasoning, not memorization.
- Give examples wherever possible.
Final Submission Checklist
Before Submitting, Check That:
- All parts of the assignment are attempted.
- Each answer includes a paradigm name.
- Each answer includes a short reason.
- Multi-paradigm languages are clearly marked.
- Case study answers mention at least one correct paradigm.
- Examples are neat and readable.
- Technical terms are used correctly.
Reflection Questions
Why should programmers learn multiple paradigms?
Because different paradigms provide different ways to solve problems and help programmers choose the best approach for a situation.
Can one language support multiple paradigms?
Yes. Many modern programming languages support multiple paradigms.
Why is code style important when identifying paradigms?
Because the same language can be written in different styles, so the code approach matters more than the language name alone.
Which paradigm is best?
No single paradigm is always best. The best paradigm depends on the problem, project, language, and readability requirement.
Quick Summary
| Paradigm | How to Identify It |
|---|---|
| Imperative | Step-by-step instructions, loops, assignments, changing variables. |
| Procedural | Functions or procedures used to organize tasks. |
| Object-Oriented | Classes, objects, methods, inheritance, encapsulation. |
| Functional | Pure functions, immutability, map, filter, reduce, transformations. |
| Declarative | Describes desired result using queries, rules, or declarations. |
| Event-driven | Code runs when events happen, such as clicks, key presses, or messages. |
Final Takeaway
The Identify Paradigms in Languages assignment helps students connect programming theory with practical language usage. Students should remember that paradigms are ways of thinking, not just language labels. A language may support multiple paradigms, and the correct identification depends on how the code is written, how data is organized, and how the program solves the problem.