Generic Coding Flashcards
What is a Data Structure?
A data structure is a storage format that defines the way data is stored, organized, and manipulated.
Some popular data structures are Arrays, Trees, and Graphs.
What is an Array?
An array is commonly referred to as a collection of items stored at contiguous memory locations.
Items stored are of the same type.
It organizes data so that a related set of values can be easily sorted or searched.
What is a Linked List?
Like an array, a linked list refers to a linear data structure in which the elements are not necessarily stored in a contiguous manner.
It is basically a sequence of nodes, each node points towards the next node forming a chain-like structure.
What is LIFO?
LIFO is an abbreviation for Last In First Out
It is a way of accessing, storing and retrieving data.
It extracts the data that was stored last first.
What is a Stack?
A stack refers to a linear data structure performing operations in a LIFO (Last In First Out) order.
In a stack, elements can only be accessed, starting from the topmost to the bottom element.qw45
What is a Queue?
A queue refers to a linear data structure that performs operations in a FIFO order.
In a queue, the least recently added elements are removed first as opposed to a stack.
What are Binary Trees?
A binary tree is an extension of the linked list structure where each node has at most two children.
A binary tree has two nodes at all times, a left node and a right node.
What is Recursion?
Recursion refers to a function calling itself based on a terminating condition.
It uses LIFO and therefore makes use of the stack data structure.
What is the OOPs concept?
OOPs stands for Object-Oriented Programming System, a paradigm that provides concepts such as objects, classes, and inheritance.
What are the concepts introduced in OOPs?
Following are the concepts introduced in OOPs:
Object - A real-world entity having a particular state and behavior. We can define it as an instance of a class.
Class - A logical entity that defines the blueprint from which an object can be created or instantiated.
Inheritance - A concept that refers to an object gaining all the properties and behaviors of a parent object. It provides code reusability.
Polymorphism - A concept that allows a task to be performed in different ways. In Java, we use method overloading and method overriding to achieve polymorphism.
Abstraction - A concept that hides the internal details of an application and only shows the functionality. In Java, we use abstract class and interface to achieve abstraction.
Encapsulation - A concept that refers to the wrapping of code and data together into a single unit.
This is one of the very common coding interview questions, that often allows the interviewer to branch out into related topics based on the candidate’s answers
Explain what a Binary Search Tree is.
A binary search tree is used to store data in a manner that it can be retrieved very efficiently.
The left sub-tree contains nodes whose keys are less than the node’s key value.
The right sub-tree contains nodes whose keys are greater than or equal to the node’s key value
Explain Doubly Linked Lists?
Doubly linked lists are categorized as a special type of linked list in which traversal across the data elements can be done in both directions.
This is made possible by the presence of two links in every node, one that links to the node next to it and another that connects to the node before it.