Module 4 Flashcards
A _________ is a set of statements to perform a specific task.
function
_________ organize the program into logical blocks of code.
Functions
_________ may be called to access code.
functions
_________ are the building blocks of readable, maintainable, and
reusable code.
Functions
_________ {
// main function goes here
}
main()
A function must be called to execute it. This process is
termed as _________.
function invocation
_________ may also return value along with the control, back
to the caller.
Returning functions
The _________ can be any valid data type.
return_type
The _________ statement is optional. If not specified, the
function returns null.
return
The return statement is optional. If not specified, the
function returns _________ .
null
The _________ of the value returned must match the return
type of the function.
data type
A function can return at the most _________ value. In other
words, there can be only _________ return statement per function.
one
_________ are a mechanism to pass values to functions.
Parameters
_________ form a part of the function’s signature.
Parameters
The _________ values are passed to the function during its invocation.
parameter
_________ is a programming language model in which programs are organized around data, or objects, rather than functions and logic.
Object-oriented programming (OOP)
An object is an _________ meant to represent a component of a program.
abstraction
_________ can be created, destroyed, given attributes, and made
to perform actions.
Objects
Every object belongs to a _________.
class
The class of an object is its _________.
type
Objects of the same class have the same ________ variables and methods available to them
instance
a _________ is a blueprint for creating objects (a particular data structure), providing initial values for state (member variables or attributes), and implementations of behavior (member functions or methods).
class
Use the _________ keyword to declare a class in Dart.
class
A class definition starts with the keyword class followed by the _________
class name
the class body enclosed by a pair of _________.
curly braces
A _________ is any variable declared in a class. They represent data
pertaining to objects.
field
Allows the program to initialize and retrieve the values of
the fields of a class.
Setters and Getters
A _________ getter/ setter is associated with every class. However, they can be overridden by explicitly defining a setter/getter.
default
responsible for allocating memory for the objects of the class.
Constructors
represent actions an object can take.
Functions
Functions are also at times referred to as _________.
methods
To create an instance of the class, use the _________ keyword followed by the class name.
new
The _________ keyword is responsible for instantiation.
new
The constructor should be passed _________ if it is parameterized.
values
is a special function of the class that is responsible for initializing the variables of the class.
constructor
Dart defines a constructor with the same name as that of the _________.
class
A constructor is a function and hence can be _________
parameterized
unlike a function, constructors cannot have a _________
return type
If you don’t declare a constructor, a default _________ is provided for you.
no-argument constructor
Dart provides _________ to enable a class define multiple constructors.
named constructors
Dart provides named constructors to enable a class define _________.
multiple constructors
_________ and _________, also called as accessors and mutators
Getters and Setters
Getters and Setters, also called as _________ and _________
accessors and mutators
_________ allow the program to initialize and retrieve the values of class fields respectively
Getters and Setters
Getters or accessors are defined using the _________ keyword.
get
Setters or mutators are defined using the _________ keyword.
set
The _________ keyword refers to the current instance of the class in a method or constructor with parameters
this
Fundamental Principles of OOP
Inheritance
Polymorphism
Abstraction
Encapsulation
inherit members from parent class
Inheritance
Access class through parents interface
Polymorphism
Define and execute abstract actions
Abstraction
Hide internal properties of the class
Encapsulation
The class giving its members its child class
Base (parent) class
The class taking members from its base class
Derived (child) class
Inheritance implicitly takes __________ from another class
all members
In Inheritance, some members may be __________ : private members hidden in the derived class
inaccessible
Use __________ for building is-a relationship
* i.e: Dog is-a animal
inheritance
Inheritance allows __________ to inherit the characteristics of an existing parent class (base)
child classes (derived)
Inheritance allows child classes (derived) to inherit the
characteristics of an existing __________
parent class (base)
A __________ can extend the parent class
child class
An __________ defines set of operations(methods) that a given should support
interface
A class can implement an __________ by providing implementation for all methods
interface
Types of inheritance
Single inheritance
Multiple inheritance
Multi-level inheritance
Hierarchical inheritance
when a class inherits a single parent class
Single inheritance
Multiple inheritance
Multi-level inheritance
Hierarchical inheritance
Single inheritance
When a class inherits more than one parent class
Single inheritance
Multiple inheritance
Multi-level inheritance
Hierarchical inheritance
Multiple inheritance
when a class inherits another child class
Single inheritance
Multiple inheritance
Multi-level inheritance
Hierarchical inheritance
Multi-level inheritance
More than one class having the same parent class
Single inheritance
Multiple inheritance
Multi-level inheritance
Hierarchical inheritance
Hierarchical inheritance
Child classes inherits all properties and methods excepts __________ of the parent class
constructors
Unlike Java, Dart does not support __________ inheritance
multiple
Every class can at the most extend from one parent class
Single inheritance
Multiple inheritance
Multi-level inheritance
Hierarchical inheritance
Single inheritance
A class can inherit properties of the base class from another child class.
Single inheritance
Multiple inheritance
Multi-level inheritance
Hierarchical inheritance
Multi-level inheritance
More than one classes have the same parent class
Single inheritance
Multiple inheritance
Multi-level inheritance
Hierarchical inheritance
Hierarchical inheritance
A __________ type of inheritance only that inherits properties of parent class only that it overrides the same method declared in child class
Multi-level
provide means ignoring irrelevant features, properties, or functions and emphasizing on relevant ones
Abstractions
Abstractions helps manage complexity (T/F)
T
Hides implementation details
Encapsulation
Class announces only a few operations (methods) available to objects
Encapsulation
All data members(fields) of the class are hidden and can only be accessed via properties (read-only and read-write)
Encapsulation