OOP

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/21

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 12:53 AM on 2/7/25
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

22 Terms

1
New cards

What is Object-Oriented Programming (OOP)?

Object-Oriented Programming (OOP) is a programming paradigm that structures code around objects that encapsulate state (data fields) and behavior (methods).

2
New cards

What are the four pillars of OOP?

Encapsulation, Abstraction, Inheritance, Polymorphism.

3
New cards

Fill in the blank: A class is a _______ for creating objects.

blueprint

4
New cards

Fill in the blank: An object is an _______ of a class.

instance

5
New cards

What is a constructor in Java?

A constructor is a special method that initializes an object when it is created.

6
New cards

What is encapsulation?

Encapsulation restricts direct access to object data and provides controlled access through getter and setter methods.

7
New cards

What is inheritance?

Inheritance allows a class (child class) to acquire properties of another class (parent class).

8
New cards

What is polymorphism?

Polymorphism allows methods to be used in different ways, specifically through method overloading and overriding.

9
New cards

What is an abstract class?

An abstract class cannot be instantiated and may contain abstract methods.

10
New cards

What is an interface?

An interface defines a contract for classes to follow.

11
New cards

What is an exception?

An exception is an unexpected event that disrupts program execution.

12
New cards

What are checked exceptions?

Checked exceptions are exceptions that must be handled, such as IOException.

13
New cards

What are unchecked exceptions?

Unchecked exceptions are runtime errors, such as NullPointerException.

14
New cards

How do you read a file in Java?

Using Scanner to read the file contents.

15
New cards

What is a 1D array in Java?

A 1D array stores a linear sequence of elements.

16
New cards

How do you declare and initialize a 1D array?

Declare with int[] arr = new int[5]; and initialize with int[] arr = {1, 2, 3, 4, 5};.

17
New cards

How do you declare a 2D array in Java?

Declare with int[][] matrix = new int[3][3]; for a 3x3 matrix.

18
New cards

What is a ragged array?

A ragged array is a 2D array where rows have different column sizes.

19
New cards

What are the different types of loops in Java?

For loop, While loop, Do-while loop.

20
New cards

What is garbage collection in Java?

Java automatically reclaims unused objects.

21
New cards

What is multithreading?

Multithreading allows concurrent execution of tasks.

22
New cards

What is the Singleton design pattern?

The Singleton design pattern ensures only one instance of a class.