Which Data Structure follows LIFO principle ???
STACK !!
Which company owns GITHUB ???
Microsoft
13, 21, 34, 55 ,__
89
it is Fibonacci Series
#include <stdlib.h>
#include <stdio.h>
void main() {
int f[7]={3,1,2,4,6,3,7};
for(int i=0;i<=7;i++) {
if(f[i]%2==0)
printf("%f",f[i]);
}
}
array index out of bound
Fundamental concept where a new class (subclass) can acquire properties and methods from an existing class (superclass)
Inheritance
Which Data Structure allows you to store and retrieve data in constant time ??
Hash Table / Hash Map
Which company supplies the AI-optimized graphics processors to OpenAI under their multi-billion-dollar deal ??
Not NVIDIA
its AMD
What is the next number in the series ??
25, 49, 121, 169,__
it is the series of the squares of the prime numbers
289
#include <stdio.h>
int max(int a, int b) {
if(a > b)
max_val = a;
else
max_val = b;
return max_val; }
int main() {
int x = 10, y = 20;
printf("%d", max(x, y));
return 0;
}
max_val is not intialized
Servers mostly run on which kind of operating system ?
Linux based OS
This graph traversal Algorithm uses Queues ....
BFS(Breadth first search)
Which company supplies most of the world’s memory (RAM and storage) chips?
SAMSUNG
Two friends A and B started a business with an initial capital contribution of Rs. 1 lac and Rs. 2 lacs. At the end of the year, the business made a profit of Rs. 30,000. Find the share of each in the profit.
Share of A in profit = Rs. 10,000
Share of B in profit = Rs. 20,000
def find_max(numbers):
max_so_far = 0
for num in numbers:
if num > max_so_far:
max_so_far = num
my_list = [-10, -5, -3, -12]
max_num = find_max(my_list)
max_so_far = 0
starts from zero
fails for negative numbers
Knights: Always tell the truth. Knaves: Always lie. Goal: Determine who is a knight and who is a knave based on their statements.
You meet two people, A and B:
A says: “B is a knave.”
B says: “We are both knaves.”
Question: Who is the knight and who is the knave?
Analyze B’s statement B says: “We are both knaves.” If B were a knight (truth-teller), the statement would be true → then B is a knave. Contradiction. Therefore, B cannot be a knight → B is a knave.
Analyze A’s statement A says: “B is a knave.” We just determined B is indeed a knave. A’s statement is true, so A must be a knight.
Technique to store already computed results to avoid re computation in recursive algorithm
Memoization / DP
What percent of people use internet in world?
85%
72%
68%
68 %
There are 3 boxes one with only apple , one with only orange and one with both apple and orange .
All are mislabeled , You can pick one fruit from one box . How can you label all the boxes correctly ??
Pick one fruit from the box labeled “Both”.
It can’t actually contain both, so it will reveal a single-fruit box.
Label that box correctly based on the fruit you picked. The remaining two boxes: The one labeled as the fruit you just found → must be the other single-fruit box. The last box → must be the “Both” box.

-1 is the answer
How would you cut a pizza into 8 pieces with only 3 cuts
cut it vertically and horizontally and then stack 4 slices and cut it again
In the balanced binary search tree the difference between the heights of the right and left sub tree is almost what ??
-1 or 1
The most popular platform in the world?
Youtube
Three people A, B, and C are working in a factory. A and B working together can finish a task in 18 days whereas B and C working together can do the same task in 24 days and A and C working together can do it in 36 days. In how many days will A, B, and C finish the task working together ??
16 days
def remove_all_evens(numbers_list):
"""
Takes a list of numbers and removes all even numbers from it.
"""
for num in numbers_list:
if num % 2 == 0:
numbers_list.remove(num)
return numbers_list
list_a = [1, 2, 3, 4, 5, 6]
print(f"Original A: {list_a}")
remove_all_evens(list_a)
print(f"Modified A: {list_a}")
You should never modify a list (or dictionary) while you are iterating over it with a for loop.
Let's trace Test Case 2 ([1, 2, 2, 4, 5, 6]) to see the bug in action:
Loop 1: num is 1. It's not even. List is unchanged.
Loop 2: num is 2 (at index 1). It's even. numbers_list.remove(2).
The list is now: [1, 2, 4, 5, 6].
The item 2 (at index 2) shifts left to index 1.
Loop 3: The for loop moves to the next item (index 2), which is now 4.
It completely skips the second 2 that shifted into index 1!
Loop 4: num is 4. It's even. numbers_list.remove(4).
The list is now: [1, 2, 5, 6].
Loop 5: The for loop moves to the next item (index 3), which is 6.
It completely skips the 5!
Loop 6: num is 6. It's even. numbers_list.remove(6).
The list is now: [1, 2, 5].
The loop finishes. The final, incorrect list is [1, 2, 5].
Dijkstra is the most time optimal path finding algorithm.
True
FalseFalse