Software Design Programming Constructs: Programming Paradigms Quiz
10 Questions
3 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Objects interact with each other by passing ______

messages

Encapsulation is a fundamental feature of Object-Oriented Programming where you hide unnecessary details in classes and deliver a simple and clear ______ for working.

interface

Inheritance is a mechanism where you can derive a class from another class for a hierarchy of classes that share a set of attributes and ______.

methods

Data Abstraction is the reduction of a particular body of data to a simplified representation of the ______.

<p>whole</p> Signup and view all the answers

Polymorphism is an object-oriented programming concept that refers to the ability of a variable, function, or object to take on multiple ______.

<p>forms</p> Signup and view all the answers

Common Paradigms Imperative: Programming with an explicit sequence of commands that update ______.

<p>state</p> Signup and view all the answers

Declarative: Programming by specifying the result you want, not how to ______ it.

<p>get</p> Signup and view all the answers

Structured: Programming with clean, goto-free, nested control ______.

<p>structures</p> Signup and view all the answers

Procedural: Imperative programming with ______ calls.

<p>procedure</p> Signup and view all the answers

It describes the idea of bundling data and methods that work on that data within one ______.

<p>unit</p> Signup and view all the answers

Study Notes

Programming Paradigms

  • A programming paradigm is a style or way of programming, and different languages make it easier to write in certain paradigms.

Procedural Programming

  • Also known as imperative programming, it is based on the concept of procedure calls.
  • Statements are structured into procedures (functions or subroutines) that are a list of instructions to tell the computer what to do step by step.
  • Procedural programming languages are known as top-down languages.
  • Examples of procedural programming languages include Fortran, C, and Cobol.
  • Features of procedural programming include:
    • Excellent for general-purpose programming
    • Coded simplicity and ease of implementation of compilers and interpreters
    • Large variety of books and online course material available on tested algorithms
    • Source code is portable
    • Code can be reused in different parts of the program
    • Program flow can be tracked easily with a top-down approach

Logical Programming

  • Based on mathematical logic, where program statements express facts and rules about problems within a system.
  • Rules are written as logical clauses with a head and a body.
  • Follows a declarative approach rather than an imperative approach.
  • Features of logical programming include:
    • Can express knowledge in a way that does not depend on the implementation
    • Programs are more flexible, compressed, and understandable
    • Enables knowledge to be separated from use
    • Can be altered and extended in natural ways to support special forms of knowledge
    • Can be used in non-computational disciplines relying on reasoning and precise means of expression
  • Prolog is an example of a language that follows the logical paradigm.

Functional Programming

  • A programming paradigm where computation is treated as an evaluation of mathematical functions.
  • Avoids changing-state and mutable data.
  • Features of functional programming include:
    • Pure functions: output depends only on the input
    • Recursion: a function that calls itself during its execution
    • Referential transparency: an expression can be replaced with its corresponding value without changing the program's behavior
    • Functions are first-class and can be higher-order
    • Variables are immutable

Object-Oriented Programming (OOP)

  • A framework where all real-world entities are represented by classes.
  • Objects are instances of classes, and each object encapsulates a state and behavior.
  • Features of OOP include:
    • Encapsulation: hiding unnecessary details in classes and delivering a simple and clear interface
    • Inheritance: a mechanism where a class can be derived from another class for a hierarchy of classes
    • Data Abstraction: reducing a particular body of data to a simplified representation
    • Polymorphism: the ability of a variable, function, or object to take on multiple forms

Other Paradigms

  • Imperative: programming with an explicit sequence of commands that update state
  • Declarative: programming by specifying the result you want, not how to get it
  • Structured: programming with clean, goto-free, nested control structures
  • Procedural: imperative programming with procedure calls

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Description

Test your knowledge on programming paradigms like Procedural Programming with this quiz from the College of Engineering's CPP 106 Lecture 2nd Semester Prelim. Learn about different programming styles and concepts.

More Like This

Object-Oriented Programming Paradigm
22 questions
Software Design and Coding Overview
10 questions

Software Design and Coding Overview

EyeCatchingComprehension avatar
EyeCatchingComprehension
Programming Paradigms Overview
37 questions
Use Quizgecko on...
Browser
Browser