Find Interview Questions for Top Companies
Ques:- Find if a number is a power of 2 or not?
Asked In :-
Right Answer:
A number is a power of 2 if it is greater than 0 and the bitwise AND of the number and one less than the number is 0. In code, this can be checked using:

```python
def is_power_of_two(n):
return n > 0 and (n & (n - 1)) == 0
```
Ques:- Given a doubly linked list with one pointer of each node pointing to the next node just like in a singly linked list. The second pointer(arbit pointer) however can point to any node in the list and not just the previous node. Write a program in to create a copy of this list
Asked In :-
Right Answer:
```python
class Node:
def __init__(self, data):
self.data = data
self.next = None
self.arbit = None

def copy_list(head):
if not head:
return None

# Step 1: Create a copy of each node and insert it next to the original node
current = head
while current:
new_node = Node(current.data)
new_node.next = current.next
current.next = new_node
current = new_node.next

# Step 2: Copy the arbit pointers
current = head
while current:
if current.arbit:
current.next.arbit = current.arbit.next
current = current.next.next

# Step 3: Separate the copied list from the original list
original = head
copy_head = head.next
copy_current = copy_head

while original:
original.next = original.next.next
if
Ques:- What is left join. Give example. And Full outer join?
Asked In :-
Right Answer:
A **LEFT JOIN** returns all records from the left table and the matched records from the right table. If there is no match, NULL values are returned for columns from the right table.

**Example:**
```sql
SELECT A.id, A.name, B.order_id
FROM Customers A
LEFT JOIN Orders B ON A.id = B.customer_id;
```

A **FULL OUTER JOIN** returns all records when there is a match in either left or right table records. If there is no match, NULL values are returned for the non-matching side.

**Example:**
```sql
SELECT A.id, A.name, B.order_id
FROM Customers A
FULL OUTER JOIN Orders B ON A.id = B.customer_id;
```
Ques:- What is magic functions and autoloading in PHP?
Asked In :-
Right Answer:
Magic functions in PHP are special methods that start with double underscores (__) and have predefined behavior, such as `__construct()` for constructors and `__destruct()` for destructors. Autoloading in PHP is a feature that automatically loads class files when a class is instantiated, using the `spl_autoload_register()` function to define how classes should be loaded without requiring explicit `require` or `include` statements.
Ques:- Given three arrays sorted in non-decreasing order, print all common elements in these arrays. Examples: ar1[] = {1, 5, 10, 20, 40, 80} ar2[] = {6, 7, 20, 80, 100} ar3[] = {3, 4, 15, 20, 30, 70, 80, 120} Output: 20, 80
Asked In :-
Right Answer:
To find common elements in three sorted arrays, you can use a three-pointer approach. Here’s a simple implementation in Python:

```python
def find_common_elements(ar1, ar2, ar3):
i, j, k = 0, 0, 0
common_elements = []

while i < len(ar1) and j < len(ar2) and k < len(ar3):
if ar1[i] == ar2[j] == ar3[k]:
common_elements.append(ar1[i])
i += 1
j += 1
k += 1
elif ar1[i] < ar2[j]:
i += 1
elif ar2[j] < ar3[k]:
j += 1
else:
k += 1

return common_elements

# Example usage
ar1 = [1, 5, 10, 20, 40, 80]
Ques:- A puzzle. You will be given with a 3 Litre container & a 7 Litre Container. Measure exactly 5 Litres of water
Asked In :-
Right Answer:
1. Fill the 7-litre container completely.
2. Pour water from the 7-litre container into the 3-litre container until the 3-litre container is full. This leaves you with 4 litres in the 7-litre container.
3. Empty the 3-litre container.
4. Pour the remaining 4 litres from the 7-litre container into the 3-litre container until it is full. This will leave you with exactly 5 litres in the 7-litre container.
Ques:- iven a table “student” of with columns Name and Marks. You have to write a SQL query to get the 2nd highest marks from the table. Also write a query to find the nth highest marks, where n can be any number
Asked In :-
Right Answer:
To get the 2nd highest marks from the "student" table:

```sql
SELECT MAX(Marks)
FROM student
WHERE Marks < (SELECT MAX(Marks) FROM student);
```

To find the nth highest marks, where n can be any number:

```sql
SELECT DISTINCT Marks
FROM student
ORDER BY Marks DESC
LIMIT 1 OFFSET n-1;
```
(Note: Replace `n` with the desired number.)
Ques:- Design database schema for a movie site.Where user can watch the movie,genre of movie,give ratings and recommended movies to user.Also Write an algorithm to show recommended movies to user
Asked In :-
Right Answer:
**Database Schema:**

1. **Users Table**
- user_id (Primary Key)
- username
- email
- password

2. **Movies Table**
- movie_id (Primary Key)
- title
- genre_id (Foreign Key)
- release_year
- description

3. **Genres Table**
- genre_id (Primary Key)
- genre_name

4. **Ratings Table**
- rating_id (Primary Key)
- user_id (Foreign Key)
- movie_id (Foreign Key)
- rating (1-5)
- review (optional)

5. **Recommendations Table**
- recommendation_id (Primary Key)
- user_id (Foreign Key)
- movie_id (Foreign Key)

**Algorithm for Recommended Movies:**

1. **Input:** user_id
2. Retrieve the genres of movies rated by the user.
3. Find other movies in the same genres that the user hasn't watched
Ques:- By tossing a coin we can get either head or tail, i have a function toss() which return head or tail with equal probability
Asked In :-
Right Answer:
You can simulate a fair coin toss using the `toss()` function as follows:

```python
def toss():
# This function returns either 'head' or 'tail' with equal probability
return 'head' if random.randint(0, 1) == 0 else 'tail'
```
Ques:- You have to write a function for dice which will return number from 1-6 with equal probability. constraints : you can not use random function, you can use only toss function
Asked In :-
Right Answer:
```python
import random

def toss():
return random.randint(0, 1) # Simulates a coin toss: 0 or 1

def dice():
while True:
# Generate a number from 1 to 6 using toss
num = (toss() << 2) | (toss() << 1) | toss() # This gives a number from 0 to 7
if num < 6: # Only accept numbers 0 to 5
return num + 1 # Return 1 to 6
```
Ques:- Write a query to fetch duplicate email from table?
Asked In :-
Ques:- Implement queue with the help of two stacks
Asked In :-
Ques:- How can you improve the performance of a site.(Only frontend)
Asked In :-
Ques:- Write a function to check if two strings are anagram or not
Asked In :-
Ques:- Given an array of integers which can be in one of four order – i.Increasing 2.Decreasing 3.decreasing then increasing 4.increasing then decreasing .Write a function to find the type of array
Asked In :-
Ques:- Difference between .on(‘click’,function() and .click(function())
Asked In :-
Ques:- Write sql to retrieve all unread messages when user sign in
Asked In :-
Ques:- How is the Employee hierarchy in your current organization.Whom do you report to
Asked In :-
Ques:- Array of first n numbers.One number is missing.Find missing number?
Asked In :-


The Software Developer section on takluu.com is tailored for aspiring and experienced developers who want to excel in coding interviews and build a successful career in software development. This category covers core programming concepts, data structures, algorithms, and software design principles essential for creating efficient and maintainable applications.

You will find detailed tutorials and interview questions on popular programming languages like Java, C++, Python, JavaScript, and more. Our content emphasizes problem-solving skills through coding challenges, algorithmic puzzles, and real-world scenarios frequently asked by top tech companies.

Beyond coding, this section also delves into important topics such as object-oriented programming, design patterns, database connectivity, API integration, and version control (Git). These concepts prepare you for both technical interviews and practical job requirements.

Our interview preparation materials include sample coding problems, explanation of complex topics in simple terms, and mock tests to assess your readiness. Whether you’re preparing for roles like Backend Developer, Frontend Developer, Full Stack Developer, or Mobile App Developer, this section provides comprehensive resources to boost your confidence.

At Takluu, we believe in practical learning that bridges the gap between theory and real-world application. By practicing consistently with our curated content, you can sharpen your coding skills, improve problem-solving speed, and stand out in competitive interviews.

Start your journey with us to become a proficient Software Developer capable of tackling complex challenges and delivering high-quality software solutions.

AmbitionBox Logo

What makes Takluu valuable for interview preparation?

1 Lakh+
Companies
6 Lakh+
Interview Questions
50K+
Job Profiles
20K+
Users