TCS Ninja Technical Interview Questions and Answers

TCS Ninja Technical Interview Questions and Answers 2023

Read the most frequently asked questions TCS Ninja Technical Interview Questions as well as Answers.

Page Highlights:-

  • Top 28 TCS Ninja Technical Interview Questions
Infosys Practice Coding Question for SP & DSE Roles
Syllabus

Top 28 TCS Ninja Technical Interview Questions

Question 1: What is a tree?

Answer:

A tree is a type of hierarchical data structure that is described as a group of nodes. Value is represented by nodes, and nodes are linked by edges. 

The qualities of a tree include: 

  • The root of the tree is one of its nodes. 
  • As a result, the tree has no parents and derives its existence from this.

Question 2:- What are the 4 OOPS concepts?

Answer:

There are basically 4 OOPS concepts:

  • Encapsulation
  • Abstraction
  • Inheritance
  • Polymorphism

Question 3: What are the differences between a structure and a union in C?

StructureUnion
A structure can be defined with the keyword structA union can be defined using the union keyword.
Each component of the structure has its own specific memory location.All the data members of a union share a memory location.
The value of one data member can be changed without affecting the other data members of the structure.Other data members in the union will change in value if the value of one data member changes.
It is flexible array compatible.A flexible array cannot be supported.
The sum of the sizes of each data component makes up the structure’s overall size.The largest data member is the union’s total size.
It is mostly used to store various data types.It is mostly used to store one of the numerous data types that are available.

Questions 4: Is the operating system important? Why?

Answer:

The operating system (OS) is the most important and critical component of a computer, without which it is rendered unusable. It provides an interface or functions as a conduit for interaction between computer software installed on the operating system and users. It also aids in communication with hardware and maintains a balance between hardware and CPU. It also offers users services and a platform for programs to run on. It handles all of the common tasks that apps request.

Question 5: What are the differences between Vector and Array List?

Key Array List Vector
Size If an element is added that exceeds the capacity of the Array List, it is increased by 50% of its existing size. If an element is added that exceeds the vector’s capacity, it grows by 100% of its existing size.
Iteration The iterator interface is used by array lists to transverse their elements. Vector can navigate across elements using either the iterator or the enumerator interface.
Synchronization ArrayList has no synchronization. Vector has synchronization.
Speed ArrayList is faster when it is not synced It takes longer to sync Linked List.
Legacy ArrayList is not a legacy class. Vector is a legacy class

Question 6: What do you mean by joins in SQL?

Answer:

Data from various tables are combined into one created view using the joining method. Therefore, a relational database’s SQL Join clause in a Select statement combines columns from one or more tables and produces a set of data.

Question 7: What is a linked list?

Answer:

Linear data structures include arrays and linked lists. Links between the components of a linked list are made using pointers rather than storage like that of an array.

Question 8: What are the different types of VPN?

Answer:

  • Access VPN: Mobile users who work remotely and telecommuters can connect using an access VPN. In place of dial-up and ISDN (Integrated Services Digital Network) connections, it is used. It offers numerous connectivity options at a low price.
  • Site-to-Site VPN: In order to link the network of one office to another in different places, large businesses with branches in several locations sometimes use a site-to-site or router-to-router VPN.

There are two subcategories, as follows:

    • Intranet VPN: Intranet VPN can be used to link remote offices in various places by sharing infrastructure (such as servers and internet connectivity) and adhering to the same accessibility guidelines as a private WAN (wide area network).
    • Extranet VPN: Extranet VPN connects suppliers, customers, partners, and other organizations using dedicated connections over a shared infrastructure that is used for an intranet.

Questions 9:What is the network topology?

Answer:

The physical arrangement of the network, which connects the various nodes through links, is known as network topology. It shows how the computers, devices, wires, etc. are connected.

Question 10: What are the 4 different layers of the TCP/IP Reference Model

Answer

1. Link: Make a choice as to which connectivity, whether serial lines or traditional Ethernet, must be employed to satisfy the requirements of the connectionless internet layer.

