Bosch Coding Questions
Bosch Coding Questions 2023
Bosch Coding Questions asked in Bosch Global Software Technologies Hiring Process which is an Computer Based Online Recruitment Test (AMCAT).
Before you go through the test process, we would like to tell you some of the guidelines for attempting the test and even about the further process. Please go through the page to know more about such points before you appear for Bosch Global Software Technologies for Hiring Process FY 22 – 23.
About Bosch Global Software Technologies
Bosch Global Software Technologies provide comprehensive engineering, information technology, and business solutions, making them one of the top global suppliers of technology and services.
Bosch Global Software Technologies are at the forefront of designing, developing, and implementing IoT ecosystems thanks to our global presence and presence in the US, Europe, Japan, China, and the Asia Pacific region. This is made possible by the comprehensive capability within the three IoT aspects of Sensors, Software, and Services.
Prime Course Trailer
Recruitment Process at BGSW
Here is a complete process of recruitment at Bosch Global Software Technologies for the designation of Associate Software Engineer.
- Online Assessment (AMCAT)
- BGSW Day – Pre – Placement Talk
- Technical Discussion
- Final Online Assessment in lieu with HR Round
We have even tabulated some more information for your reference and understanding.
Bosch Global Software Technologies | Related Information |
---|---|
Batch | 2023 |
Course | B.Tech (CSE and allied branches and ECE) |
Role | Associate Software Engineer |
Education |
|
Platform | AMCAT |
Cost to Company (CTC) | 5 LPA – 7.5 LPA |
Work location | Any of the BGSW locations of Bangalore, Coimbatore, Pune or Hyderabad |
Related Banners
Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription
Bosch Coding Questions
Question 1 : Spiral Matrix
Problem Statement :
You will be given a 2d matrix. Write the code to traverse the matrix in a spiral format. Check the input and output for better understanding.
Sample Input :
Input :
5 4
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20
Output :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#include <bits/stdc++.h> using namespace std; void Spiral(vector < vector < int >> a) { if (a.size() == 0) return; int m = a.size(), n = a[0].size(); int i, k = 0, l = 0; while (k < m && l < n) { for (i = l; i < n; ++i) cout << a[k][i] << " "; k++; for (i = k; i < m; ++i) cout << a[i][n - 1] << " "; n--; if (k < m) { for (i = n - 1; i >= l; --i) cout << a[m - 1][i] << " "; m--; } if (l < n) { for (i = m - 1; i >= k; --i) cout << a[i][l] << " "; l++; } } } int main() { int r, c; cin >> r >> c; vector < vector < int >> mat(r, vector < int > (c)); for (int i = 0; i < r; i++) for (int j = 0; j < c; j++) cin >> mat[i][j]; Spiral(mat); }
import java.util.*; public class Main { public static List < Integer > solve(int [][]matrix,int row,int col) { List < Integer > res=new ArrayList < Integer > (); boolean[][] temp=new boolean[row][col]; int []arr1={0,1,0,-1}; int []arr2={1,0,-1,0}; int di=0,r=0,c=0; for(int i=0;i < row*col; i++) { res.add(matrix[r][c]); temp[r][c]=true; int count1=r+arr1[di]; int count2=c+arr2[di]; if(count1 >= 0 && row > count1 && count2 >= 0 && col > count2 && !temp[count1][count2]){ r=count1; c=count2; } else { di=(di+1)%4; r+=arr1[di]; c+=arr2[di]; } } return res; } public static void main(String[] args) { Scanner sc=new Scanner(System.in); int m=sc.nextInt(); int n=sc.nextInt(); int matrix[][]=new int[m][n]; for(int i=0;i < m;i++) { for(int j=0;j < n;j++) matrix[i][j]=sc.nextInt(); } System.out.println(solve(matrix,m,n)); } }
def spiralOrder(arr): ans = [] while arr: ans += arr.pop(0) arr = (list(zip(*arr)))[::-1] return ans arr = [] n, m = map(int, input().split()) for i in range(n): arr.append(list(map(int, input().split()))) print(*spiralOrder(arr))
Question 2 : Celsius to Fahrenheit
Problem Statement :
There are two major scales for measuring temperature, celsius & Fahrenheit.Given a floating point input for temperature in celsius scale, Write a program to convert celsius to fahrenheit, up till 2 decimal points.
Input Output
56 132.8
Explanation:
56 degrees celsius means132.8 degrees of Fahrenheit to be exact.
#includeusing namespace std; int main() { float temperature; cin >> temperature; cout << (temperature * 9) / 5 + 32; return 0; }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); float n = sc.nextFloat(); float ans = ((n * 9.0 f / 5.0 f) + 32.0 f); System.out.println(ans); } }
def ctof(c): return (c * 9) / 5 + 32 temperature = float(input()) ans = ctof(temperature) print(round(ans, 2))
Question 3 : Frequency of Array
Problem Statement :
You’re given an array of integers, print the number of times each integer has occurred in the array.
Example :
Input :
10
1 2 3 3 4 1 4 5 1 2
Output :
1 occurs 3 times
2 occurs 2 times
3 occurs 2 times
4 occurs 2 times
5 occurs 1 times
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n; map < int, int > m; while (n--) { cin >> k; m[k]++; } for (auto i: m) cout << i.first << " occurs " << i.second << " times" << endl; }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int array[] = new int[n]; // taking value of integer int count = 0; int k = 0; for (int i = 0; i < n; i++) { array[i] = sc.nextInt(); //elements of array } //step - 1 int newarray[] = new int[n]; for (int i = 0; i < n; i++) { count = 0; for (int j = 0; j <= i; j++) { if (array[i] == array[j]) { count++; } } if (count == 1) { newarray[k] = array[i]; k++; } } //step 2; for (int i = 0; i < k; i++) { count = 0; for (int j = 0; j < n; j++) { if (newarray[i] == array[j]) { count++; } } System.out.printf("%d occurs %d times\n", newarray[i], count); } } }
n = int(input()) arr = list(map(int, input().split())) dup = [] for i in arr: if i not in dup: dup.append(i) print("{} occurs {} times".format(i, arr.count(i)))
Question 4 : Prime Number Sum
Problem Statement :
You will be given a left limit and a right limit. You need to Calculate the sum of all prime numbers between a given range x and y, both inclusive.
Sample Test Case :
Input : Output :
30 68
40
Explanation :
31 and 37 are the two prime numbers in the window.
#include <bits/stdc++.h> using namespace std; unordered_map < int, bool > prime; void SieveOfEratosthenes(int n) { for (int i = 0; i < n; i++) prime[i] = 1; for (int p = 2; p * p <= n; p++) if (prime[p] == true) for (int i = p * p; i <= n; i += p) prime[i] = false; } int main() { int n, m; int count = 0, sum = 0; cin >> n >> m; SieveOfEratosthenes(m + 1); for (int i = n; i <= m; i++) if (prime[i]) sum += i; cout << sum; }
import java.util.*; public class Main { public static boolean isPrime(int no) { if (no <= 1) return false; if (no <= 3) return true; if (no % 2 == 0 || no % 3 == 0) return false; for (int i = 5; i * i <= no; i = i + 6) { if (no % i == 0 || no % (i + 2) == 0) return false; } return true; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int y = sc.nextInt(); int sum = 0; for (int i = x; i <= y; i++) if (isPrime(i)) sum = sum + i; System.out.println(sum); } }
def isPrime(n): if n <= 1: return False for i in range(2, int(n**0.5) + 1): if n % i == 0: return False return True a = int(input()) b = int(input()) x = 0 if a > 2 else 2 step = 1 if (a % 2 == 0) else 0 for i in range(a + step, b + 1, 2): if isPrime(i): x = x + i print(x)
Question 5 :Non Repeating Characters
Problem Statement :
You’re given a string, the characters in the string may get repeated in the string. You’re supposed to find the positions of the string elements that are not repeating in print them.
Note: case doesn’t matter (case insensitive)
Input : Output :
hghigiklblbmono 7 12 14
Explanation :
K, m and n do not repeat.
#include <bits/stdc++.h> using namespace std; int main() { string s; unordered_map < int, int > m; getline(cin, s); for (auto i: s) { m[i - 32]++; m[i]++; m[i + 32]++; } for (int i = 0; i < s.length(); i++) if (m[s[i]] == 1) cout << (i + 1) << " "; }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.next(); int arr[] = new int[26]; String temp = str.toLowerCase(); for (int i = 0; i < temp.length(); i++) arr[temp.charAt(i) - 97]++; for (int i = 0; i < str.length(); i++) { char ch = Character.toLowerCase(str.charAt(i)); if (arr[ch - 97] == 1) System.out.print(i + 1 + " "); } } }
from collections import defaultdict m = defaultdict(int) s = input() for i in s: m[ord(i)] += 1 m[ord(i) - 32] += 1 m[ord(i) + 32] += 1 for i in range(len(s)): if m[ord(s[i])] == 1: print(i + 1, end=" ")
FAQs on Bosch Coding Questions with Solutions
Question 1: What is the salary offered by Bosch?
Bosch offers a package of 5-7 LPA, depending on the performance on the recruitment rounds.
Question 2: What is the difficulty level of the Bosch exam?
Bosch exam is of medium to hard difficulty level. With adequate practice you can crack this exam.
Get over 200+ course One Subscription
Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others
Login/Signup to comment