Object-Oriented vs Procedural Programming

SwiftImpressionism avatar
SwiftImpressionism
·
·
Download

Start Quiz

Study Flashcards

11 Questions

In procedural programming, data and functionality are combined into a single unit.

False

A class is an instance of an object in object-oriented programming.

False

Variables that belong to an object or class are called methods.

False

The keyword 'object' is used to define a new class.

False

A method is a function that belongs to a class.

True

In object-oriented programming, a class is an instance of an object.

False

Constructors are used to initialize values to class attributes.

True

Object-oriented programming combines data and functionality into a single unit.

True

Fields are functions that belong to a class.

False

In procedural programming, programs are organized around functions or blocks of statements.

True

An object is a blueprint or template for creating multiple objects.

False

Study Notes

Programming Paradigms

  • There are two basic programming paradigms: Procedural and Object-Oriented Programming (OOP)

Object-Oriented Programming (OOP)

  • Organizes data and functionality into objects, combining data and functionality
  • Classes and objects are the two main aspects of OOP

Classes and Objects

  • A class creates a new type, similar to creating a variable type (e.g., int)
  • Objects are instances of a class, similar to how variables are instances of a type
  • Variables that belong to an object or class are called fields

Object Functionality

  • Objects can store data using fields (ordinary variables)
  • Objects can have functionality using methods (functions that belong to the class)
  • Methods belong to an object or class, differentiating them from standalone functions

Class Definition

  • The class keyword is used to define a new class
  • Class definition format: class :

Object Creation

  • Multiple objects can be created from a single class definition
  • Each object has its own set of attributes (fields) and methods

Constructors

  • Class attributes can be initialized using constructors
  • Constructors allow for initializing values when an object is created

A quiz on the two programming paradigms: Object-Oriented and Procedural. Learn about classes, objects, functions and data manipulation.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free
Use Quizgecko on...
Browser
Browser