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
Inheritance II
Hierarchy:
Class hierarchies created will have many more _______ with many more ________ in each layer.
Class hierarchy acts as a ____ of classes with different ______ to one another
layers, classes
web (of) , relationships
Inheritance III
Access Modifiers:
Access modifiers change which classes have ________ to other classes, __________, or __________.
The three type of access modifiers are _________, _________, and _________.
Public members can be accessed from anywhere both inside of the class ____ it is defined in as well as ____ in the rest of the ____.
access, methods (or) attributes
Public, Private, (and) Protected
hierarchy, outside, program
Inheritance IV
Access Modifiers cont. - Private:
Private ____ can only be accessed from within the ____ class that the member is ____.
This allows you to create multiple ____ members of the same name in different ____ so that they do not ____ with one another.
members, same, defined
private, locations, conflict
Inheritance V
Accessing Modifiers cont. - Protected:
Protected members can be accessed within the ____ it is ____, as well as any ____ of that class.
This essentially makes protected members ____ to the hierarchy in which they are ____.
class, defined, subclasses
private, defined
Encapsulation I
Encapsulation refers to ____ data with methods that can operate on that ____ within a ____.
Essentially, it is the idea of ____ data within a class, preventing anything ____ that class from directly ____ with it.
This does not mean that ____ of other classes cannot interact at all with the ____ of another ____.
bundling, data, class
hiding, outside, interacting
members, attributes, object
Encapsulation II
Methods:
Members of other classes can interact with the attributes of another object through its ____.
Remember, methods are the ____ defined within the ____.
Methods: Getting ====> Retrieving ____
Methods: Setting ====> ____ Information
Setting methods also allow the programmer to easily keep track of ____ that depend on one another i.e. Method 1 ==> ____ 2.
methods
functions, class
Information
Changing
attributes, Method
Encapsulation III
Setter Method
If you have Class Player1 with attributes Player1.maxHealth and Player1.currentHealth and a method Player.levelUp(), when the player levels up, you want their ____ health to ____. When that happens you want the ____ health to match their max health. Instead of having to increase each type of health separately, you can ____ a ____ setting method.
maxHealth ____ method allows both attributes (maxHealth, currentHealth) to be changed ____ as they should, rather than requiring you to ____ change them.
max, increase, current, create, maxHealth
setting, simultaneously, individually
Encapsulation IV
Setter Method cont.:
The following setting method ensures that the change to the ____ is within the ____ that is allowed:
def setCurrentHealth(____):
____.currentHealth = newHealth
if player.____ > player.____
player.currentHealth = ____.maxHealth
attribute, boundary
def setCurrentHealth(newHealth):
if player.currentHealth > player.maxHealth
player.currentHealth = player.maxHealth
Encapsulation V
Getter Method - Chess Example
You may also want some attributes to be “____ only” from the outside
To do this, you would define a ____ method but not a ____ method
The ____ could only be referenced, not ____.
Chess Example
You have a Class Piece with attributes ____.rank and ____.file and you want to move this piece so you create a new ____ called Piece.move()
read
getter, setter
variable, changed
Piece, Piece, method
Encapsulation VI
Getter Method cont.:
Piece.move() which allows validation by checking whether the new rank and file is ____, if it’s on the ____ still, if it is occupied by a piece of the ____ color and finally if it doesn’t put the King in a check position.
Information Hiding:
It’s generally best to not allow ____ classes to directly ____ an object’s ____.
This is very important when working on ____ and ____ programs.
empty, board, opposite
Information Hiding:
external, edit, attributes
large, complex
Encapsulation VII
Information Hiding cont.:
Each piece should not have access to or rely on the ____ workings of other sections of ____.
____ hiding, or keeping the ____ of one class hidden from external classes, helps you keep control of your ____ and prevent it from becoming too ____.
Encapsulation is a vital principle in ____ because it keeps the programmer in control of access to ____ and prevents the program from ending up in a ____ or unwanted state.
inner, code
Information, data, program, complicated
Object Oriented Programming, data, strange
- What does SQL stand for?
- What type of Database is it?
- Who developed it and where and when was it developed?
- What does SEQUEL stand for?
- What is SQL?
- Is it a declarative or a procedural language?
- Structured Query Language
- Relational Database
- Chamberlain and Boyce developed it at IBM in the 1970s
- Structured English QUEry Language
- A powerful language that uses English Sentences
- Declarative
Data is a collection of ____, ____, and ____ from different sources.
Database is a ____ where data is ____ in a certain ____.
Types of Databases:
____, ____, ____, ____, ____, ____, ____, ____
Most popular databases is ____ and ____.
A few popular Databases are ____, my____, ____SQL, ____, SQL _____
facts, figures, and values
location, stored, format
Distributed Database, Centralized Database, Graph Database, Object Oriented Database, Operational Database, NoSQL Database, Cloud Database, Relational Database
Relational (and) NoSQL
mongoDB, SQL, postgres, Oracle, Server
Simple Database Queries:
-To make a Database
____ database RajsLibrary
-To delete a Database
____ database RajsLibrary
create
drop
Table is a collection of data in ____ form.
Table consists of ____ and ____.
Intersecting of a column and row is a ____.
Table can have unlimited ____ but numbered amount of ____.
Rows are ____.
Each column is an ____ of the data i.e. ____, ____, Age, Measurement etc.
tabular
columns (and) rows
Cell
rows, columns
Tuples
attribute ID, Name
- What is a table constraint? specified by the ____ when creating the ____.
- When must table constraints be decided?
- What must you do if you want to change the constraints?
- What is the list of the Normal Constraints?
- A restriction specified by the user when creating the table?
- Before the table is created.
- You have to delete the table and create a new table with the desired restraints.
- Not Null, Check Default, Foreign Key, Primary Key, Unique, and Index
What will the following queries do?
- Select * from RajsLibrary
- Select ID from RajsLibrary
- SELECT FName FROM Student WHERE City = “Clearwater”
- This will produce the whole table
- This will produce only the column with the ID attribute
- This will produce all rows with the FName attribute where the city attribute is Clearwater
- ->AND Query
- >This operator displays a record if ____ the conditions separated by AND are ____.
- ->OR Query
- >This operator displays a record if ____ of the conditions separated by OR is ____.
- ->NOT Query
- >This operator displays a record if the ____(s) are NOT TRUE
- ->INSERT INTO Query
- >If we want to insert any new ____ or ____ into a table then we can use the INSERT INTO query
ALL, TRUE
ANY, TRUE
CONDITION(S)
RECORD (or) DATA
–> AGGREGATE FUNCTIONS
===>COUNT Function
==>This function returns the number of ____ that match specified ____
===>AVERAGE Function
==>This function returns the ____ value of a numeric ____
===>SUM Function
==>This ____ returns the ____ of a numeric column
===>MIN Function
==>This function returns the ____ value of the ____ column
rows, criteria
average, column
function, sum
smallest, selected
–>GROUP BY
—>Used in SQL to arrange ___ data into groups with the help of some ____.
–>HAVING
—>Use to place ____ where we need to decide which group will be the part of ____ result-set
–>ORDER BY
—>This keyword is used to sort the ____-____ in ascending or ____ order.
–>NULL VALUES
==>IS NULL is used to test the ____ values
==>>IS NOT NULL is used to test for ____-____ values
–>UPDATE
—>The Update command is used to modify ____ in a table
identical, functions
conditions, final
result-set, descending
empty
non-empty
rows
>DELETE
- –>The SQL DELETE command is used to delete ____ that are no longer ____ from the database tables
- ->IN OPERATOR
- –>IN operator is used to specify multiple values inside the ____ clause. It acts as short for multiple ____
- ->BETWEEN OPERATOR
- –>BETWEEN operator will select a particular ____ within the specified ____.
rows, required
WHERE, OR
value, range
BIG-O Rules
- If you have steps in your ____, you ____ them: O(a + b)
- ____ constants.
- Different ____ ==> ____ variables
- Drop non-_____ terms
- algorithm, add
- Drop
- inputs, different
- dominant
HashMap:
- Allows you to store ____-____ associations
- HashMap is similar to a ____.
- HashMaps allows us to convert a large ____ into a shorter ____-____ value that will represent the ____ string
- In Java, every object has a method ____ int ____( ) that will return a hash value for a given ____
Key-Value
Dictionary
string, fixed-length, original
public, hashcode(), object
Stacks & Queues
Both are ____ structures
Both have various ____
Stacks:
Last In First Out (____)
Queue:
____ In First ____ (FIFO)
linear
sizes
LIFO
First, Out
- Each box in a ____ can be considered an object considering we have made a ____ called “Box” for each ____ in our LinkedList.
- Int Data represents whatever ____ is in each box and that can be anything from ____, ____, etc.
- A regular LinkedList goes in ____ direction and the ____ will be all the way to the ____ like how we read.
- head.____ would give the data in the first ____ all the way to the left
- head.next.data would give us the ____ in the ____ box from the ____
LinkedList, class, node
data, integers, strings
one, head, left
data, box
data, second, left
-> Abstraction
–> Showing only ____ parts —> hiding the ____
===> Android Application ==> AP
-> Polymorphism
–> Performing the same ____ (task means method) in different ways
Examples:
1. ____ ( )
2. Add (___ a, ____ b)
draw Polygon( )
1. Draw a ____
2. ____ rectangle
3. Draw ____
Note: All three are ____
essential, implementation
tasks
- Add ()
int, int
square
Draw
triangle
polygons
We can implement the ____ with:
- Method ____ -> Can be achieved with Compile-Time
- ____ Overriding -> Can be achieved with ____-____.
polymorphism
Overloading
Method, Run-Time
Encapsulation is the mechanism of wrapping up ____ and code acting on the ____ together as a single ____.
Encapsulation is achieved by ____ the variables of a class as ____ and then providing the public setter and ____ methods to modify and ____ the variables values.
An ____ in java is a ____ of a class which contains static constants and ____ methods and enables ____ inheritance and helps in achieving ____ coupling and lastly it provides 100% of ____
data, methods, unit
declaring, private, getter, view
interface, blueprint, abstract, multiple, loose, abstraction
An ____ class is a template definition to methods and variables of a ____ that contains ___ or more abstracted _____.
It can provide from ____ to ____% of abstraction
Abstract Classes must be declared with an ____ keyword, can have abstract and ____-abstract methods, cannot be ____, and can have ____ and static methods.
Run-Time Polymorphism or ____ Polymorphism is resolved during ____ time.
Method ___ is an example of run ____ polymorphism
An ____ method is called through the ____ variable of a Superclass
abstract, class, one, methods
0 (to) 100
abstract, non, instantiated, constructor
dynamic, run
Overriding, time
overridden, reference
Rules of Overloading
- Overriding method ____ list must match the ____ method
- The ____ type must be the same or ____ of overridden method
- Access level cannot be more ____ than the overridden method
argument, overridden
return, subtype
restrictive
Compile Time Polymorphism or ____ Polymorphism is resolved during ____ time
Overloading is an example of ____ time polymorphism
- Overloaded methods must have a different ____ list.
- It can have different ____ types if ____ list is ____.
- It can throw different ____.
- It can have different ___ modifiers
Static, compiler
compile
- argument
- return, argument, different
- exceptions
- access
Object Oriented Programming
- ____ Up approach
- Divided into ____
- Has ____ modifiers
- Objects can move & communicate with each other through ____ functions
- More ____
- Supports ____
Procedural Programming
- Top ____ approach
- Divided into ____
- Doesn’t have ____ modifiers
- Data can move freely from ____ to ____ in the system
- Less ____
- Does not support ____
- Bottom
- objects
- Access
- member
- secure
- overloading
- Down
- functions
- Access
- function (to) function,
- secure
- overloading