Join Regular Classroom : Visit ClassroomTech

Tiger Analytics – Overall Interview Questions + Coding Solutions – codewindow.in

Hot Topics

Tiger Analytics Solution

Technical Round

What software and design skills do you have?

Tell about the software and design skills with which you are confident enough to answer.

How to reverse strings with changing position?

#include <bits/stdc++.h>
using namespace std;

int main() {
    
    string s,str;
    cout<<"Enter the string"<<endl;
    getline(cin,s);
    int len=s.length();

    cout<<"Reverse string is:"<<endl;
    for(int i=0;i<len;i++){
        str[i]=s[len-i-1];
        cout<<str[i];
    }
    return 0;
}
/*
OUTPUT -
Enter the string
456
Reverse string is:
654
*/

There are eight identical balls with one weighing a bit more than the others. There is a single balance. By using the balance at most twice, identify the heavier ball.

  1. To identify the heavier ball among eight identical balls with one that weighs a bit more than the others using a single balance at most twice:
  2. Divide the balls into two groups of four balls each.
  3. Use the balance to compare the two groups of four balls.
  4. If one group is heavier, pick four balls from that group and go back to step 1.
  5. If both groups weigh the same, the heavier ball must be one of the remaining four.
  6. Pick any two balls and weigh them against each other.
  7. If they weigh the same, the heavier ball must be one of the remaining two.
  8. Weigh the remaining two balls against each other to identify the heavier ball.
  9. By following these steps, you can identify the heavier ball in at most two weighings.

How you sort an array?

#include<stdio.h>
int main(){
    int array[100],n,c,d,position,swap;

    printf("Enter number of elements\n");
    scanf("%d",&n);

    printf("Enter %d integers\n",n);

    for(c=0;c<n;c++)
        scanf("%d",&array);
    
    for(c=0;c<(n-1);c++){
        position=c;

        for(d=c+1;d<n;d++){
            if(array[position]>array[d])
                position=d;
        }
        if(position != c){
            swap=array;
            array=array[position];
            array[position]=swap;
        }
    }

    printf("Sorted list\n");

    for (c  = 0; c < n; c++)
    {
        printf("%d\n",array);
    }
    
}
/*
OUTPUT 
Enter number of elements
5
Enter 5 integers
7
8
9
3
4
Sorted list
3
4
7
8
9
*/

What is Cloud data Processing?

  1. “Cloud data processing” refers to the processing of data that is stored in the cloud. In cloud data processing, data is collected, processed, and analyzed on cloud-based servers and storage systems, rather than on local computers or on-premise servers.
    The cloud provides scalable and flexible computing resources that can handle large amounts of data, making it an attractive solution for businesses that need to process and analyze large data sets. With cloud data processing, businesses can save on costs associated with purchasing and maintaining hardware and software, and benefit from faster processing times, increased collaboration, and more flexible data analysis.
    Examples of cloud data processing include:
    1. Data Warehousing: Storing and processing large amounts of structured data to support business intelligence and analytics.
    2. Big Data Processing: Analyzing large amounts of unstructured data using big data technologies, such as Hadoop, Spark, and NoSQL databases.
    3. Machine Learning: Building and training machine learning models in the cloud to support predictive analytics and other advanced data processing tasks.
    4. Real-time Data Processing: Processing data in real-time to support real-time analytics and applications, such as fraud detection and customer behavior analysis.
    Overall, cloud data processing is a crucial component of modern data management and analysis, allowing organizations to quickly and easily process, analyze, and gain insights from their data.

What is pipeline testing strategy?

  1. Pipeline testing strategy refers to the approach and methodology used to test data pipelines, which are systems that move data from one place to another within an organization. The goal of pipeline testing is to ensure that the data being moved through the pipeline is accurate, complete, and meets the necessary quality standards.
    A pipeline testing strategy typically involves the following steps:
    1. Requirements gathering: Gather the requirements for the data pipeline and the expected outcomes from the testing process.
    2. Test planning: Develop a comprehensive test plan that outlines the testing scope, objectives, and methodology.
    3. Test design: Design test cases and test data that will be used to validate the data pipeline.
    4. Test execution: Execute the test cases and evaluate the results to identify any defects or issues with the data pipeline.
    5. Defect resolution: Resolve any defects that were identified during the testing process.
    6. Test reporting: Document the results of the testing process, including the number of defects identified, the time required to resolve them, and the overall success of the testing process.
    7. Test closure: Close the testing process and move on to the next phase of the data pipeline development or deployment process.
    A pipeline testing strategy should also consider the importance of automating the testing process, using tools such as test automation frameworks and continuous integration/continuous delivery (CI/CD) tools, to improve the efficiency and effectiveness of the testing process.
    Overall, a well-planned and executed pipeline testing strategy is essential for ensuring the quality and reliability of data pipelines, and for meeting the business needs and goals of the organization.

Pseudocode for printing first n prime numbers

#include <iostream>
using namespace std;

