Unit 2 OOP Cornell (1) Flashcards

(145 cards)

1
Q

What are the key features of OOP?

A
  • Classes
  • Objects
  • Encapsulation
  • Abstraction
  • Inheritance
  • Generalisation
  • Polymorphism

These features define the principles and structure of Object-Oriented Programming.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a class in OOP?

A

Blueprints for creating objects with predefined attributes and methods

A class defines the structure and behaviour of objects, such as a Person class with attributes like name and methods like walk.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is an object in OOP?

A

Instances of classes that encapsulate data and behaviour

For example, a Person object may have attributes like name, age, gender, and occupation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is encapsulation in OOP?

A

Bundling data and methods within objects to restrict access and ensure data integrity

Encapsulation helps in preventing unintended interference with an object’s data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a constructor method in OOP?

A

A special method in a class that initializes attributes when an object is created

In Python, it’s defined with the name __init__.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is an instance in OOP?

A

A specific realization of a class created at runtime

Each instance has its own set of attributes and methods, independent of other instances.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is abstraction in OOP?

A

Hiding complex implementation details and exposing only necessary functionalities

Abstraction simplifies the interface for users, allowing them to interact without needing to understand the complexities.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is inheritance in OOP?

A

A mechanism for creating new classes based on existing ones, promoting code reuse and hierarchy

Sub-classes can inherit attributes and methods from their parent class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is generalisation in OOP?

A

Identifying common traits among a set of entities and extracting them into a generalised super-class

It reduces redundancy by creating a broader framework that captures shared attributes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is polymorphism in OOP?

A

The ability for objects of different types to be accessed through the same interface

It allows the same method to behave differently depending on the object that calls it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is procedural programming?

A

A programming paradigm focused on writing procedures or functions that operate on data

It organizes code around sequential execution of instructions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How does OOP differ from procedural programming?

A

OOP organizes code around objects and their interactions, while procedural programming focuses on functions and procedures

This leads to more modular, reusable, and maintainable code in OOP.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the role of access modifiers in OOP?

A

Keywords that set the accessibility of classes, methods, and other members to enforce encapsulation

Examples include public, private, and protected.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the top-down approach in procedural programming?

A

Starting with a high-level overview of tasks and breaking them down into smaller, specific functions

It outlines the main steps before detailing each step.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a key disadvantage of procedural programming regarding data access?

A

It does not use access modifiers, allowing all parts of the program to access all data freely

This can lead to potential security risks and unintended interference.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the bottom-up approach in OOP?

A

Designing the system from specific objects and their behaviours to more complex systems

This contrasts with the top-down approach used in procedural programming.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What are the main features of Object-oriented programming (OOP)?

A
  • Bottom-up approach
  • Program is divided into objects
  • Makes use of access modifiers
  • More secure
  • Object can move freely within member functions
  • Supports inheritance

These features contribute to the modular and reusable nature of OOP.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What are the main features of Procedural-oriented programming (POP)?

A
  • Top-down approach
  • Program is divided into functions
  • Doesn’t use access modifiers
  • Less secure
  • Data can move freely from function to function

These features define the structure and flow of procedural programming.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What does access to data in a program imply?

A

All parts of the program can access all data without restrictions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Why is unrestricted access to data considered less secure?

A

It can lead to unintended interference or misuse, increasing security risks

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

How does data move within programs?

A

Data is passed around between functions as parameters, allowing any function to manipulate any piece of data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is a key limitation of procedural programming related to function organization?

A

It does not support inheritance, making each function a separate entity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What is Object Oriented Programming (OOP)?

A

A programming paradigm that emphasizes organizing code around objects, which are instances of classes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

List some applications of OOP languages.

