Join Regular Classroom : Visit ClassroomTech

Tejas Network Overall Interview Questions + Coding Solutions – codewindow.in

Hot Topics

Tejas Solution

Technical Round

What are the events that occur when we write something in the browser till the results appear?

  • Browser looks for the IP address for the domain
  • Browser initiates TCP connection with the server
  • Browser sends the HTTP request to the server
  • Server processes request and sends back a response

Give an example of guest indulgence.

Guest indulgence is when a hotel or other hospitality business offers special amenities or services to guests beyond what is typically offered. An example of this might be a hotel offering a complimentary bottle of wine or a spa treatment to guests who book a certain room package. Another example might be a restaurant offering a complimentary dessert to guests celebrating a special occasion.

Explain TCP/IP protocol.

TCP/IP is a widely used communication protocol, and it is the standard for communication on the internet. Many other protocols, such as HTTP for the web, FTP for file transfer, and DNS for domain name resolution, work on top of TCP/IP to provide additional functionality.

Write a code for runtime and compile time polymorphism.

Runtime Polymorphism:
class Animal {
   void eat() {
      System.out.println("The animal eats");
   }
}

class Dog extends Animal {
   void eat() {
      System.out.println("The dog eats bones");
   }
}

class Cat extends Animal {
   void eat() {
      System.out.println("The cat eats fish");
   }
}

class TestPolymorphism {
   public static void main(String[] args) {
      Animal a = new Animal();
      Animal b = new Dog();
      Animal c = new Cat();
      a.eat();
      b.eat();
      c.eat();
   }
}
/*
output:
The animal eats
The dog eats bones
The cat eats fish
*/
Compile time Polymorphism:
class Calculator {
   int add(int a, int b) {
      return a + b;
   }

   int add(int a, int b, int c) {
      return a + b + c;
   }

   double add(double a, double b) {
      return a + b;
   }
}

class Main {
   public static void main(String[] args) {
      Calculator calculator = new Calculator();
      System.out.println("Sum of two integers: " + calculator.add(10, 20));
      System.out.println("Sum of three integers: " + calculator.add(10, 20, 30));
      System.out.println("Sum of two doubles: " + calculator.add(10.5, 20.5));
   }
}
/*
output:
Sum of two integers: 30
Sum of three integers: 60
Sum of two doubles: 31.0
*/

Recursive traversal of linked list.

Here is a Java code for recursive traversal of a singly linked list:
class Node {
   int data;
   Node next;

   Node(int data) {
      this.data = data;
      next = null;
   }
}

class LinkedList {
   Node head;

   void printList(Node node) {
      if (node == null) {
         return;
      }
      System.out.print(node.data + " ");
      printList(node.next);
   }

   public static void main(String[] args) {
      LinkedList list = new LinkedList();
      list.head = new Node(1);
      list.head.next = new Node(2);
      list.head.next.next = new Node(3);
      list.head.next.next.next = new Node(4);
      list.printList(list.head);
   }
}
/*
output:
1 2 3 4 
*/

Priority queue Kadane algo Matrix multiplication DP

  1. Priority Queue: A priority queue is a special type of queue in which each element is associated with a priority and is served according to its priority. If elements with the same priority occur, they are served according to their order in the queue. Priority queues are often implemented using heaps.
  2. Kadane’s Algorithm: Kadane’s algorithm is an efficient method for finding the maximum sum subarray in an array of integers. It is a dynamic programming algorithm that maintains a running sum while iterating through the array, and keeps track of the maximum sum seen so far. It can also handle the case when all elements of the array are negative.
  3. Matrix Multiplication: Matrix multiplication is an operation that takes two matrices as input and produces a third matrix as output. It is defined as the dot product of the matrices. The size of the resulting matrix is determined by the number of rows of the first matrix and the number of columns of the second matrix. There are several algorithms for matrix multiplication, including the naive algorithm and the Strassen algorithm, which is more efficient for large matrices.
  4. Dynamic Programming (DP): Dynamic Programming is a general optimization technique that is used to solve problems by breaking them down into smaller subproblems and storing the solutions to these subproblems for future use. It is particularly useful for solving problems with overlapping subproblems, such as finding the shortest path in a graph or the longest common subsequence of two strings. It can be implemented using a bottom-up or a top-down approach, with the latter being more efficient in terms of memory usage.

