1/35
Flashcards covering procedural, functional, and object-oriented paradigms; higher-order functions; OOP principles (encapsulation, data hiding, classes, objects, association, inheritance, polymorphism); and UML basics.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Which programming paradigm is the main focus of Programming Technique II (SCSJ1023)?
Object-Oriented Programming (OOP).
Which programming language is used in this course to teach OOP concepts?
C++.
Name three traditional procedural programming languages.
Any three of: C, Pascal, BASIC, Ada, COBOL.
In procedural programming, how are data and operations organized?
Data and the operations that act on them are separate; data are sent to procedures/functions.
Define functional programming in one sentence.
A paradigm where programs are built by applying and composing functions, treating functions as first-class citizens.
What does it mean for a function to be a ‘first-class citizen’ in functional programming?
It can be bound to names, passed as a parameter, and returned from other functions.
Which programming styles do procedural programming and OOP follow?
Imperative programming style (describing HOW a program operates).
Which style does functional programming follow, declarative or imperative?
Declarative – it specifies WHAT should be accomplished, not how.
What is a higher-order function?
A function that takes other functions as parameters and/or returns a function as its result.
What do we call a function passed into another function as an argument?
A callback function.
In C++, what is ‘function binding’?
Assigning a function’s address to a variable without invoking the function (e.g., auto g = getNumber;).
What does the function getFunctionByOperator(char oper) demonstrate?
Returning a function pointer based on an operator, showing that functions can be returned from functions.
What is a lambda function?
An anonymous inline function written directly where a callback is needed.
Give one practical use case of higher-order functions shown in the notes.
Iterating over an array with forEach to apply different printing or filtering behaviors.
In OOP, what are the data stored inside an object called?
Attributes or properties.
In OOP, what are the operations that manipulate an object’s data called?
Methods.
State the OOP concept that combines data and the methods that operate on that data into a single unit.
Encapsulation.
What is data hiding?
Restricting direct access to an object’s attributes so they can only be changed through its methods.
What is meant by a programming interface in OOP?
The set of public methods through which other objects interact with an object’s private data.
Define a ‘class’.
A blueprint or template that defines the attributes and methods common to all objects of a certain type.
Define an ‘object’.
An instance of a class created in memory during program execution.
Explain the relationship between a class and its objects.
A class defines properties and behaviors; objects are concrete instantiations of that definition.
What is an association in OOP?
A relationship linking objects of one class with objects of another, e.g., a Person owns many Cars.
Give two possible cardinalities of an association.
One-to-one, one-to-many, many-to-one, or many-to-many.
Define inheritance.
A mechanism allowing a class to extend or reuse code from another class, forming an ‘is-a’ relationship.
What is polymorphism?
The ability of different classes to respond differently to the same method call (perform the same action differently).
Give an everyday example illustrating polymorphism from the notes.
Grasshopper and Ant both ‘move’ but one jumps while the other crawls.
List one key difference between procedural programming and OOP.
PP separates data and functions, while OOP encapsulates them into objects.
What does UML stand for?
Unified Modelling Language.
What are the three sections of a UML class diagram box?
Class name, member variables (attributes), and member functions (methods).
In UML, what symbol denotes a private member?
A minus sign (–).
In UML, how do you indicate a public member?
A plus sign (+).
How is a data type shown for an attribute in UML?
AttributeName : DataType (e.g., width : double).
How is a parameter’s data type shown in UML?
ParameterName : DataType inside the parentheses of the method signature.
How is a function’s return type indicated in UML?
A colon and data type placed after the parameter list (e.g., getArea() : double).
How are constructors and destructors represented in UML with respect to return types?
They have no return type listed in the diagram.