bool isPrime(int num)
{
    for (int i = 2; i <= num / 2; ++i)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

void printFirstNPrimes(int n)
{
    int count = 0;
    int num = 2;
    while (count < n)
    {
        if (isPrime(num))
        {
            cout << num << " ";
            count++;
        }
        num++;
    }
}

int main()
{
    int n;
    cout << "Enter the value of n: ";
    cin >> n;
    cout << "The first " << n << " prime numbers are: ";
    printFirstNPrimes(n);
    return 0;
}
/*
OUTPUT
Enter the value of n: 10
The first 10 prime numbers are: 2 3 5 7 11 13 17 19 23 29 
*/

Code to print the alphabet and the number of times it appears in a given

#include <iostream>
#include <string>
using namespace std;

int main()
{
    string str;
    cout << "Enter a string: ";
    getline(cin, str);
    int count[26] = {0};
    for (int i = 0; i < str.length(); i++)
    {
        if (isalpha(str[i]))
        {
            count[tolower(str[i]) - 'a']++;
        }
    }
    for (int i = 0; i < 26; i++)
    {
        if (count[i] != 0)
        {
            cout << char(i + 'a') << " appears " << count[i] << " times" << endl;
        }
    }
    return 0;
}
/*
OUTPUT
Enter a string: codewindow
c appears 1 times
d appears 2 times
e appears 1 times
i appears 1 times
n appears 1 times
o appears 2 times
w appears 2 times
/*

If we have numbers from 1 to 10. Find the total number of ways to select two numbers in which the sum of those two numbers is even.

  1. The total number of ways to select two numbers from 1 to 10 such that the sum of those two numbers is even is equal to the number of ways to choose two numbers with an even sum plus the number of ways to choose two numbers with an odd sum.
    When choosing two numbers with an even sum, we can choose two even numbers or one odd number and one even number. There are 5 even numbers in the range 1 to 10 (2, 4, 6, 8, and 10), so there are 5 ways to choose two even numbers, and 5 ways to choose one odd and one even number. Hence, there are a total of 5 + 5 = 10 ways to choose two numbers with an even sum.
    When choosing two numbers with an odd sum, we must choose two odd numbers. There are 5 odd numbers in the range 1 to 10 (1, 3, 5, 7, and 9), so there are (5 choose 2) = 10 ways to choose two odd numbers.
    Therefore, the total number of ways to select two numbers in which the sum of those two numbers is even is 10 + 10 = 20.

Continuous moving average calculation (algorithm will do) for a large set of data (say avg for billion records) with new data coming frequently probably in 100s of records.

A continuous moving average calculation can be performed using a sliding window approach, where the average is calculated for a fixed-sized window of data at any given time. This approach can handle new data coming frequently, such as 100s of records at a time, as the moving average calculation can be updated incrementally by removing the oldest data point from the window and adding the newest data point to the window.
Here is a sample algorithm for calculating a continuous moving average for a large set of data:
  1. Initialize an empty window with a fixed size W.
  2. Initialize a variable sum to keep track of the sum of the values in the window.
  3. For each new data point x, do the following: a. Remove the oldest data point y from the window. b. Subtract y from sum. c. Add x to the window. d. Add x to sum. e. Update the moving average by dividing sum by the size of the window W.
  4. Repeat steps 3a-3e for each new data point.
This algorithm ensures that the moving average calculation is updated in real-time as new data points arrive, while maintaining a fixed-sized window. The time complexity of this algorithm is O(1) for each new data point, making it efficient for handling large sets of data, even with billions of records.

SQL Joins with multiple tables.

SQL JOIN is a clause used in SQL to combine rows from two or more tables based on a related column between them. The related column is known as the join condition.
Here is a description of the different types of SQL JOINs with multiple tables:
  1. INNER JOIN: Returns only the rows that have matching values in both tables.
SELECT *
FROM table1
INNER JOIN table2
ON table1.column_name = table2.column_name;
  1. LEFT JOIN (or LEFT OUTER JOIN): Returns all the rows from the left table (table1), and the matching rows from the right table (table2). The non-matching rows from the right table will be filled with NULL values.
SELECT *
FROM table1
LEFT JOIN table2
ON table1.column_name = table2.column_name;
  1. RIGHT JOIN (or RIGHT OUTER JOIN): Returns all the rows from the right table (table2), and the matching rows from the left table (table1). The non-matching rows from the left table will be filled with NULL values.
SELECT *
FROM table1
RIGHT JOIN table2
ON table1.column_name = table2.column_name;
  1. FULL OUTER JOIN: Returns all the rows from both tables, with the matching rows combined and the non-matching rows filled with NULL values.
SELECT *
FROM table1
FULL OUTER JOIN table2
ON table1.column_name = table2.column_name;
In each of these join types, the ON clause specifies the join condition, which defines the relationship between the two tables based on the values in a specific column.

 Find the second largest element in a list in an optimal way.

def second_largest(arr):
    # set the first two elements as the largest and second largest
    largest = max(arr[0], arr[1])
    second_largest = min(arr[0], arr[1])
    
    # loop through the rest of the list and update the largest and second largest values
    for i in range(2, len(arr)):
        if arr[i] > largest:
            second_largest = largest
            largest = arr[i]
        elif arr[i] > second_largest and arr[i] != largest:
            second_largest = arr[i]
    
    return second_largest
This algorithm uses a single loop to iterate through the list, and keeps track of the largest and second largest values as it goes. It sets the first two elements as the largest and second largest initially, and then updates them as needed as it loops through the rest of the list. The time complexity of this algorithm is O(n), making it an optimal solution for finding the second largest element in a list.

Probability of getting 5 Sundays in a 31 days month.

Any 31-day month has 31/7 = 4 weeks and 3 days
4 weeks contain 4 Sundays. And the remaining 3 days can be either of the following…
1: Mon, Tue, Wed
2: Tue, Wed, Thurs
3: Wed, Thurs, Fri
4: Thurs, Fri, Sat
5: Fri, Sat, Sun
6: Sat, Sun, Mon
7: Sun, Mon, Tue
So, P( 31-day month having 5 Sundays) = 3/7

Nagarro Solved

Automata Fixing

      

We Love to Support you

Go through our study material. Your Job is awaiting.

Recent Posts
Categories