Wednesday, 8 June 2022

Generic

 What is Reactive Programming?

For example, in an imperative programming setting, a := b + c would mean that a is being assigned the result of b + c in the instant the expression is evaluated, and later, the values of b and c can be changed with no effect on the value of a. On the other hand, in reactive programming, the value of a is automatically updated whenever the values of b or c change, without the program having to explicitly re-execute the statement a := b + c to determine the presently assigned value of a.

What is JPA?

The Java Persistence API (JPA) is a specification of Java. It is used to persist data between Java object and relational database. JPA acts as a bridge between object-oriented domain models and relational database systems. As JPA is just a specification, it doesn't perform any operation by itself.

What is microservices?

Microservices are an architectural and organizational approach to software development where software is composed of small independent services that communicate over well-defined APIs

Vue.js

FrontEnd Developer: Specialized Knowledge of HTML, CSS, and JavaScript skills – Angular experience preferred, AngularJS, Vue.js, React a plus; Experience with Jenkins, NPM, Gulp.js.; Automated unit testing – Jasmine, JEST.; Automated functional testing –Selenium, Cypress.

Java Developer : Java, JPA, Spring, Spring-boot, Reactive programming; Experience in Java based distributed & scalable application development.

   





Monday, 24 January 2022

Angular

 

What is Angular?

It’s a reactive SPA. It updates the DOM without refreshing the page.

When was Angular 2 released?

2016

What is Angular version being used in SPOD Portal?

11

What is Node version being used in SPOD Portal?

14

Which angular version was skipped?

3

Angular 1 is also known as?

AngularJS

Angular 2 and higher is also knows as?

Angular

NPM stands for?

Node package manager

What is @types/nodes.

contains type definitions for Node.js. This package is used to load in all type definitions when using typescript in node. When you add other packages, you also have to add their typings if they do not include them by default.

How to install angular cli?

npm install -g @angular/cli

Angular cli create new project, it should not contain what?

spaces and word 'test'

Angular-CLI command to create new project?

ng new <project-name>

How to run angular project?

ng serve

On which port is it run by default?

4200

How to bind input text to variable?

<input type="text" [(ngModel)]= "name">

{{name}}

Which module needs to be installed to use ngModel?

import { FormsModule } from '@angular/forms';

and add it to imports (in file app.module.ts)



































Friday, 29 November 2019

Express - Done

Express
What is Express Js?
Why use Express?
What are core features of Express framework?
What is the parameter “next” used for in Express?

Monday, 2 September 2019

Questions - Done

express:

nodejs:
module.exports
event loop(nodejs.org, default num of threads(4),
oo js
middleware(itself a design pattern), app.js code in our app

bookshelf



Saturday, 6 January 2018

Singleton - Done

So what's broken about DCL?

DCL relies on an unsynchronized use of the resource field. That appears to be harmless, but it is not. To see why, imagine that thread A is inside the synchronized block, executing the statement resource = new Resource();while thread B is just entering getResource(). Consider the effect on memory of this initialization. Memory for the new Resource object will be allocated; the constructor for Resource will be called, initializing the member fields of the new object; and the field resource of SomeClass will be assigned a reference to the newly created object.
However, since thread B is not executing inside a synchronized block, it may see these memory operations in a different order than the one thread A executes. It could be the case that B sees these events in the following order (and the compiler is also free to reorder the instructions like this): allocate memory, assign reference to resource, call constructor. Suppose thread B comes along after the memory has been allocated and the resource field is set, but before the constructor is called. It sees that resource is not null, skips the synchronized block, and returns a reference to a partially constructed Resource! Needless to say, the result is neither expected nor desired.

https://www.javaworld.com/article/2074979/java-concurrency/double-checked-locking--clever--but-broken.html

Sunday, 31 December 2017

Javascript - Done

Javascript:
closure(parent function's parameters in child)
hoisting
var, let, const
callback
promises
exception handling
async loops
function chaining

Javascript
What is DOM?
The Document Object Model (DOM) is a programming interface for HTML and XML(Extensible markup language) documents. It defines the logical structure of documents and the way a document is accessed and manipulated.
Note: It is called as a Logical structure because DOM doesn’t specify any relationship between objects.
DOM is a way to represent the webpage in the structured hierarchical way so that it will become easier for programmers and users to glide through the document. With DOM, we can easily access and manipulate tags, IDs, classes, Attributes or Elements using commands or methods provided by Document object.
what are the javascript ES releases?

As of my last knowledge update in September 2021, the following were the ECMAScript (ES) releases up to that point:

1. **ES1 (ECMAScript 1st Edition - 1997):** The initial version of the ECMAScript standard.

2. **ES2 (ECMAScript 2nd Edition - 1998):** A minor update with clarifications and corrections.

3. **ES3 (ECMAScript 3rd Edition - 1999):** Introduced many new features including Regular Expressions, try/catch, and more.

4. **ES4 (Abandoned):** The development of ES4 was abandoned due to disagreements within the standards committee.

5. **ES5 (ECMAScript 5th Edition - 2009):** Added "strict mode," JSON support, and other improvements.

6. **ES6/ES2015 (ECMAScript 6th Edition - 2015):** A major update with features like arrow functions, classes, modules, Promises, and more.

7. **ES2016 (ECMAScript 2016):** Introduced the exponentiation operator (`**`).

8. **ES2017 (ECMAScript 2017):** Added features like `async`/`await`, `Object.values()`, and `Object.entries()`.

9. **ES2018 (ECMAScript 2018):** Introduced features like asynchronous iteration, `Rest`/`Spread` properties, and more.

10. **ES2019 (ECMAScript 2019):** Added features like Array `flat()`/`flatMap()`, `Object.fromEntries()`, and more.

11. **ES2020 (ECMAScript 2020):** Introduced features like optional chaining (`?.`), nullish coalescing (`??`), and more.

12. **ES2021 (ECMAScript 2021):** Added features like `String.prototype.replaceAll()`, `Promise.any()`, and more.

It's important to note that the naming convention shifted from using version numbers (ES1, ES2, etc.) to using the year of the release (ES2015, ES2016, etc.) starting with ES6 to better reflect the annual release cycle of the language features.

For the most current information, I recommend checking the official ECMAScript specification or related resources, as new versions of the standard may have been released since my last update.



Thursday, 28 December 2017

Algorithm Questions - Done

  • Save all leaf nodes of a Binary tree in a Doubly Linked List by using Right node as Next node and Left Node as Previous Node.
  • Given an array,find the maximum j – i such that arr[j] > arr[i]
  • Remove Alternate Duplicate characters from a char array you have to do it in Place.Like keeping only the odd occurences of each character.
  1. Example: Input: you got beautiful eyes
  2. Output: you gtbeaiful es
  3. Allowed Time Complexity was O(n) and Space Complexity was O(1)
  • In a file there are 1 million words . Find 10 most frequent words in that file.
  • Find all nodes at k-distance from a given node in a binary tree
  • Clone a linked list with next and random pointer
  • Serialise and Deserialise a linked list with next and random pointer.
  • Construct a binary tree from given inorder and preorder traversals.
  • Return a tree such that each internal node stores sum of all its child nodes. Each leaf node stores zero.
  • How will you implement linked list with 1 million nodes? How will you access 999999 th node? Give some optimal design strategy and implementation.
  • Reversal of Linked List in groups of K.
  • Given a positive integer N, count all possible distinct binary strings of length N such that there are no consecutive 1’s.
  • Check whether given binary tree is balanced or not. Definition was no two leaves should have height difference of greater than one.
  • Remove duplicates from string in place in O(n).
  • Connect nodes on same level in a binary tree.
  • Find sum of data of all leaves of a binary tree on same level and then multiply sums obtained of all levels.
  • Given a matrix of characters and a word.
    you have to count the number of occurrences of that word in that matrix. you can move to any of the eight valid directions from current position.
  • You are given an string as input which represents a path. You have to normalize that path inplace(NO EXTRA SPACE).
  1. e.g.
  2. input : "\a\b\c\..\..\file.txt"
  3. output: "\a\file.txt"
  • Least common ancestor of two nodes in a binary tree
  • Given two sorted arrays (with repetitive elements) find the kth minimum number from both arrays.
  • Given the root to a binary tree, a value n and k.Find the sum of nodes at distance k from node with value n
  • Find an element in a rotated array
  • Given two linked lists both represent a number. Create a linked list that contains its sum.
  • Given a binary search tree , print the path which has the sum equal to k and has minimum hops. i.e if there are multiple paths with the sum equal to k then print the path with minimum number of nodes.
  • A MxN matrix containing integers (positive, negative and zero’s). For every position containing 0, mark the corresponding row and column as 0.
  • Rotate MxN matrix by 90 degress.
  • Find the nth number that contains the digit k or is divisible by k. (2 <= k <= 9)
  • Write a program to connect next left node in a binary tree. Also first node of each level should be pointing to last node of next level? (Without using Queue)
  • Convert a binary tree to its sum tree(each node is the sum of its children)
  • Given a directed graph. Construct another graph from given graph such that if path exists from vertices A to vertices B and from B to C, then path from A to C and from C to A also should exists.
  • Implement hashmap on your own. Write good hashing function for string.
  • Given an array, arrange the elements such that the number formed by concatenating the elements is highest.
    E.g.: input = [9, 93, 24, 6], the output should be: [9,93,6,24]. This is because if you concatenate all the numbers, 993624 is the highest number that can be formed.
  • Given a string, find the longest substring which is palindrome.
  • Given that integers are read from a data stream. Find median of elements read so for in efficient way. For simplicity assume there are no duplicates.
  • Write an efficient program for printing k largest elements in an array. Elements in array can be in any order.
  • Given unsorted array and a number K. Find 2 numbers such that sum is K.
  • Given n-ary tree. zigzag level order traversal.
  • Given string s and string t find whether all permutation of t is present as substring in s.
  • Design a stack which holds an integer value such that getMinimum() function should return the minimum element in the stack. Implement popMin() function which would pop minimum element from the original stack.
  • Given a set of intervals like 5-10, 15-20, 25-40, 30-45, 50-100. Find the ith smallest number in these intervals. Assume there are no duplicate numbers.
  1. e.g: 1st smallest number = 5
  2. 6th smallest number = 10
  3. 7th smallest number = 15 and so on.
  • Given an array which is first strictly increasing and then strictly decreasing. Find an element in this array.
  • Given a string example : shoppingwithflipkartiseasy, Now we are given this string and a dictionary containing valid words , now we need to break the sentence into words separated by space. Output : shopping with flipkart is easy
  • Given a series 2,3,4,5,6,8,9,10,……, here in this series all the numbers are present which have factors only and only either 2,3 or 5. Need to write a node to generate nth number for the series . With best approach and complexity
  • Given a tree with edge weights, find any path in the tree with maximum sum of edges.
  • Merge k sorted arrays.
  • Given a maze, a start point and end point find the shortest path to reach the end point from the starting point.
  • Given a sentence and a set of characters. Find the minimum window within which the set of characters can be found in the sentence in any order.
  • You are given a string of 0’s and 1’s you have to find the number of substrings in the string which starts and end with a 1.
  1. eg : input : 0010110010
  2. output : 6
  • You are given a mapping like a -> 1, b-> 2… z-> 26. You have to print all possible combinations of a given number using the above information.
  1. eg : input : 121
  2. output : aba,la,au
  • Given a dictionary of 50,000 words. Given a phrase without spaces, add spaces to make it a proper sentence.
  1. e.g:input: thequickbrownfoxjumpoverlazydog
  2. output: the quick brown fox jump over lazy dog
  • Given an unsorted array of n integers which can contain integers from 1 to n. Some elements can be repeated multiple times and some other elements can be absent from the array. Count frequency of all elements that are present and print the missing elements.
  1. Examples:Input: arr[] = {2, 3, 3, 2, 5}
  2. Output: Below are frequencies of all elements
  3. 1 -> 0 2 -> 2 3 -> 2 4 -> 0 5 -> 1
  • Get the next bigger number using the same digits of a number.
    Eg, For 123456, next number would be 123465
  • Given a boolean 2D matrix, find the number of islands. A group of connected 1s forms an island. For example, the below matrix contains 5 islands
  1. Input : mat[][] =
  2. {1, 1, 0, 0, 0},
  3. {0, 1, 0, 0, 1},
  4. {1, 0, 0, 1, 1},
  5. {0, 0, 0, 0, 0},
  6. {1, 0, 1, 0, 1}
  7. Output : 5
  • This problem is know as Clock angle problem where we need to find angle between hands of an analog clock at a given time.
  1. Examples:Input: h = 12:00, m = 30.00
  2. Output: 165 degree
  3. Input: h = 3.00, m = 30.00
  4. Output: 75 degree

Creative questions - Done

1. Google: "If you could only choose one song to play every time you walked into a room for the rest of your life, what would it be?"

2. Facebook: "How many Big Macs does McDonald's sell each year in the U.S.?"

3. Boeing: "What do you think of lava lamps? And Dilbert?"

4. Google: "Choose a city and estimate how many piano tuners operate a business there."

5. Facebook: "How much do you charge to wash every window in Seattle?"

6. Apple: "How many children are born every day?"

7. Hess: "What's your favorite color?"

8. Apple: "If I was talking to your best friend, what is one thing they would say you need to work on?"

9. Google: "If you could be remembered for one sentence, what would it be?"

10. Intel: "Design a spice rack for the blind."

11. Celgene: "Tell me a story."

12. Microsoft: "If you had a choice between two superpowers--being invisible or flying--which would you choose?"

13. St. Jude Medical: "Why are manholes round?"

14. MasterCard: "What do you do if you are approached by an employee who is complaining about a colleague who has horrible body odor?"

15. Cisco: "What kind of tree would you be?"

16. Biogen Idec: "What were you like as a child?"

17. Medtronic: "What do you think you will hate about this job?"