Tip 1 : Stick with one coding language for DSA.
Tip 2 : SQL / DSA is a must for a better opportunity.
Tip 3 : Consistency is the key.
Tip 1 : Keep it simple.
Tip 2 : Put only those techs that are within your knowledge.
- The link will be active by 2:55 PM on the same day.
- The test consists of 20 questions (based on programming, logic, and general analytical skills).
- It is in a Google Forms format and time-restricted. You must fill in the answers and submit the form within 30 minutes.
- There are no negative marks for incorrect answers.
- You may make suitable assumptions where necessary.
- You are required to submit the MCQ test within 30 minutes.
There is a tank that is filled with fuel up to 1/7 of its capacity. If 22 liters of fuel are poured into the tank, the indicator rises to the 1/5 mark of the tank. What is the total capacity of the tank?
Let the total capacity of the tank be ‘x’ liters. According to the question, => x/7 + 22 = x/5 => x/5 – x/7 = 22 => x = 385 litres(Answer).



1. Constructor:
It initializes the data members(queues) as required.
2. push(data) :
This function should take one argument of type integer. It pushes the element into the stack and returns nothing.
3. pop() :
It pops the element from the top of the stack and, in turn, returns the element being popped or deleted. In case the stack is empty, it returns -1.
4. top :
It returns the element being kept at the top of the stack. In case the stack is empty, it returns -1.
5. size() :
It returns the size of the stack at any given instance of time.
6. isEmpty() :
It returns a boolean value indicating whether the stack is empty or not.
Query-1(Denoted by an integer 1): Pushes an integer data to the stack. (push function)
Query-2(Denoted by an integer 2): Pops the data kept at the top of the stack and returns it to the caller. (pop function)
Query-3(Denoted by an integer 3): Fetches and returns the data being kept at the top of the stack but doesn't remove it, unlike the pop function. (top function)
Query-4(Denoted by an integer 4): Returns the current size of the stack. (size function)
Query-5(Denoted by an integer 5): Returns a boolean value denoting whether the stack is empty or not. (isEmpty function)
Operations:
1 5
1 10
2
3
4
Enqueue operation 1 5: We insert 5 at the back of the queue.
Queue: [5]
Enqueue operation 1 10: We insert 10 at the back of the queue.
Queue: [5, 10]
Dequeue operation 2: We remove the element from the front of the queue, which is 5, and print it.
Output: 5
Queue: [10]
Peek operation 3: We return the element present at the front of the queue, which is 10, without removing it.
Output: 10
Queue: [10]
IsEmpty operation 4: We check if the queue is empty.
Output: False
Queue: [10]



Test duration: 1 hour. Only for those students who clear the MCQ test.
Important:



If the given string is: STR = "abcde". You have to print the string "edcba".
Try to solve the problem in O(1) space complexity.
public class StringPrograms {
public static void main(String[] args) {
String str = "123";
System.out.println(reverse(str));
}
public static String reverse(String in) {
if (in == null)
throw new IllegalArgumentException("Null is not valid input");
StringBuilder out = new StringBuilder();
char[] chars = in.toCharArray();
for (int i = chars.length - 1; i >= 0; i--)
out.append(chars[i]);
return out.toString();
}
}



1. Ninja can use the same Fibonacci number any number of times.
2. It is also guaranteed that there are always some Fibonacci numbers whose sum is equal to ‘SUM’.
public class PrintFibonacci {
public static void printFibonacciSequence(int count) {
int a = 0;
int b = 1;
int c = 1;
for (int i = 1; i <= count; i++) {
System.out.print(a + ", ");
a = b;
b = c;
c = a + b;
}
}
public static void main(String[] args) {
printFibonacciSequence(10);
}
}
How do you create a deadlock scenario programmatically in Java? (Learn)
public class ThreadDeadlock {
public static void main(String[] args) throws InterruptedException {
Object obj1 = new Object();
Object obj2 = new Object();
Object obj3 = new Object();
Thread t1 = new Thread(new SyncThread(obj1, obj2), "t1");
Thread t2 = new Thread(new SyncThread(obj2, obj3), "t2");
Thread t3 = new Thread(new SyncThread(obj3, obj1), "t3");
t1.start();
Thread.sleep(5000);
t2.start();
Thread.sleep(5000);
t3.start();
}
}
class SyncThread implements Runnable {
private Object obj1;
private Object obj2;
public SyncThread(Object o1, Object o2) {
this.obj1 = o1;
this.obj2 = o2;
}
@Override
public void run() {
String name = Thread.currentThread().getName();
System.out.println(name + " acquiring lock on " + obj1);
synchronized (obj1) {
System.out.println(name + " acquired lock on " + obj1);
work();
System.out.println(name + " acquiring lock on " + obj2);
synchronized (obj2) {
System.out.println(name + " acquired lock on " + obj2);
work();
}
System.out.println(name + " released lock on " + obj2);
}
System.out.println(name + " released lock on " + obj1);
System.out.println(name + " finished execution.");
}
private void work() {
try {
Thread.sleep(30000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is recursion?