KPIT Coding Questions and Answers page will help you to get sample Coding Questions asked in the Online and Technical Assessments of the Company for hiring the freshers from 2023 and 2024 Batch. Apart from that you will be getting details on Job Profile, Expected CTC, etc. offered by KPIT Technologies.
About KPIT Technologies
KPIT Technologies is a company that provides consulting and engineering services to the automotive and transportation industries. With expertise in embedded systems, artificial intelligence, and digital product engineering, KPIT offers innovative solutions for connected vehicles, autonomous driving, and sustainability. Their commitment to customer success and cutting-edge technology makes them a trusted partner in the automotive ecosystem. This company is headquartered in Pune and has development centers in Europe, the USA, Japan, and China.
Steps of KPIT Hiring Process
Here we have mentioned everything regarding the KPIT Hiring Process for freshers:
Mr. Robot is making a website, in which there is a tab to create a password. As with other websites, there are rules so that the password gets complex and none can predict the password for another. So he gave some rules like:
– At least one numeric digit
– At Least one Small/Lowercase Letter
– At Least one Capital/Uppercase Letter
– Must not have space
– Must not have slash (/)
– At least 6 characters
If someone inputs an invalid password, the code prints: “Invalid password, try again”.
Otherwise, it prints: “password valid”.
Input Format:
A line with a given string as a password
Output Format:
If someone inputs an invalid password, the code prints: “Invalid password, try again”.
Otherwise, it prints: “password valid”, without the quotation marks.
def CheckPassword(s, n):
if n < 4:
return 0
cap = 0
nu = 0
lo = 0
for i in range(n):
if s[i] == " " or s[i] == "/":
return 0
if s[i] >= "A" and s[i] <= "Z":
cap += 1
if s[i] >= "a" and s[i] <= "z":
lo += 1
elif s[i].isdigit():
nu += 1
if cap > 0 and nu > 0 and lo > 0:
return 1
else:
return 0
s = input()
a = len(s)
if CheckPassword(s, a):
print("Password valid.")
else:
print("Invalid password, try again.")
Question 2 : Copycat in exam
Rahul copies in the exam from his adjacent students. But he doesn’t want to be caught, so he changes words keeping the letter constant. That means he interchanges the positions of letters in words. You are the examiner and you have to find if he has copied a certain word from the one adjacent student who is giving the same exam, and give Rahul the markings he deserves.
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s2,s1;
cin>>s1>>s2;
transform(s1.begin(),s1.end(),s1.begin(),::tolower);
transform(s2.begin(),s2.end(),s2.begin(),::tolower);
sort(s1.begin(),s1.end());
sort(s2.begin(),s2.end());
cout<< (s2==s1);
}
Question 3 : Last student’s ID
Problem Statement :
There is an id code that is supposed to be given to all the aspirants of an exam. It is actually a substring of a given string. That means, the authority takes a string and then assigns all the unique substrings to all the students. Suppose there is a string “abcde”, so the ids of the students will be “a”,”b”,”c”,”d”,”e”,’ab”,”abc”,”abcd”,”abcde”,”bc”,”bcd”,”bcde”,”cd”,”cde”,”de”.
The students are standing in a line according to the lexicographic order of their given ids. You have to find out the id of the last student for the given input string from which the ids are generated.
Input Format: Single line with the id generating string Output format: The last id as per lexicographical order
Constraints: Number of characters in the string<=10^9
Sample Input: abdc
Sample output: dc
Explanation: The last student will be with the id dc. The order will be abdc a ab abd abdc b bd bdc c d dc
s = input()
j = 1
c = 0
while j < len(s):
if ord(s[c]) < ord(s[j]):
c = j
j += 1
print(s[c:])
Question: 4
Problem Statement: You just received another bill that you cannot pay because you lack the money.
Unfortunately, this is not the first time to happen, and now you decide to investigate the cause of your constant monetary shortness. The reason is quite obvious: the lion’s share of your money routinely disappears at the entrance of party localities.
You make up your mind to solve the problem where it arises, namely at the parties themselves. You introduce a limit for your party budget and try to have the most possible fun with regard to this limit.
You inquire beforehand about the entrance fee to each party and estimate how much fun you might have there. The list is readily compiled, but how do you actually pick the parties that give you the most fun and do not exceed your budget?
Write a program which finds this optimal set of parties that offer the most fun. Keep in mind that your budget need not necessarily be reached exactly. Achieve the highest possible fun level, and do not spend more money than is absolutely necessary.
Input
The first line of the input specifies your party budget and the number n of parties.
The following n lines contain two numbers each. The first number indicates the entrance fee of each party. Parties cost between 5 and 25 francs. The second number indicates the amount of fun of each party, given as an integer number ranging from 0 to 10.
The budget will not exceed 500 and there will be at most 100 parties. All numbers are separated by a single space.
There are many test cases. Input ends with 0 0.
Output
For each test case your program must output the sum of the entrance fees and the sum of all fun values of an optimal solution. Both numbers must be separated by a single space.
while True:
budget, n = map(int, input().split())
if budget == 0 and n == 0:
break
cost = [0] * (n + 1)
fun = [0] * (n + 1)
arr = [[0] * (budget + 1) for _ in range(n + 1)]
for i in range(n):
cost[i], fun[i] = map(int, input().split())
for i in range(n + 1):
for j in range(budget + 1):
arr[i][j] = 0
for i in range(1, n + 1):
for j in range(1, budget + 1):
if cost[i - 1] <= j:
arr[i][j] = max(fun[i - 1] + arr[i - 1][j - cost[i - 1]], arr[i - 1][j])
else:
arr[i][j] = arr[i - 1][j]
c = 0
for i in range(budget + 1):
if arr[n][i] == arr[n][budget]:
c = i
break
print(c, arr[n][budget])
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (true) {
int budget = sc.nextInt();
int n = sc.nextInt();
if (budget == 0 && n == 0)
break;
int cost[] = new int[n + 1];
int fun[] = new int[n + 1];
int arr[][] = new int[n + 1][budget + 1];
for (int i = 0; i < n; i++) {
cost[i] = sc.nextInt();
fun[i] = sc.nextInt();
}
for (int i = 0; i <= n; i++)
for (int j = 0; j <= budget; j++)
arr[i][j] = 0;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= budget; j++)
if (cost[i - 1] <= j)
arr[i][j] = Math.max(fun[i - 1] + arr[i - 1][j - cost[i - 1]], arr[i - 1][j]);
else
arr[i][j] = arr[i - 1][j];
}
int c = 0;
for (int i = 0; i <= budget; i++) {
if (arr[n][i] == arr[n][budget]) {
c = i;
break;
}
}
System.out.println(c + " " + arr[n][budget]);
}
}
}
#include<bits/stdc++.h>
using namespace std;
int main() {
int w, n;
x: cin >> w >> n;
if (w == 0 and n == 0)
goto r;
else {
int ct[n], val[n];
for (int i = 0; i < n; i++) { cin >> ct[i] >> val[i];
}
int t[n + 1][w + 1];
for (int i = 0; i <= n; i++) {
for (int j = 0; j <= w; j++)
t[i][j] = 0;
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= w; j++) {
if (ct[i - 1] <= j)
t[i][j] = max(val[i - 1] + t[i - 1][j - ct[i - 1]], t[i - 1][j]);
else
t[i][j] = t[i - 1][j];
}
}
int cost = 0;
for (int i = 0; i <= w; i++) {
if (t[n][i] == t[n][w]) {
cost = i;
break;
}
}
cout << cost << " " << t[n][w] << endl;
goto x;
}
r: return 0;
}
Question 5: Amusement park
Problem Statement – Akshay loves to go to WONDERLA , an amusement park. They are offering students who can code well with some discount. Our task is to reduce the cost of the ticket as low as possible.
The cost of tickets can be removed by removing the digits from the price given. They will give some k turns to remove the digits from the price of the ticket. Your task is to help Akshay in coding a program that can help him to reduce the cost of a ticket by removing the digits from its price and getting the maximum possible discount.
Note – You cannot make the cost of a ticket zero. For eg -: If the cost of a ticket is 100, and you have 2 turns to reduce the price, the final price will be 1 and not zero.
Constraints:
1 <= number of tickets <= 10^5
1 <= K < Number of digits in Price of ticket
Input Format for Custom Testing:
The first line contains a string,Tickets, denoting the given cost of each ticket.
The next line contains an integer, K, denoting the number of tickets that is to be removed.
import sys
n=input()
k=int(input())
n1=len(n)
if len(n)<=k:
print(0)
sys.exit()
a=''
i=0
while i < (n1-1) and k>0:
if int(n[i])>int(n[i+1]):
i+=1
k-=1
continue
else:
a+=n[i]
i+=1
a+=n[i]
i+=1
if k>0:
a=a[:-k]
if i<=(n1-1):
while i < n1:
a+=n[i]
i+=1
print(int(a)%((10**9)+7))
import java.util.*;
class Main
{
public static void main (String[]args)
{
Scanner sc = new Scanner (System.in);
String s = sc.nextLine ();
int k = sc.nextInt ();
int ans;
System.out.println (smallestNumber (s, k) % (int) (1e9 + 7));
}
static int smallestNumber (String num, int k)
{
if (num.length () <= k)
return 0;
HashMap < Character, Integer > pos = new HashMap <> ();
for (int i = 0; i < num.length (); i++)
{
pos.put (num.charAt (i), i);
}
String temp = num;
num = sortString (num);
String ans = num.substring (0, num.length () - k);
ArrayList < Integer > v = new ArrayList <> ();
for (int i = 0; i < ans.length (); i++)
{
v.add (pos.get (ans.charAt (i)));
}
Collections.sort (v);
String ret = "";
for (int i = 0; i < v.size (); i++)
{
ret += temp.charAt (v.get (i));
}
int result = Integer.parseInt ("" + ret);
return result;
}
public static String sortString (String inputString)
{
char tempArray[] = inputString.toCharArray ();
Arrays.sort (tempArray);
return new String (tempArray);
}
}
FAQs related to KPIT Coding Questions
Question 1: What is the KPIT test procedure?
KPIT Technologies usually conducts Online Assessments 0f 1 Hour 40 Minutes which include:
Section 1: Aptitude
Section 2: Technical Questions [Domain Specific ]
Section 3: Professional Communication-related questions.
Question 2: How many rounds of interview are there in KPIT?
There are 2 Rounds of Technical assessments including Programming in C, C++, Java, SQL, and DBMS.
At last HR Interview.
Question 3: What is the salary package of KPIT?
On Average KPIT Technologies’ salary for a Software Engineer in India ranges between ₹ 4 – 6 Lakhs for less than 1 year of experience to 2 years.
Question 4: What KPIT company do?
KPIT Technologies is a company that works with the automotive and mobility industries to turn the concept of software-controlled vehicles into a reality. It specializes in developing and integrating software, helping the automobile sector to get more advanced and intelligent.
Login/Signup to comment