SkillStorm Interview Prep Flashcards
Length
Array - Find length of Array
len = my________._________; // gets length
len = myArray.length;
Length
ArrayList - Find length of ArrayList
len = my________.________(); // gets length
len = myList.size(); // gets length
Get
Array - Get item at index 3
x = my_________[]; //gets item at index 3
x = myArray[3]; // gets item at index 3
Get
ArrayList - Get item at index 9
x = my_________.________( ); // gets item at index 9
x = myList.get(9); // gets item at index 9
Insert
Array - Put an item at index 4 equal to 7
my_______[] = __; // sets item at index 4 equal to 7
myArray[4] = 7; // sets item at index 4 equal to 7
Insert
ArrayList - Put a 7 at the end of the list
my________.________(__); // adds 7 to the end of the list
ArrayList - Put a 7 at the third position
my________.________(__,__); // adds 7 at index 3
myList.add(7); // adds 7 to end of list
myList.add(2, 7); // adds 7 to index 3
Create
Array - Create different types of arrays
int[] my_______ = _______ int[];
int[] my_______ = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
Dog[] ______ = new _______[__];
int[] myArray = new int[10];
int[] myArray = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
Dog[] dogs = new Dog[25];
Create
ArrayList - Make several types of ArrayList
ArrayList my________ = new Array________<>( );
Array_________ cats = ________ Array________( );
Array________ _________ = new Array________(25);
ArrayList myList = new ArrayList<>();
ArrayList cats = new ArrayList();
ArrayList cats = new ArrayList(25);
Array v ArrayList
Array__ArrayList
Length: _______ Length _________ Length
Data Types: _________, Objects ________, Generics
Performance: Get and Insert in __(_) Get and Insert in __(_)
Array v ArrayList
Array__ArrayList
Length: Fixed Length Variable Length
Data Types: Primitives, Objects Objects, Generics
Performance: Get and Insert in O(1) Get and Insert in O(1)
OOPS Concepts:
What is an Object?
Real World ________, ________, and Performs __________
Example: Human ==> Properties ==> ________, Color, _________ etc.
Human ==> Tasks Performed ==> _________, Run, ________, Write etc.
Entity, Properties and Performs Tasks
Name, Color, Height
Walk, Run, Read, Write
Class
What is a Class? ________ of an __________
It is a ___________ that an ________ follows
If Human is the Object then __________ can be a Class
Student ==> ________ (variable) ==> ________, __________, __________ etc.
Student ==> ________ => Read, and Write
Instance, Object
Blueprint, Object
Student
Properties, Name, Roll Number, DOJ
Tasks
What are the Four Pillars of Object Oriented Programming?
____________
____________
____________
____________
Abstraction
Polymorphism
Inheritance
Encapsulation
Abstraction I
Abstraction refers to only showing ________ _________ and keeping everything else ___________
If car is the class, we can know car.pushGas() is a _______ that will make the car go _________ even if we don’t understand the ________ that makes it do so.
If classes are _________, then one change creates a ________ effect that causes many more _________.
essential, details, hidden
method, forward, code
entangled, ripple, changes
Abstraction II
Creating an __________ through which _________ can interact ensures that each piece can be __________ developed.
Abstraction allows the program to be worked on ________ and prevents it from becoming _________ and _________.
Determine specific points of __________ that can act as an __________ between _________, and only worry about the implementation when _________ it.
interface, classes, individually
incrementally, entangled, (and) complex
contact, interface (between) classes, coding
Polymorphism
Polymorphism describes _________ that are able to take on many ________.
There are two types polymorphism: _________ and _________.
methods, forms
static, dynamic
Polymorphism II
continuing Dynamic Polymorphism…
The implementation of the subclass that the _________ is an instance that __________ that of the superclass.
Car and sportsCar both have .drive(miles) ________ but the .drive(miles) on Car class __________ Car.gas 0.04 miles and the .drive(miles) on the sportsCar Class decreases Car.gas by _.__ miles yet that all changes when you make an instance of sportscar called mySportsCar.drive() which will _________ Car.gas by 0.02 but an instance of ________.__________() will decrease the Car.gas by 0.04 miles
object, overrides
methods, decreases, 0.02, decrease, myCar.drive, decrease, myCar.drive
Polymorphism III
continuing Dynamic Polymorphism…
Dynamic Polymorphism works because the form of the _________ is decided based on where in the class ________ it is called.
The implementation of a method ____ that will be used is determined _________ as the proram is run
method, hierarchy
signature, dynamically
Polymorphism IV
Static Polymorphism cont…
Static Polymorphism occurs during the _________ rather than _________.
Static Polymorphism refers to when multiple methods with the same _________ but different ________ are defined in the ________ class.
How do you differentiate methods of the same name? Different order of ____, Different ________ of parameters and Different ________ of parameters. This is known as method ______. Despite the methods having the same name, their ____ are different due to their ____ arguments.
compile-time, runtime
name, arguments, same
parameters, order, types, overloading, signatures, different
Polymorphism V
Static Polymorphism cont…
Method overloading can cause ____ if you do not keep in mind which _____ you need for which _____.
Using the ______ argument may not cause an error if it matches that of another form of the ____, which can cause issues.
Overall, _____ allows methods to take on many different ____.
When utilizing polymorphism and method ____, be sure that you’re calling the correct ____ of the method.
trouble, parameters, implementation
incorrect, method
Polymorphism, forms
overloading, form
Inheritance
____ is the principle that allows classes to derive from other _________.
Subclass inherits from Superclass
____________ ====> ___________.
Game Example:
________ Weapon ====> ________ Sword (weapon.damageType = “sharp”)
OR
class _________ ====> ________ Club (weapon.damageType = “blunt”)
Inheritance, classes
Superclass, Subclass
class, class
OR
Sword, class