Given a flip flop with a finite setup and hold time driven by a combinational circuit of finite delay. How will you calculate the max clock frquency at which it can operate.

To calculate the maximum clock frequency, you can use the following formula:
1 / (setup time + hold time + combinational circuit delay)

How to save a binary search tree space efficiently and build again?

There are several ways to save space when storing a binary search tree (BST) and then rebuild it.
One way to save space is to use a compact representation of the tree, such as a threaded binary tree. In a threaded binary tree, a node that doesn’t have a left or right child is given a special “thread” pointer that points to the in-order successor or predecessor of the node. This allows traversing the tree without the need for explicit null pointers, which can save space.

oops concepts like polymorphism ,inheritance etc , data structures concepts like linked list.

  1. Polymorphism: Polymorphism is a concept in object-oriented programming that allows objects of different classes to be treated as objects of a common superclass. This allows for greater flexibility and code reuse. There are two types of polymorphism: compile-time polymorphism (also known as static polymorphism) and runtime polymorphism (also known as dynamic polymorphism). Compile-time polymorphism is achieved through function overloading and operator overloading, while runtime polymorphism is achieved through the use of virtual functions and function pointers.
  2. Inheritance: Inheritance is a mechanism that allows a class to inherit the properties and methods of another class. This allows for the creation of a hierarchical class structure where a derived class inherits the characteristics of a base class. A derived class can also add new properties and methods, or override the inherited properties and methods. This allows for code reuse and a natural organization of related classes.
  3. Linked List: A linked list is a data structure that consists of a sequence of nodes, where each node contains a value and a pointer to the next node in the list. Linked lists are a dynamic data structure, meaning that their size can change during the execution of a program. They are useful for situations where the size of the data is not known ahead of time or when items are frequently added or removed from the list. Linked lists have a number of advantages over arrays, such as constant-time insertions and deletions, but also have some disadvantages, such as slower random access.
  4. Data Structures: A data structure is a specific way of storing and organizing data in a computer so that it can be accessed and modified efficiently. Common data structures include arrays, linked lists, stacks, queues, trees, and graphs. Each data structure has its own strengths and weaknesses and is suited to different types of problems. Understanding the properties and trade-offs of different data structures is an essential part of designing efficient algorithms and programs.

 

String palindrome in 10 ways?

  1. Using a for loop to iterate through the string and compare the first and last characters, then the second and second-to-last characters, and so on.
  2. Using the built-in string functions to reverse the string and compare it with the original string.
  3. Using recursion to check whether the first and last characters of the string are equal and recursively check the rest of the string.
  4. Using the stack data structure to push each character of the string onto the stack, and then pop them off and compare them with the original string.
  5. Using the queue data structure to enqueue each character of the string, and then dequeue them and compare them with the original string.
  6. Using a hash table to store the frequency of each character in the string, and then checking if the frequency of each character is equal to half of the string length for palindrome check.
  7. Using bit manipulation by checking if the binary representation of the string is equal to its reverse.
  8. Using a combination of stack and queue data structures to check if the order of characters is same in forward and reverse direction.
  9. Using a combination of for loop and recursion to check for palindrome.
  10. Using a combination of stack and recursion to check for palindrome.
Each of these methods has its own advantages and disadvantages, and the best approach will depend on the specific requirements of the problem, the size of the input, and the performance constraints.

Advantages of java.

Java is a popular programming language that has several advantages, including:
  1. Platform independence: Java code can run on any platform that has a Java Virtual Machine (JVM) installed, which means that Java programs can run on a wide variety of devices and operating systems.
  2. Object-oriented: Java is an object-oriented language, which means that it supports encapsulation, inheritance, and polymorphism, making it easy to create and maintain large, complex code bases.
  3. Automatic memory management: Java uses a garbage collector to automatically manage memory, which means that developers don’t have to worry about freeing memory or dealing with memory leaks.
  4. Large standard library: Java has a large standard library that includes many useful classes and functions, making it easy to perform common tasks such as reading and writing files, connecting to databases, and handling network connections.
  5. Robust and secure: Java has built-in support for exception handling and type checking, which makes it less prone to errors and more robust than some other languages. Additionally, Java has a number of security features that make it a secure choice for building enterprise and web applications.
  6. Multithreading: Java supports multithreading, which allows for concurrent execution of multiple threads of execution, which can make a program run faster and more efficiently.
  7. Open source: Java is an open source programming language, which means that it can be used freely and that its source code is freely available.
  8. Community: Java has a large and active community of developers, which means that there are many resources available for learning and troubleshooting and also Java has many opensource libraries available for developers to use.

