Coding Interview Resources
50.5K subscribers
693 photos
7 files
399 links
This channel contains the free resources and solution of coding problems which are usually asked in the interviews.

Managed by: @love_data
Download Telegram
Fullstack Developer Skills & Technologies
❀4
Here is a great JavaScript interview question!

What the heck is a Promise doing under the hood?

In JavaScript, things usually happen one after the other. It's like a checklist each item gets done before moving to the next.

When a function returns a Promise, it's like making a promise to do something, like fetch data from the internet. But JavaScript doesn't wait around for the data to come back. Instead, it moves on to the next task.

Now, here's where things get interesting. While JavaScript is busy doing other stuff, like running more code, the Promise is off fetching data in the background.

Once the data is fetched, the Promise is fulfilled, and it has some information to share. But JavaScript needs to know when it's time to handle that information. That's where the onFulfilled part of the Promise comes in.

When the Promise is fulfilled, JavaScript takes the onFulfilled code and puts it in a special queue, ready to be run.

Now, async/await enters the scene. When we mark a function as async, we're telling JavaScript, "Hey, this function might take some time to finish, so don't wait up for it."

And when we use the await keyword inside an async function, it's like saying, "Hold on a sec, JavaScript. I need to wait for something important before moving on."

So, when JavaScript encounters an await keyword, it pauses and lets the async function do its thing. If that thing happens to be a Promise, JavaScript knows it can move on to other tasks while waiting for the Promise to resolve.

Once the Promise is resolved, JavaScript picks up where it left off and continues running the code.

Promises and async/await allow JavaScript to handle asynchronous tasks while keeping things organized and in order. Promises handle the background tasks, while async/await makes it easier to work with them in our code, ensuring everything happens in the right sequence.

Web Development Best Resources: https://topmate.io/coding/930165

ENJOY LEARNING πŸ‘πŸ‘
❀1πŸ‘1
15+ Must Watch Movies for ProgrammersπŸ§‘β€πŸ’»πŸ€–

1. The Matrix
2. The Social Network
3. Source Code
4. The Imitation Game
5. Silicon Valley
6. Mr. Robot
7. Jobs
8. The Founder
9. The Social Dilemma
10. The Great Hack
11. Halt and Catch Fire
12. Wargames
13. Hackers
14. Snowden
15. Who Am I

Happy Coding β™₯️
πŸ‘5
10 Chrome Extensions Every Developer Should Use

βœ… JSON Viewer – Beautify and view JSON data instantly
βœ… Wappalyzer – Identify the tech stack of any website
βœ… Web Developer – Adds powerful dev tools to your browser
βœ… ColorZilla – Pick and copy any color from a webpage
βœ… React Developer Tools – Debug and inspect React components
βœ… Dark Reader – Enable dark mode on every site
βœ… Session Buddy – Manage tabs and sessions like a pro
βœ… WhatFont – Instantly identify fonts on websites
βœ… Lighthouse – Audit performance, SEO, and accessibility
βœ… AI Prompt Genius – Manage and save prompts for AI tools

React with your favorite emoji if you found a gem in here!
πŸ‘4πŸ‘Œ2πŸ†1
PREPARING FOR AN ONLINE INTERVIEW?

10 basic tips to consider when invited/preparing for an online interview:

1. Get to know the online technology that the interviewer(s) will use. Is it a phone call, WhatsApp, Skype or Zoom interview? If not clear, ask.

2. Familiarize yourself with the online tools that you’ll be using. Understand how Zoom/Skype works and test it well in advance. Test the sound and video quality.

3. Ensure that your internet connection is stable. If using mobile data, make sure it’s adequate to sustain the call to the end.

4. Ensure the lighting and the background is good. Remove background clutter. Isolate yourself in a place where you’ll not have any noise distractions.

5. For Zoom/Skype calls, use your desktop or laptop instead of your phone. They’re more stable especially for video calls.

6. Mute all notifications on your computer/phone to avoid unnecessary distractions.

7. Ensure that your posture is right. Just because it’s a remote interview does not mean you slouch on your couch. Maintain an upright posture.

8. Prepare on the other job specifics just like you would for a face-to-face interview

9. Dress up like you would for a face-to-face interview.

10. Be all set at least 10 minutes to the start of interview.
πŸ‘4
10 Chrome Extensions Every Developer Should Use

βœ… JSON Viewer – Beautify and view JSON data instantly
βœ… Wappalyzer – Identify the tech stack of any website
βœ… Web Developer – Adds powerful dev tools to your browser
βœ… ColorZilla – Pick and copy any color from a webpage
βœ… React Developer Tools – Debug and inspect React components
βœ… Dark Reader – Enable dark mode on every site
βœ… Session Buddy – Manage tabs and sessions like a pro
βœ… WhatFont – Instantly identify fonts on websites
βœ… Lighthouse – Audit performance, SEO, and accessibility
βœ… AI Prompt Genius – Manage and save prompts for AI tools

React with your favorite emoji if you found a gem in here!
❀2
⌨️ Grammar Correction using Python
πŸ‘2
Theoretical Questions for Interviews on Array

1. What is an array?

An array is a data structure consisting of a collection of elements, each identified by at least one array index or key.

2. How do you declare an Array?

Each language has its own way of declaring arrays, but the general idea is similar: defining the type of elements and the number of elements or initializing it directly.