A
  • Computer Games
  • Web-based database applications
  • Desktop Applications
  • Mobile Applications
  • Enterprise Software
  • Scientific Computing
  • Machine Learning and AI
  • Data Analysis and Visualization
  • Network and System Administration Tools
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What is a Data Flow Diagram (DFD)?
A graphical method of describing the path data takes through a system
26
What are the features of a Data Flow Diagram?
* Data stores * External entities * Processes * Data flows
27
Identify the symbols used in Data Flow Diagrams and their explanations.
* Open Rectangle: Data Store * Rectangle: External Entity * Circle: Process * Arrow: Data Flow
28
What are the steps involved in constructing a Data Flow Diagram?
* Identify the ORCA * Draw the symbols for the ORCA * Fill in any blanks for logical flow
29
What is a Context Diagram?
A graphical representation of data movement between an Information System and associated people/organizations
30
What are Structure Charts used for?
To graphically model the relationship between modules within a system
31
What is the primary function of a Structure Chart?
To create a template in preparation for the actual source code
32
What do UML Class Diagrams represent?
They visualize object-oriented systems, showing classes, attributes, operations, and relationships among objects
33
List the basic components of a Class Diagram.
* Class name * Attributes (including data type) * Methods * Relationships * Inheritance
34
What is the process of design used to develop code in an OOP language?
Defining the task, choosing a design approach, using design patterns, and incorporating agility
35
What is a 'Task Definition' in software development?
Clearly defining the requirements and objectives of the program
36
Compare Top-Down and Bottom-Up software development approaches.
* Top-Down: Starts with high-level view, breaks down into components * Bottom-Up: Starts with individual components, builds the overall system
37
Identify the advantages of the Top-Down design approach.
Provides a clear overview of the system
38
What is the Facade Pattern used for?
To provide a simplified interface to a complex system, promoting modularity and encapsulation
39
What does 'Agility' refer to in software development?
The ability to adapt and respond to changes quickly and efficiently
40
Identify the main components used to assess the effectiveness of programming code.
* Correctness * Efficiency * Readability * Maintainability * Scalability
41
What are 'type hints' in Python?
A feature that specifies the expected data types of variables, function parameters, and return values
42
List five common programming mistakes.
* Poorly named variables or functions * Unnecessarily complex logic * Lack of comments/documentation * Ignoring error handling * Not modularising code
43
What is message-passing in OOP?
A mechanism that allows objects to exchange information and request actions from one another
44
What are the basic components of message-passing?
* Sender * Receiver * Message
45
What are the benefits of message-passing?
Promotes modularity, encapsulation, reusability, and flexibility
46
What are the drawbacks of message-passing?
Can introduce complexity and may be less efficient than direct method calls
47
What is the purpose of code optimization in software engineering?
To improve efficiency and lower memory usage while ensuring easier maintenance
48
Name three code optimization techniques.
* Algorithmic optimizations * Data structure optimizations * Memory optimizations
49
Identify features of OOP that support collaborative code development.
* Consistency * Code commenting * Version control * Feedback mechanisms
50
What are the advantages of consistent code development?
Improves code readability and eases collaboration among team members
51
What is the importance of commenting code?
Helps other developers understand code easily and reduces time spent deciphering functionality
52
What are the advantages of feedback mechanisms in code development?
Facilitates idea exchange and improves code quality through continuous learning
53
What is the purpose of comments in code?
Helps other developers understand your code more easily and reduces the time spent deciphering its functionality.
54
What do feedback mechanisms facilitate in code development?
Facilitates the exchange of ideas, suggestions, and critiques among team members.
55
Identify features of version control that support collaborative development.
* Code reviews * Pair programming * Continuous integration
56
What are code reviews?
Involve team members reviewing each other's code, identifying issues, and suggesting improvements.
57
What is pair programming?
When two developers work together on the same code, sharing ideas and solutions.
58
What is continuous integration?
Involves regularly integrating and testing code changes to catch errors early.
59
Name examples of version control systems.
* Git * Subversion (SVN) * Mercurial
60
What is Git?
A tool used by developers to keep track of changes in their code.
61
Identify 3 version control functionalities within Git.
* Branching * Merging * Pull requests
62
Explain the Branching functionality in Git.
Creating a separate line of development within a repository, diverging from the main line.
63
Explain the Merging functionality in Git.
Integrates changes from one branch into another, often after a review process.
64
Explain the Pull Request functionality in Git.
A way to notify team members that changes in a branch are ready to be reviewed and merged.
65
What is branching in programming?
A control structure that allows execution based on whether a condition is true or false.
66
What is iteration in programming?
A control structure that repeats a block of code until a specified condition is met.
67
What are functions in programming?
Encapsulated blocks of code designed to perform a specific task.
68
What do branching, iteration, and functions enable programmers to do?
Write clear and reusable code.
69
What is deemed 'good practice' in implementing OOP code?
* Clear and Uncluttered Mainline * One Logical Task per Subroutine * Use of Stubs * Use of Control Structures and Data Structures * Ease of Maintenance * Version Control * Regular Backups
70
Explain the phrase, Clear and Uncluttered Mainline.
The main part of your code where everything starts, easy to read and understand.
71
Explain the phrase, One Logical Task per Subroutine.
Each subroutine should have one clear purpose or task to perform.
72
What are Stubs?
Placeholders or simplified versions of code that stand in for more complex parts.
73
What is the purpose of using Control Structures and Data Structures?
Control structures help control the flow of execution; data structures organize data.
74
Explain the phrase, Ease of Maintenance.
How easy it is to update and modify your code in the future.
75
What is Version Control?
Keeping a history of changes to your code, allowing tracking and reverting to previous versions.
76
What does 'regular backup' mean in programming?
Periodically saving copies of your program’s code and data to protect against data loss.
77
What is unit testing?
Checks individual pieces of code to ensure they work properly.
78
What is subsystem testing?
Checks groups of components working together.
79
What is system testing?
Checks the whole system to ensure everything works as expected.
80
What is the purpose of the calculator program?
To perform basic arithmetic operations (+, -, *, /) based on user input ## Footnote The program allows users to input numbers and select an operation to compute a result.
81
What happens when the user inputs 'exit'?
The calculator program terminates and displays a goodbye message
82
What operations does the calculator support?
* Addition (+) * Subtraction (-) * Multiplication (*) * Division (/)
83
What error is raised when dividing by zero?
ValueError
84
What is the purpose of the TestCalculatorSystem class?
To test the correctness of arithmetic operation functions
85
What does Black Box Testing involve?
Testing inputs and outputs without knowing internal workings
86
What does White Box Testing examine?
The internal logic and structure of the code
87
What is Grey Box Testing?
A combination of black box and white box testing
88
What does quality assurance in software engineering aim to ensure?
That the code meets standards and requirements, preventing defects
89
Who oversees quality assurance standards in Australia?
Quality Assurance Services Pty Ltd (QAS)
90
What methodologies do software engineers use for quality assurance?
* Writing comprehensive test suites * Performing code reviews * Following coding standards * Utilizing static code analysis tools * Implementing CI/CD pipelines
91
What are the key characteristics of high-quality software?
* Reliability * Usability * Accuracy * Maintainability * Testability * Re-usability
92
What is unit testing?
Testing individual pieces of code to ensure they work properly
93
What does module level testing involve?
Testing each module individually as it is created
94
What is the purpose of program level testing?
To ensure modules and subroutines work together correctly
95
What does system level testing aim to ensure?
That all components of the system function together properly
96
What should be considered for quality assurance at the hardware and software testing level?
* Compatibility with operating systems * Testing different hardware configurations * Ensuring compliance with other applications
97
What are classes in OOP?
Blueprints for creating objects with predefined attributes and methods
98
What is encapsulation in OOP?
Bundling data and methods within objects to restrict access
99
What is inheritance in OOP?
A mechanism for creating new classes based on existing ones
100
What does polymorphism allow in OOP?
Enables objects of different types to be accessed through the same interface
101
What is the PRIMM methodology?
A framework used to teach programming and computational thinking
102
What does agile development emphasize?
Iterative development, continuous feedback, and adaptability
103
What is static code analysis?
Analyzing code for potential errors without executing it
104
What is the purpose of documentation in software development?
To explain how the code works and how to use it
105
What is regression testing?
Re-running tests to ensure changes have not introduced new bugs
106
What is acceptance testing?
Evaluating software to ensure it meets specifications and user needs
107
What is a test plan?
A document outlining the objectives, scope, approach, and schedule of testing activities
108
What is a Test Case?
A set of conditions or variables used to determine if a software feature works correctly. ## Footnote Test cases are essential for validating functionality during software testing.
109
What is Acceptance Testing?
Evaluating software to ensure it meets the required specifications and user needs. ## Footnote Acceptance testing often involves end-users to confirm the software's readiness.
110
What does a Test Plan outline?
Objectives, scope, approach, and schedule of testing activities. ## Footnote A test plan serves as a roadmap for the testing process.
111
What does 'Account for' mean?
State reasons for, report on. ## Footnote Often used in analytical writing to explain decisions or outcomes.
112
Define 'Analyse'.
Identify components and the relationship between them; draw out and relate implications. ## Footnote Analysis is crucial for understanding complex systems.
113
What does 'Apply' refer to in educational contexts?
Use, utilise, employ in a particular situation. ## Footnote Application of knowledge is essential for practical learning.
114
What does it mean to 'Appreciate'?
Make a judgement about the value of. ## Footnote Appreciation can involve critical thinking and evaluation.
115
What does 'Assess' involve?
Make a judgment of value, quality, outcomes, results or size. ## Footnote Assessment can be qualitative or quantitative.
116
What is meant by 'Calculate'?
Ascertain/determine from given facts, figures or information. ## Footnote Calculating is a fundamental skill in mathematics and science.
117
What does 'Clarify' mean?
Make clear or plain. ## Footnote Clarification is often needed to enhance understanding.
118
What does it mean to 'Classify'?
Arrange or include in classes/categories. ## Footnote Classification helps in organizing information systematically.
119
What is the purpose of 'Compare'?
Show how things are similar or different. ## Footnote Comparing is essential for analysis and decision-making.
120
What does 'Construct' refer to?
Make; build; put together items or arguments. ## Footnote Construction can apply to both physical and abstract concepts.
121
What does 'Contrast' mean?
Show how things are different or opposite. ## Footnote Contrasting is a key analytical skill.
122
What does 'Critically' imply in analysis?
Add a degree or level of accuracy, depth, knowledge and understanding, logic, questioning, reflection and quality to (analyse/evaluate). ## Footnote Critical analysis is essential for higher-level thinking.
123
What does 'Deduce' mean?
Draw conclusions. ## Footnote Deduction is a logical process used in reasoning.
124
Define 'Define'.
State meaning and identify essential qualities. ## Footnote Defining terms is fundamental in establishing clear communication.
125
What does 'Demonstrate' entail?
Show by example. ## Footnote Demonstrations are often used in teaching to clarify concepts.
126
What does 'Describe' involve?
Provide characteristics and features. ## Footnote Description helps in creating a vivid understanding of a topic.
127
What is the goal of 'Discuss'?
Identify issues and provide points for and/or against. ## Footnote Discussion is a critical part of collaborative learning.
128
What does 'Distinguish' mean?
Recognise or note/indicate as being distinct or different from; to note differences between. ## Footnote Distinguishing is crucial for clear understanding.
129
What does 'Evaluate' mean?
Make a judgement based on criteria; determine the value of. ## Footnote Evaluation is often used in assessments and reviews.
130
What does 'Examine' involve?
Inquire into. ## Footnote Examination is a foundational concept in research.
131
Explain the term 'Explain'.
Relate cause and effect; make the relationships between things evident; provide why and/or how. ## Footnote Explanation is crucial for understanding complex ideas.
132
What does 'Extract' mean?
Choose relevant and/or appropriate details. ## Footnote Extracting information is vital in research and analysis.
133
What does 'Extrapolate' refer to?
Infer from what is known. ## Footnote Extrapolation is often used in predictive analysis.
134
What does 'Identify' mean?
Recognise and name. ## Footnote Identification is key in categorizing information.
135
What does 'Interpret' entail?
Draw meaning from. ## Footnote Interpretation can vary based on context.
136
What does 'Investigate' mean?
Plan, inquire into and draw conclusions about. ## Footnote Investigation is essential in research methodologies.
137
What does 'Justify' involve?
Support an argument or conclusion. ## Footnote Justification is important in persuasive writing.
138
What does 'Outline' mean?
Sketch in general terms; indicate the main features of. ## Footnote Outlining is a useful tool for organizing thoughts.
139
What does 'Predict' refer to?
Suggest what may happen based on available information. ## Footnote Prediction is often used in scientific research to hypothesize outcomes.
140
What does 'Propose' mean?
Put forward (for example a point of view, idea, argument, suggestion) for consideration or action. ## Footnote Proposing ideas is a key part of collaborative discussions.
141
What does 'Recall' mean?
Present remembered ideas, facts or experiences. ## Footnote Recall is essential in testing and memory assessments.
142
What does 'Recommend' involve?
Provide reasons in favour. ## Footnote Recommendations are often used in decision-making processes.
143
What does 'Recount' mean?
Retell a series of events. ## Footnote Recounting is often used in narrative writing.
144
What does 'Summarise' entail?
Express, concisely, the relevant details. ## Footnote Summarization is a key skill in effective communication.
145
Define 'Synthesize'.
Putting together various elements to make a whole. ## Footnote Synthesis is crucial in creating comprehensive understanding.