Applying bit maps for sorting 20k integers using memory for 500 elements.

Here’s an example of how bit maps can be used to sort 20,000 integers using memory for only 500 elements:
  1. Create a bit map of size 20,000, with each bit initially set to 0.
  2. Iterate through the 20,000 integers and for each integer, set the corresponding bit in the bit map to 1.
  3. Iterate through the bit map, and for each bit that is set to 1, add the corresponding integer to a sorted list.
  4. The sorted list now contains all 20,000 integers sorted in ascending order.
the bit map approach is an efficient way to sort a large number of integers when memory is limited, but it has some limitations, such as being efficient only for small range of integers and not taking into account the frequency of the numbers.

What is data base management?

Database management includes several tasks such as creating the database structure, defining relationships between tables, inserting, updating, and deleting data, ensuring data integrity and security, and providing users with access to the data through a database management system (DBMS).

OOPs concepts, pointers, references, medium level coding questions to be written on paper.

Regarding OOPs concepts, they are:
  1. Encapsulation: Encapsulation is a technique of wrapping the data (variables) and functions (methods) together inside a class.
  2. Inheritance: Inheritance allows a new class to be derived from an existing class.
  3. Polymorphism: Polymorphism allows a single function or method to work with multiple data types.
  4. Abstraction: Abstraction refers to the ability of an object to hide its internal state and expose only relevant information to the outside world.
Regarding pointers, they are a variable that stores a memory address. It is used to point to a specific memory location in the computer’s memory where a value is stored. Pointers are typically used to work with large data structures and dynamic memory allocation.
Regarding references, they are an alias for an already existing variable. It is a way to create an alternate name for a variable, which allows you to refer to the same memory location by multiple names.
Regarding medium level coding questions, they are usually questions that require a moderate understanding of programming concepts and the ability to implement them in code. Examples could include:
  • Implementing a specific data structure such as a binary search tree or a hash table.
  • Implementing a specific algorithm such as a sorting algorithm or a graph traversal algorithm.
  • Solving a specific problem such as finding the shortest path in a graph or detecting a cycle in a linked list.
In general, these questions require the ability to understand the problem, analyze it, and then implement a solution in code.

Given a scenario and asked how to design an algorithm using suitable data structure 

Here is an example scenario:
Scenario: You are building a social media platform and you need to store information about users, including their name, age, and list of friends. You also need to be able to perform the following operations:
  • Add a new user to the system.
  • Find the friends of a given user.
  • Find the mutual friends between two given users.
Data Structure: One possible data structure that could be used to solve this problem is a graph. A graph is a collection of nodes, where each node represents a user and edges represent the friendship between two users. Each node can have several properties like name, age etc and edges can have properties like mutual friends etc.
Algorithm:
  1. Create a graph data structure to represent the users and their connections.
  2. When adding a new user, create a new node in the graph with the user’s name, age, and any other relevant properties.
  3. When finding the friends of a given user, traverse the graph and find all the nodes that are connected to the given user’s node via an edge.
  4. When finding the mutual friends between two given users, traverse the graph and find all the nodes that are connected to both given users’ nodes via an edge.

switches DBMS deadlock and normalization

  1. Deadlock: Deadlock is a situation in which two or more transactions are blocked and unable to proceed because each is waiting for one of the others to release a resource. This can happen in a database management system (DBMS) when multiple transactions are trying to access the same resources simultaneously. Deadlocks can cause a system to freeze and prevent any further transactions from being processed.
  2. Normalization: Normalization is the process of organizing data in a relational database management system (RDBMS) so that data is stored in a structured and consistent format. The goal of normalization is to minimize data redundancy and improve data integrity by dividing large tables into smaller, more manageable tables and establishing relationships between them.

 What is the run time of binary sort?

The runtime of binary sort, also known as binary search, is O(log n), where n is the number of elements in the list or array being searched.This is because the algorithm repeatedly divides the search space in half, and the number of times it needs to do this is determined by the logarithm of the size of the list or array.

Nagarro Solved

Automata Fixing

      

We Love to Support you

Go through our study material. Your Job is awaiting.

Recent Posts
Categories