Tech Mahindra 2nd Round 12th April Exam Shifts All Sections Question with Solution | Non-SDE Tech & Psychometric Assessment (1A/1B/1C)

 

Tech Mahindra 2nd Round 12th April Exam Shifts All Sections Question with Solution
Tech Mahindra 2nd Round 12th April Exam Shifts All Sections Question with Solution


Tech Mahindra 2nd Round 12th April Exam Shifts All Sections Question with Solution | Non-SDE Tech & Psychometric Assessment (1A/1B/1C) Solved by Pappu Career Guide

Tech Mahindra 2nd Round 13th April Exam Shifts Non-SDE Tech All Sections Question with Solution

TECH MAHINDRA Non-SDE ALL CODING SOLUTIONS:

1. Geometric Progression Question with Solution:

Geometric Progression In C++

// Solved By Pappu Career Guide

#include <bits/stdc++.h>

using namespace std;
// Solved By Pappu Kumar (Coder Guy)
int main() {

    double second_term;

    double third_term;

    int n;

    cin>>second_term>>third_term>>n;

    double r = third_term/second_term;  //9/3=3

    double a = second_term/r;

    double nth_term = a * pow( r, n-1);
    cout<<nth_term;

return 0;

}

In Python

Coming Soon.....

In C

Coming Soon.....

2. BitWise Operation Question with Solution:

In C++
// solved by Pappu Kumar Guide

#include <bits/stdc++.h>

using namespace std;

int main() {

// a#b#c
// ex 
// 10 - binary- 1 0 1 0
// output 2#1#3

int n;

cin>>n;

int a=0; // most

int b=-1; // least

int c=-1;

int i=0;
// solved by Pappu Career Guide

// performing bit marking
while(n>0)

{
    if(n&1)

    {
        a++;

        if(b==-1)

        {

            b=i;
        }

        c=i;
    }

    i++;

    n=n>>1; //right shift
}

cout<< to_string(a)<<"#" << to_string(b) <<"#" << to_string(c);
// solved by Pappu Kumar Guide
return 0;

}

In Python

n=int(input())

bi=bin(n)

bi=int(bi[2:])

x=[]

// Solved By Pappu Career Guide

while(bi>0):

    x.append(bi%10)

    bi//=10

a=x.count(1)

b=x.index(1)

x.reverse()

c=len(x)-x.index(1)-1

print(a,b,c,sep="#")

In C

Coming Soon.....

https://t.me/techmahindra2021crack

3. Frequency Count Question with Solution:

Frequency Count In C++
// Solved By Pappu Career Guide

#include <bits/stdc++.h>

using namespace std;

string helper(string s)

// Solved By Pappu Kumar (Coder Guy)

{
    int arr[26]={0};  // there are 26 alphabets 
in the english char
    for(int i=0;i<s.length();i++) // loop through 
the input string
    {
        arr[s[i]-97]++; // 
to come back with the 0 position

    }
    string result="";

    for(int i=0;i<26;i++)  // for character 
count with loop
    {
        if(arr[i]>0) // if char is present

        {
            char ch = 97+i; // add the value of 
ASCII value of i = 1 - taking b
            result+=ch;

            result+=to_string(arr[i]);

        }

    }

    return result;
}

int main() {

    string s;

    cin>>s;

    cout<<helper(s);

    return 0;

}

In Python

Coming Soon.....


In C

Coming Soon.....


4. Caesar Cipher Question with Solution:

Caesar Cipher In C++
// Solved By Pappu Career Guide

#include <bits/stdc++.h>
using namespace std;
// Solved By Pappu Kumar (Coder Guy)

string helper(string s)
{
    string result = ""; // answer store string

    for(int i=0;i<s.length();i++) // loop through
 the input string

    {
        char ch = char((s[i] + 3 - 97)%26 + 97);

        result+=ch;

    }

    return result;

}
int main() {

    string s;

    cin>>s;

    cout<<helper(s);

    return 0;


}

In C

Coming Soon.....

In Python

Coming Soon.....

5. Number of Decodings

The solution in Python:

def numDecodings(s): 

 if not s:

  return 0

 dp = [0 for x in range(len(s) + 1)] 

 # base case initialization

 dp[0] = 1 

 dp[1] = 0 if s[0] == "0" else 1   #(1)

 for i in range(2, len(s) + 1): 

  # One step jump

  if 0 < int(s[i-1:i]) <= 9:    #(2)

   dp[i] += dp[i - 1]

  # Two step jump

  if 10 <= int(s[i-2:i]) <= 26: #(3)

   dp[i] += dp[i - 2]

 return dp[len(s)]

https://t.me/techmahindra2021crack

s=input()

print(numDecodings(s))

In C

Coming Soon.....

In c++

Coming Soon.....

How To for Download All Section Non-SDE Tech & Psychometric Assessment (1A/1B/1C) and Coding solution Complete in One PDF:  
 
All candidates All Section Non-SDE Tech & Psychometric Assessment (1A/1B/1C) and Coding solution Complete in One PDF download here:

Join Our Whats App Group

Step#1: Go to the above link, Join Our What's App Group.

Note: If Already Joined, Directly Apply Through Step#3.

Step#3: Apply Link: Click Below Link To Apply

Download Updated* Link: Click here (PDF Link)

Note: Download Now Complete PDF Files.

Also, Read More about this: 

Also, apply for other jobs,

TCS March Latest NQT Interview Experience 2021


Tips to Follow to Crack Tech Mahindra Exam 2021

CTS - Cognizant 96 Important Interview Questions 2021

TCS Ninja and Digital 2021 All Interview Questions

Hexaware technical interview 2021 

Stay tuned with www.freshersocjob.com to receive more such updates on recruitment. Join our Telegram Channel and Join our WhatsApp Group To get Instant updates for All Recruitment Internships and Off-Campus of 2021 Pass-Out Batch and Other Batch.


Comments

Post a Comment