2. Internet: 

  • The layer that holds the entire system together is the internet layer, which is crucial.
  • The IP packets are delivered where they are expected to be delivered.

3. Transport: The OSI transport layer and its functions are nearly identical. It makes it possible for network peers to converse with one another.

4. Application: Every advanced protocol is included in it.

Question 11: What is the use of ‘finalize’?

Answer

Finalize is a technique for cleaning up before Garbage Collection and releasing uncontrolled resources (GC). It manages memory in this way.

Question 12: What is exception handling?

Answer:

The idea of exception handling, which is used to manage failures, is crucial in object-oriented programming. A centralized approach for error resolution is implemented via an exception handler, which enables errors to be thrown and caught.

Question 13: Define checkpoint.

Answer:

The Checkpoint is a type of method where all previous logs are permanently kept in the storage disc and removed from the system. The two methods that can assist the DBMS in recovering and maintaining the ACID properties:

  • Preserving the transaction log for each transaction 
  • maintaining shadow pages

Checkpoints are created when it comes to log-based recovery systems. The database engine can restore to checkpoints as a minimum point from which it can use the transaction log record to recover all committed data up to the time of the crash.

Question 14: Define Data Manipulation Language.

Answer:

The Data Manipulation Language (DML) is a language that allows users to access or modify data that has been arranged according to the correct data model. SELECT, UPDATE, INSERT, and DELETE are a few examples.

There is two type of DML:

Procedural DML or Low level DML: The user must describe the data that are required and how to obtain them.

Non-Procedural DML or High level DML: The user must specify the data that are required without indicating how to obtain such data.

Question 15: What is inheritance?

Answer:

Inheritance refers to inhering the data members and properties of a parent class to a child class. A class that is derived from another level is often called a sub-class or a child class, and the type from which the child class is obtained is known as super-class or parent class.

Question 16: What are the different types of Operating Systems?

Answer:

  •  Batched OS (Example: Payroll System, Transactions Process, etc.)
  • Multi-Programmed OS (Example: Windows O/S, UNIX O/S, etc.)
  • Timesharing OS (Example: Multics, etc.)
  • Distributed OS (LOCUS, etc.)
  • Real-Time OS (PSOS, VRTX, etc.)

Question 17: Define cloud computing.

Answer:

In order to provide computing as a service, a cloud is made up of a variety of services, networks, hardware, storage, and interfaces. 

There are often three users. These include 

  • Cloud service provider. 
  • End-users.
  • Business management users. 

The person who utilizes cloud services is known as the end-user. The business management user in the cloud is in charge of the data and services that are offered by the cloud. The cloud service provider is in charge of maintaining and caring for the IT resources of the cloud. For its users, the cloud serves as a central hub for all of their computing requirements.

Question 18: What are the main constituents that are part of the cloud ecosystem?

Answer:

The following components of the cloud ecosystem affect how you understand cloud architecture:

  • Cloud consumers
  • Direct customers
  • Cloud service providers

Question 19: Define RAID structure in OS.

Answer:

Redundant Arrays of Independent Disks, or RAID, is a technique for storing data across numerous hard discs. As a result, it is regarded as a data storage virtualization technology that integrates multiple hard discs. It simply strikes a balance between data security, system performance, storage capacity, etc. The effectiveness and dependability of data storage are increased as a result. In order to establish data redundancy and decrease data loss, it also expands the system’s storage capacity.

Question 20: What do you understand by the term RTOS? Also, what are the different types of RTOS?

Answer:

The real-time operating system (RTOS) is a type of operating system used for real-time applications, or those where data processing must be completed in a certain amount of time. Additionally, it handles all processes related to execution, monitoring, and control. Less memory is used, and fewer resources are used overall.

Types of RTOS:

  • Hard Real-Time
  • Firm Real-Time
  • Soft Real-Time

Question 21: Define HTTP and HTTPS.

Answer:

HTTP: The Hyper Text Transfer Protocol (HTTP) establishes a set of guidelines and requirements for the transmission of information across the World Wide Web (WWW). It facilitates communication between web servers and browsers. Each command in this so-called “stateless protocol” is independent of the one before it. An application layer protocol based on TCP is HTTP. By default, port 80 is used.