βœ… C/C++: int arr[5]; (Declares an array of 5 integers).
βœ… Java: int[] arr = new int[5]; (Declares and initializes an array of 5 integers).
βœ… Python: arr = [1, 2, 3, 4, 5] (Uses a list, which functions like an array and doesn’t require a fixed size).
βœ… JavaScript: let arr = [1, 2, 3, 4, 5]; (Uses arrays without needing a size specification).
βœ… C#: int[] arr = new int[5]; (Declares an array of 5 integers).

3. Can an array be resized at runtime?

An array is fixed in size once created. However, in C, you can resize an array at runtime using Dynamic Memory Allocation (DMA) with malloc() or realloc(). Most modern languages have dynamic-sized arrays like vector in C++, list in Python, and ArrayList in Java, which automatically resize.

4. Is it possible to declare an array without specifying its size?

In C/C++, declaring an array without specifying its size is not allowed and causes a compile-time error. However, in C, we can create a pointer and allocate memory dynamically using malloc(). In C++, we can use vectors where we can declare first and then dynamically add elements. In modern languages like Java, Python, and JavaScript, we can declare without specifying the size.

5. What is the time complexity for accessing an element in an array?

The time complexity for accessing an element in an array is O(1), as it can be accessed directly using its index.

6. What is the difference between an array and a linked list?

An array is a static data structure, while a linked list is a dynamic data structure. Raw arrays have a fixed size, and elements are stored consecutively in memory, while linked lists can grow dynamically and do not require contiguous memory allocation. Dynamic-sized arrays allow flexible size, but the worst-case time complexity for insertion/deletion at the end becomes more than O(1). With a linked list, we get O(1) worst-case time complexity for insertion and deletion.

7. How would you find out the smallest and largest element in an array?

The best approach is iterative (linear search), while other approaches include recursive and sorting.

Iterative method

Algorithm:

1. Initialize two variables:

small = arr[0] (first element as the smallest).

large = arr[0] (first element as the largest).



2. Traverse through the array from index 1 to n-1.


3. If arr[i] > large, update large = arr[i].


4. If arr[i] < small, update small = arr[i].


5. Print the values of small and large.



C++ Code Implementation

#include <iostream>
using namespace std;

void findMinMax(int arr[], int n) {
int small = arr[0], large = arr[0];

for (int i = 1; i < n; i++) {
if (arr[i] > large)
large = arr[i];
if (arr[i] < small)
small = arr[i];
}

cout << "Smallest element: " << small << endl;
cout << "Largest element: " << large << endl;
}

int main() {
int arr[] = {7, 2, 9, 4, 1, 5};
int n = sizeof(arr) / sizeof(arr[0]);

findMinMax(arr, n);

return 0;
}

8. What is the time complexity to search in an unsorted and sorted array?

βœ… Unsorted Array: The time complexity for searching an element in an unsorted array is O(n), as we may need to check every element.
βœ… Sorted Array: The time complexity for searching an element in a sorted array is O(log n) using binary search.

πŸ”Ή O(log n) takes less time than O(n), whereas O(n log n) takes more time than O(n).

Free Coding Interview Resources: https://whatsapp.com/channel/0029VammZijATRSlLxywEC3X
πŸ‘4
This media is not supported in your browser
VIEW IN TELEGRAM
18 Most common used Java List methods

1. add(E element) - Adds the specified element to the end of the list.
2. addAll(Collection<? extends E> c) - Adds all elements of the specified collection to the end of the list.
3. remove(Object o) - Removes the first occurrence of the specified element from the list.
4. remove(int index) - Removes the element at the specified position in the list.
5. get(int index) - Returns the element at the specified position in the list.
6. set(int index, E element) - Replaces the element at the specified position in the list with the specified element.
7. indexOf(Object o) - Returns the index of the first occurrence of the specified element in the list.
8. contains(Object o) - Returns true if the list contains the specified element.
9. size() - Returns the number of elements in the list.
10. isEmpty() - Returns true if the list contains no elements.
11. clear() - Removes all elements from the list.
12. toArray() - Returns an array containing all the elements in the list.
13. subList(int fromIndex, int toIndex) - Returns a view of the portion of the list between the specified fromIndex, inclusive, and toIndex, exclusive.
14. addAll(int index, Collection<? extends E> c) - Inserts all elements of the specified collection into the list, starting at the specified position.
15. iterator() - Returns an iterator over the elements in the list.
16. sort(Comparator<? super E> c) - Sorts the elements of the list according to the specified comparator.
17. replaceAll(UnaryOperator<E> operator) - Replaces each element of the list with the result of applying the given operator.
18. forEach(Consumer<? super E> action) - Performs the given action for each element of the list until all elements have been processed or the action throws an exception.
πŸ‘5
Technical Questions Wipro may ask on their interviews

1. Data Structures and Algorithms:
   - "Can you explain the difference between an array and a linked list? When would you use one over the other in a real-world application?"
   - "Write code to implement a binary search algorithm."

2. Programming Languages:
   - "What is the difference between Java and C++? Can you provide an example of a situation where you would prefer one language over the other?"
   - "Write a program in your preferred programming language to reverse a string."

3. Database and SQL:
   - "Explain the ACID properties in the context of database transactions."
   - "Write an SQL query to retrieve all records from a 'customers' table where the 'country' column is 'India'."

4. Networking:
   - "What is the difference between TCP and UDP? When would you choose one over the other for a specific application?"
   - "Explain the concept of DNS (Domain Name System) and how it works."

5. System Design:
   - "Design a simple online messaging system. What components would you include, and how would they interact?"
   - "How would you ensure the scalability and fault tolerance of a web service or application?"
πŸ‘1