Find Interview Questions for Top Companies
Ques:- Given a function which upon input x returns f(x) write code to evaluate integral a to b f(x)dx (what is the maximum accuracy of your algorithm)
Asked In :-
Right Answer:
You can use numerical integration methods such as the Trapezoidal Rule or Simpson's Rule to evaluate the integral. Here's an example using the Trapezoidal Rule in Python:

```python
def trapezoidal_rule(f, a, b, n):
h = (b - a) / n
integral = 0.5 * (f(a) + f(b))
for i in range(1, n):
integral += f(a + i * h)
integral *= h
return integral

# Example usage:
# Define your function f(x)
def f(x):
return x**2 # Example function

# Set the limits of integration and number of intervals
a = 0
b = 1
n = 1000 # More intervals for higher accuracy

result = trapezoidal_rule(f, a, b, n)
print(result)
```

The maximum accuracy of this algorithm depends on the number of intervals `n
Comments
md Mar 9, 2022

import math

# Function to calculate f(x)
def func( x ):
return math.log(x)

# Function for approximate integral
def simpsons_( ll, ul, n ):

# Calculating the value of h
h = ( ul - ll )/n

# List for storing value of x and f(x)
x = list()
fx = list()

# Calculating values of x and f(x)
i = 0
while i<= n:
x.append(ll + i * h)
fx.append(func(x[i]))
i += 1

# Calculating result
res = 0
i = 0
while i<= n:
if i == 0 or i == n:
res+= fx[i]
elif i % 2 != 0:
res+= 4 * fx[i]
else:
res+= 2 * fx[i]
i+= 1
res = res * (h / 3)
return res

# Driver code
lower_limit = 4 # Lower limit
upper_limit = 5.2 # Upper limit
n = 6 # Number of interval
print("%.6f"% simpsons_(lower_limit, upper_limit, n))

Ques:- What is use of OOO programming?
Asked In :-
Right Answer:
Object-Oriented Programming (OOP) is used to organize code into reusable structures called objects, which can represent real-world entities. It promotes code reusability, modularity, and easier maintenance through concepts like encapsulation, inheritance, and polymorphism.
Ques:- Given a million points and a new point P find a point closest to P(you can do preprocessing)
Asked In :-
Right Answer:
You can use a k-d tree for preprocessing the million points. Once the tree is built, you can efficiently query it to find the closest point to the new point P.
Ques:- How do you design a website which displays say top 1000 products with product rating updating every second?
Asked In :-
Right Answer:
To design a website that displays the top 1000 products with ratings updating every second, follow these steps:

1. **Backend Setup**: Use a server-side language (e.g., Node.js, Python) to handle product data and ratings. Store product information in a database (e.g., MySQL, MongoDB).

2. **API Development**: Create a RESTful API to fetch the top 1000 products and their ratings. Implement an endpoint that returns the product data in JSON format.

3. **Frontend Framework**: Use a frontend framework (e.g., React, Angular) to build the user interface. This will allow for dynamic updates without refreshing the page.

4. **WebSocket or Polling**: Implement WebSockets for real-time updates or use polling (e.g., setInterval) to fetch updated ratings every second from the API.

5. **Data Display**: Render the product list on the frontend, updating the ratings dynamically as new data is received.
Ques:- Implement a specialStack class which should support O(1) push O(1) pop and should return minimum element in the stack in O(1) time
Right Answer:
```python
class SpecialStack:
def __init__(self):
self.stack = []
self.min_stack = []

def push(self, value):
self.stack.append(value)
if not self.min_stack or value <= self.min_stack[-1]:
self.min_stack.append(value)

def pop(self):
if self.stack:
value = self.stack.pop()
if value == self.min_stack[-1]:
self.min_stack.pop()
return value
return None