HTTPS: The Hyper Text Transfer Protocol Secure, sometimes known as Secure HTTP It is a more sophisticated and secure variant of HTTP. SSL/TLS protocol is used to add security on top of HTTP. Encrypting the communication makes transactions safer and aids in securely identifying network servers. By default, port 443 is used.

Question 22: Write a code to swap two numbers without using a third variable using Python.

a=int(input(“Enter value : “))
b=int(input(“Enter value : “))

print(“Before swapping a :”,a)
print(“Before swapping b :”,b)
#logic to swap without using third variable 
a=a+b 
b=a-b
a=a-b


print(“After swapping a becomes :”,a)
print(“After swapping b becomes :”,b) 

Question 23: Write program to generate the Fibonacci series starting from 0 using C.

#include

int main()
{
    int n = 10;
    int a = 0, b = 1;
    
    // printing the 0th and 1st term
    printf("%d, %d",a,b);
    
    int nextTerm;
    
    // printing the rest of the terms here
    for(int i = 2; i < n; i++){
        nextTerm = a + b;
        a = b;
        b = nextTerm;
        
        printf("%d, ",nextTerm);
    }

    return 0;
}

Question 24: Write a program to find the GCD of two numbers using JAVA.

import java.util.*;
public class Solution
{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int num1=sc.nextInt();
		int num2=sc.nextInt();
		int min=num1=1;i--)
		    if((num1%i==0) && (num2%i==0))
		        break;
		System.out.println("GCD of "+num1+" and "+num2+" is "+i);
	}
}

Question 25: Write a program to check whether a number is a palindrome or not using C++.

//C++ Program to check whether a number is palindrome or not
#include
using namespace std;

//main program
int main ()
{
//variables initialization
int num, reverse = 0, rem, temp;
num=12321;
cout <<"\nThe number is: "<<num;

temp = num;
//loop to find reverse number
while(temp != 0)
{
rem = temp % 10;
reverse = reverse * 10 + rem;
temp /= 10;
};

// palindrome if num and reverse are equal
if (num == reverse)
cout << num << " is Palindrome";
else
cout << num << " is not a Palindrome";

}
// Time Complexity : O(N)
// Space Complexity : O(1)
// where N is the number of digits in num

Question 26: Write a program to find the factorial of a number using Python.

num = 5
output = 1
for i in range(2,num+1):
  output*=i
print(output)

Question 27: Write a program to check whether the year is a leap year using C++.

#include 
using namespace std;

int main()
{
    int year;

    year=2000;

    if(year % 400 == 0)
        cout << year << " is a Leap Year";
        
    else if(year % 4 == 0  && year % 100 != 0)
        cout << year << " is a Leap Year";
        
    else
        cout << year << " is not a Leap Year";
    
    return 0;
}

Question 28: Write a program to find the LCM of two numbers.

#include
using namespace std;

int main()
{
int num1 = 12, num2 = 14, lcm;

// finding the larger number here
int max = (num1 > num2)? num1 : num2;

// LCM will atleast be >= max(num1, num2)
// Largest possibility of LCM will be num1*num2
for(int i = max ; i <= num1*num2 ; i++)
{
if(i % num1 == 0 && i % num2 == 0){
lcm = i;
break;
}
}

cout<<"LCM of "<<num1<<" and "<<num2<<" is "<<lcm;

return 0;
}
// Time Complexity : O(N)
// Space Complexity : O(1)
#include

int main()
{
    int num1 = 36, num2 = 60, lcm;

        // finding the larger number here
        int max = (num1 > num2)? num1 : num2;
        
        // LCM will atleast be >= max(num1, num2)
        // Largest possibility of LCM will be num1*num2
        for(int i = max ; i <= num1*num2 ; i++)
        {
            if(i % num1 == 0 && i % num2 == 0){
                lcm = i;
                break;
            }
        }
    
    printf("The LCM: %d", lcm);
    
    return 0;
}
// Time Complexity : O(N)
// Space Complexity : O(1)