A Brief Introduction to Object-Oriented Programming (OOP)

Quiz
•
Computers
•
University
•
Hard

Anthony Scavarelli
Used 1+ times
FREE Resource
6 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Why is OOP so powerful and popular?
Everyone loves it.
Reusable code.
Simple to debug.
Because Comp. Sci. Professors say so.
Answer explanation
Object-oriented programming (OOP) is about modelling a system as a collection of objects, where each object represents an aspect of the system. Objects contain both data and methods/functions.
- Good: highly reusable code.
- Bad: increased complexity.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is a Class?
A "recipe" used to create objects
An object
Where I take my courses
An recursive function
Answer explanation
- Class: The “recipe,” or code, that defines an object. E.g., the “Cookie” definition in code.
- Object/Instance: When we run our code, the class (“recipe”) is used as a template to create an object, using the “new” keyword we can use in our code. We can create multiple objects from one class.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is abstraction in OOP?
Hiding all information from others.
Making things obtuse.
Hiding the complex implementation details and showing only the necessary features of an object.
Showing only the complex parts.
Answer explanation
We can control the visibility of internal mechanisms, exposing a much simpler interface to other parts of the program.
E.g., We may call someCookie.addSprinkles() from another area of the program, and yet we don’t need to know how that method/function works.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is encapsulation in OOP?
Allowing access to all parts of an object.
Bundling all complexities and hiding them.
A method to increase usability.
Bundling data and methods into a single object.
Answer explanation
Refers to the ability to “bundle” data and properties into an object and control their visibility to other parts of the program.
E.g. a “Cookie” Class has protected properties (numChocolateChips, radius), and we can ”get” all of these through accessors of the cookie object like the public someCookie.getRadius().
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is Inheritance in OOP?
Process of creating a new class.
Passes on method parameters to other methods.
Allows a new class to retain wealth.
Allows a new class to inherit properties and behaviors from an existing class.
Answer explanation
We can reuse code from other classes by creating a new class that extends another. This allows us to create variations of a class without having to duplicate code.
E.g., We can create another class called ”Biscotti” that inherits from “Cookie.” A biscotti is very different from a traditional “cookie” but will share many properties (e.g., numChocolateChips) and methods (bake()). We may also add other properties, like private length and private height.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is polymorphism in OOP?
Limits access to methods and data.
Allows objects of different classes to have different behaviours through similar interfaces.
Is a way to change things.
Allows an object to change class.
Answer explanation
Allows different objects to have different functionality when calling the same method.
E.g., we may override the method of “bake()” in the class “Cookie” to bake a biscotti differently in the “Biscotti” class. We can use the same method name (bake()) on objects from both classes, but they work very differently.
Similar Resources on Wayground
10 questions
Python - Functions

Quiz
•
University
10 questions
The OOP Quiz

Quiz
•
University
10 questions
Week 9 C# (for Java programmers)

Quiz
•
University
10 questions
Python Orientado a Objetos

Quiz
•
12th Grade - University
10 questions
SPRING INTRODUCTION

Quiz
•
University
11 questions
Databases for Cloud Computing

Quiz
•
University
10 questions
Java Unit 1

Quiz
•
University
11 questions
Pemrograman Berorientasi Objek Quiz

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

Quiz
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
15 questions
Properties of Equality

Quiz
•
8th Grade - University
38 questions
WH - Unit 3 Exam Review*

Quiz
•
10th Grade - University
21 questions
Advise vs. Advice

Quiz
•
6th Grade - University
12 questions
Reading a ruler!

Quiz
•
9th Grade - University