def get_min(self):
if self.min_stack:
return self.min_stack[-1]
return None
```
Ques:- Explain polymorphism and other OOPS concepts
Asked In :-
Right Answer:
Polymorphism is the ability of different objects to respond to the same method call in their own way. It allows for methods to be defined in multiple forms.

Other OOP concepts include:

1. **Encapsulation**: Bundling data and methods that operate on that data within a single unit or class, restricting access to some components.
2. **Inheritance**: A mechanism where a new class inherits properties and behavior (methods) from an existing class, promoting code reuse.
3. **Abstraction**: Hiding complex implementation details and showing only the essential features of an object, allowing users to interact with it without needing to understand the underlying complexity.
Comments
rishikesh chavan May 17, 2022

polymorphism is fourth piller of oops .It means one way many form,like we do one job in many ways.
we can take example of coffer or tea making machine ,if pour coffee powder we can make coffee and if we pour tea powder we can get tea,
There are two type of polymorphism in java,
1.compile time polymorphism(early binding) can be achived by method over loading
2.run time polymorphism (late binding)can be achived by methos overriding .

Ques:- How to use Intent foags?
Asked In :-
Right Answer:
To use Intent flags in Android, you can set them when creating an Intent object. For example:

```java
Intent intent = new Intent(CurrentActivity.this, TargetActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
```

Common flags include `FLAG_ACTIVITY_NEW_TASK`, `FLAG_ACTIVITY_CLEAR_TOP`, and `FLAG_ACTIVITY_SINGLE_TOP`. Use `addFlags()` to combine multiple flags.
Ques:- Given an array and a number find a pair of integers in the array whose sum is equal to given number.
Asked In :-
Right Answer:
You can solve this problem using a hash set. Here’s a simple approach in Python:

```python
def find_pair_with_sum(arr, target_sum):
seen = set()
for number in arr:
complement = target_sum - number
if complement in seen:
return (complement, number)
seen.add(number)
return None
```

You can call this function with your array and target sum to find the pair.
Ques:- Find lca of 2 nodes in a binary tree (write pseudocode)
Asked In :-
Right Answer:
```plaintext
function findLCA(root, n1, n2):
if root is null:
return null

if root.value == n1 or root.value == n2:
return root

leftLCA = findLCA(root.left, n1, n2)
rightLCA = findLCA(root.right, n1, n2)

if leftLCA is not null and rightLCA is not null:
return root

return leftLCA if leftLCA is not null else rightLCA
```
Ques:- All about SQL joins,data warehouse.
Asked In :-
Right Answer:
SQL joins are used to combine rows from two or more tables based on a related column. The main types of joins are:

1. **INNER JOIN**: Returns records with matching values in both tables.
2. **LEFT JOIN (or LEFT OUTER JOIN)**: Returns all records from the left table and matched records from the right table; unmatched records from the right table will show as NULL.
3. **RIGHT JOIN (or RIGHT OUTER JOIN)**: Returns all records from the right table and matched records from the left table; unmatched records from the left table will show as NULL.
4. **FULL JOIN (or FULL OUTER JOIN)**: Returns all records when there is a match in either left or right table records; unmatched records will show as NULL.
5. **CROSS JOIN**: Returns the Cartesian product of both tables, combining all rows from the first table with all rows from the second table.

A data warehouse is a centralized repository that stores large volumes of structured and
Ques:- There are four round 1 is programming 2is technical 3 is management hr 4 is hr
Asked In :-
Right Answer:
The question seems to be asking about the different rounds in a job interview process. The four rounds are: 1) Programming, 2) Technical, 3) Management, and 4) HR.
Ques:- Removing duplication of words in a string using perl script
Asked In :-
Right Answer:
```perl
my $string = "your input string with duplicate words";
my %seen;
my @unique_words = grep { !$seen{$_}++ } split ' ', $string;
my $result = join ' ', @unique_words;
print $result;
```
Ques:- I was asked about my favorite subject, opted computer networks. So, was asked about computer networks basics like ISO OSI, virtual LANs, QoS, AdHoc networks, WiiMax and Wifi
Asked In :- metacube software,
Right Answer:
The OSI model has seven layers: Physical, Data Link, Network, Transport, Session, Presentation, and Application. Virtual LANs (VLANs) segment networks for better management and security. Quality of Service (QoS) prioritizes network traffic to ensure performance for critical applications. Ad Hoc networks are temporary networks created on-the-fly without a central infrastructure. WiMAX is a wireless communication standard for long-range broadband access, while Wi-Fi is a technology for wireless local area networking.
Ques:- Heap memory and stack memory? Local variables are stored where? What is memory tables?
Asked In :- Chella Software,
Right Answer:
Heap memory is used for dynamic memory allocation, while stack memory is used for static memory allocation, such as function calls and local variables. Local variables are stored in stack memory. Memory tables typically refer to data structures that manage memory allocation and track memory usage, but the term can vary in context.
Ques:- Reverse a linked list?
Asked In :-
Right Answer:
To reverse a linked list, you can use the following algorithm in Python:

```python
class Node:
def __init__(self, data):
self.data = data
self.next = None

def reverse_linked_list(head):
prev = None
current = head
while current:
next_node = current.next # Store next node
current.next = prev # Reverse the link
prev = current # Move prev to current
current = next_node # Move to next node
return prev # New head of the reversed list
```
Ques:- How can you stop man in the middle attack over an insecure communication line without using any kind of encryption ?
Asked In :-
Right Answer:
You can use message authentication codes (MACs) to ensure data integrity and authenticity, allowing the sender and receiver to verify that the messages have not been altered and are from a legitimate source.
Ques:- What is the difference between http and https?
Asked In :-
Right Answer:
HTTP (Hypertext Transfer Protocol) is a protocol used for transferring data over the web, while HTTPS (HTTP Secure) is the secure version of HTTP that uses encryption (SSL/TLS) to protect the data exchanged between the user and the server.
Ques:- Implement funcionality of 1000 of students giving a online test and timer is running. You have to calculate th etime when test is tarted and auto-matically stop the test when test is ended. Handle the scenarios like power failure. test should start from where it stopped
Asked In :-
Right Answer:
To implement the functionality for 1000 students taking an online test with a timer, you can follow these steps:

1. **Database Setup**: Create a database to store student test data, including start time, end time, and current progress.

2. **Start Test**: When a student starts the test, record the start time in the database.

3. **Timer Implementation**: Use a server-side timer that tracks the duration of the test. For example, if the test duration is 60 minutes, set a timer to count down from 3600 seconds.

4. **Auto Stop Test**: When the timer reaches zero, automatically mark the test as completed in the database.

5. **Power Failure Handling**: Implement a mechanism to save the current state of the test at regular intervals (e.g., every minute). This can include the current question, time spent, and any answers provided.

6. **Resume Test**: When a student logs back in after a power
Ques:- WAP of prime number using reursion?
Asked In :-
Right Answer:
```python
def is_prime(num, divisor=None):
if num <= 1:
return False
if divisor is None:
divisor = num - 1
if divisor == 1:
return True
if num % divisor == 0:
return False
return is_prime(num, divisor - 1)

def print_primes(n, current=2):
if current > n:
return
if is_prime(current):
print(current)
print_primes(n, current + 1)

# Example usage: print primes up to 20
print_primes(20)
```
Ques:- Asked about one of my projects I mentioned in my resume?
Asked In :-
Right Answer:
Sure! When asked about a project from your resume, briefly describe the project's purpose, your role, the technologies used, and any challenges you faced along with how you overcame them.


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