Sopra Banking Coding Questions And Answers
Sopra Banking Coding Questions with Solution 2023
Sopra Banking Coding Questions and Answers from all the years that have been asked in Coding Round during hiring Process. This page also includes other details regarding hiring process like Job Description, Eligibility Criteria and Steps in Selection Process for specific Job-Profile in the company.
About Sopra Banking Software Ltd.
The parent company of Sopra Banking is Sopra Steria, which offers cloud-based products and solutions, specialised management systems, and support systems.
Sopra Banking Software Ltd. specialises in banking management systems. They provide banking software to control various tasks performed in banks. They also provide some specific API – Oriented softwares for various Financial organisations to control Banking and Money Related workflow in a specific way.
Sopra Banking Recruitment Process
The Online Assessment consists of following sections :
- Online Coding Assessment [ 50 Min ]
- Interview Round [ Technical + HR ]
For your reference, we have given further details for specific Job Profile offered by the company in Tabular Form :
Sopra Banking | Important Information |
---|---|
Position : | Software Engineer |
Course : |
|
Eligibility Criteria / Academic Qualification Required : |
|
Cost to Company (CTC) | 8.5 LPA |
Selection Process : |
|
Joining Location : |
|
Details of Sopra Banking Online Coding Assessment :
Points | Relevant Information | |
---|---|---|
Coding Test | 50 Minutes | |
Number Of Questions | 2 – 3 Questions |
Prime Course Trailer
Related Banners
Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription
Sample Sopra Banking Practice Coding Questions and Answers
Question 1 : Borrow Number
Problem Statement :
You have two numbers number1 and number2, your job is to check the number of borrow operations needed for subtraction of number1 from number2. If the subtraction is not possible then return the string not possible.
Example :
754
658
Answer :
2
654
666
Answer :
Not possible
#include &bits/stdc++.h> using namespace std; int main() { string s1, s2; int c = 0, f = 0; cin >> s1 >> s2; if (stoi(s1) < stoi(s2)) { cout << "Impossible"; } reverse(s1.begin(), s1.end()); reverse(s2.begin(), s2.end()); for (int i = 0; i < s1.length(); i++) if (s1[i] < s2[i]) { f = 1; c++; } else if (s1[i] == s2[i]) { if (f == 1) { c++; } f = 0; } else f = 0; cout << c; }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int number1 = sc.nextInt(); int number2 = sc.nextInt(); int count = 0; if (number1 < number2) { System.out.println("Not possible"); } else { boolean flag = false; while (number1 != 0 && number2 != 0) { int temp1 = 0; int temp2 = number2 % 10; if (flag) temp1 = number1 % 10 - 1; else temp1 = number1 % 10; if (temp1 < temp2) { count++; flag = true; } else flag = false; number1 = number1 / 10; number2 = number2 / 10; } System.out.println(count); } } }
number1 = int(input()) number2 = int(input()) count = 0 if number1 < number2: print("Not possible") else: flag = 0 while number1 != 0 and number2 != 0: temp1 = 0 temp2 = number2 % 10 if flag: temp1 = number1 % 10 - 1 else: temp1 = number1 % 10 if temp1 < temp2: count += 1 flag = 1 else: flag = 0 number1 = number1 // 10 number2 = number2 // 10 print(count)
Question 2 : Iron Magnet
Problem Statement :
We know iron behaves like magnets when all the north and the south sides are placed accordingly in a balanced way while the north comes first and then the south. Now if you are given the distribution of the north and the south poles inside the iron metal piece, you have to say how many swaps is needed to turn it into an iron, if possible, otherwise print -1.
Input Format: A string consisting N and S as north and south poles.
Output Format:
An integer denoting the number of poles will be needed.
Sample Input:
SNNSN
Output:
3
Output Description:
After we balance the iron in the way NSNNSNSS, we will get a piece of metal that will be balanced as a magnet.
#include <bits/stdc++.h> using namespace std; int main() { string s; int ans = 0, k = 0; cin >> s; for (auto i: s) { if (i == 'N') k++; else k--; if (k < 0) { k++; ans++; } } ans += k; cout << ans; }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.next(); int res = 0, j = 0; for (int i = 0; i < str.length(); i++) { if (str.charAt(i) == 'N') j++; else j--; if (j < 0) { j++; res++; } } res = res + j; System.out.println(res); } }
s = input() ans = 0 if s[0] != "N": ans += 1 s = "N" + s print(ans + abs(s.count("N") - s.count("S")))
Question 3 : Array Subarray
Problem Statement: You are given an array, You have to choose a contiguous subarray of length ‘k’, and find the minimum of that segment, return the maximum of those minimums.
Sample input :
- 1 → Length of segment x =1
- 5 → size of space n = 5
- 1 → space = [ 1,2,3,1,2]
- 2
- 3
- 1
- 2
Sample output :
- 3
Explanation :
- The subarrays of size x = 1 are [1],[2],[3],[1], and [2],Because each subarray only contains 1 element, each value is minimal with respect to the subarray it is in. The maximum of these values is 3. Therefore, the answer is 3
#include <bits/stdc++.h> using namespace std; vector < int > arr; int prevmin=-1; int flag=0; int x,n,q; int sorting(int start,int end) { if(start+1==n) {start=0;end=end-n;} if(start==end) return arr[start]; return min(arr[start],sorting(start+1,end)); } int func(int start,int end) { if(flag==0) {flag++;return prevmin=sorting(start,end);} if(arr[start-1]==prevmin) return prevmin; return prevmin=(arr[end] <= prevmin)?prevmin:sorting(start,end); } int main() { cin >> x >> n; int ans=0; for(int i=0;i < n;i++) {cin >> q;arr.push_back(q);} for(int i=0;i < n;i++) { ans=max(ans,func(i,i+x-1)); } cout << ans; }
import java.util.*; public class DiskSpace { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int x=sc.nextInt(); int n=sc.nextInt(); int arr[]=new int[n]; for(int i=0;i < n;i++) arr[i]=sc.nextInt(); int min=Integer.MAX_VALUE; int max=Integer.MIN_VALUE; for(int i=0;i <= n-x;i++) { min=Integer.MAX_VALUE; for(int j=i;j < (i+x);j++) min=Math.min(min,arr[j]); max=Math.max(min,max); } System.out.println(max); } }
n=int(input()) arr=[] for i in range(n): arr.append(int(input())) s,a=0,0 for i in arr: s=s+i if(s < 1): a=a+(-1*s) s=0 print(a)
Question 4 : Maximum Toys
In a toy shop there are a number of toys presented with several various – priced toys in a specific order. You have a limited budget and would like to select the greatest number of consecutive toys that fit within the budget. Given prices of the toys and your budget, what is the maximum number of toys that can be purchased for your child?
Example:
prices=[1,4,5,3,2,1,6]
money=6
All sub arrays that sum to less than or equal to 6 .
length 1: [1] [4] [5] [3] [2] [1] [6]
length 2: [1,4] [3,2] [2,1]
length 3: [3,2,1]
The longest of these or the maximum number of toys that can be purchased is 3.
Function description
Complete the function getMaxToys in the editor below
getMaxToys has the following parameters:
int prices[n] : the prices of the various toys
int money: the amount of money you can spend on toys
Returns
Int the maximum number of toys you can purchase
Constraints
1<=n<=10^5
1<=price[i]<=100
1<=money<=10^6
Sample case
Sample input 0
7->n=7
1-> price[]=[1,4,5,3,2,1,6]
4
5
3
2
1
6
6 ->money=6
Sample Output
3
import java.util.*; public class Main { public static int getMaxToys (int prices[], int money) { int sum = 0; int count = 0; int max = 0; for (int i = 0; i < prices.length; i++) { sum = count = 0; for (int j = i; j < prices.length; j++) { if ((sum + prices[j]) <= money) { sum = sum + prices[j]; count = count + 1; max = Math.max (count, max); } else { count = 0; sum = 0; break; } } } return max; } public static void main (String[]args) { Scanner sc = new Scanner (System.in); int n = sc.nextInt (); int prices[] = new int[n]; for (int i = 0; i < n; i++) prices[i] = sc.nextInt (); int money = sc.nextInt (); System.out.println (getMaxToys (prices, money)); } }
def getMaxToys(n,arr,money): L,H=0,n-1 while(L<=H): if(sum(arr[L:H+1])<=money): break else: if arr[L]>arr[H]: L+=1 else: H-=1 return (H-L+1) n=int(input()) arr=[] for i in range(n): arr.append(int(input())) money=int(input()) print(getMaxToys(n,arr,money))
Question 5 : Maximize Earnings (R->Hard)
Problem Statement :
A company has a list of jobs to perform. Each job has a start time, end time and profit value. The manager has asked his employee Anirudh to pick jobs of his choice. Anirudh being greedy wants to select jobs for him in such a way that would maximize his earnings.
Given a list of jobs how many jobs and total earning are left for other employees once Anirudh
Picks jobs of his choice.
Note: Anirudh can perform only one job at a time.
Input format:
Each Job has 3 pieces of info – Start Time,End Time and Profit
The first line contains the number of Jobs for the day. Say ‘n’. So there will be ‘3n lines
following as each job has 3 lines.
Each of the next ‘3n’ lines contains jobs in the following format:
start_time
end-time
Profit
start-time and end-time are in HHMM 24HRS format
i.e. 9am is 0900 and 9PM is 2100
Constraints :
The number of jobs in the day i.e’ is less.
than 10000
0<_n<_10000
start-time is always less than end time.
Output format :
Program should return an array of 2 integers where
1st one is number of jobs left and earnings of other employees
Sample Input 1 :
4
0200
0300
10
0400
0700
20
0300
0800
30
0900
1000
50
Sample Output 1:
1
20
Sample Explanation 1
CHooses 1st, 3rd and 4th job cause they don’t overlap. So only second job is remaining.
Sample Input 2:
5
0805
0830
100
0835
0900
100
0905
0930
100
0935
1000
100
1005
1030
100
Sample output 2:
0
0
Sample Explanation 2:
Anirudh can work on all appointments as there are none overlapping.
Hence 0 appointments and 0 earnings for other employees.
#include <bits/stdc++.h> using namespace std; class job { public: int st, ed, cost; }; int getTime(string s) { int hr = (s[0] - '0') * 10 + (s[1] - '0'); int min = (s[2] - '0') * 10 + (s[3] - '0'); return hr * 60 + min; } bool compare(job A, job B) { return A.ed < B.ed; } int searchJob(job arr[], int st, int ed, int key) { int ans = -1; while (st <= ed) { int mid = (st + ed) / 2; if (arr[mid].ed <= key) { ans = mid; st = mid + 1; } else { ed = mid - 1; } } return ans; } pair < int, int > solve(job arr[], int n) { int dp[n] = { 0 }; int numOfJobs[n] = { 0 }; dp[0] = arr[0].cost; numOfJobs[0] = 1; for (int i = 1; i < n; i++) { int cur = arr[i].cost; int num = 1; int idx = searchJob(arr, 0, i - 1, arr[i].st); if (idx != cur) { cur += dp[idx]; num += numOfJobs[idx]; } if (cur > dp[i - 1]) { dp[i] = cur; numOfJobs[i] = num; } else { dp[i] = dp[i - 1]; numOfJobs[i] = numOfJobs[i - 1]; } } return { numOfJobs[n - 1], dp[n - 1] }; } int main() { int n; cin >> n; job arr[n]; int cost; string st, ed; int total = 0; for (int i = 0; i < n; i++) { cin >> st >> ed >> cost; arr[i].st = getTime(st); arr[i].ed = getTime(ed); arr[i].cost = cost; total += cost; } sort(arr, arr + n, compare); pair < int, int > res = solve(arr, n); cout << n - res.first << endl; cout << total - res.second << endl; return 0; }
import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; class Job { public Integer st; public Integer ed; public Integer cost; public Job() { super(); } public Job(Integer st, Integer ed, Integer cost) { super(); this.st = st; this.ed = ed; this.cost = cost; } } class Pair { public Integer first; public Integer second; public Pair() { super(); } public Pair(Integer first, Integer second) { super(); this.first = first; this.second = second; } } class SortingJobs implements Comparator < Job > { @Override public int compare(Job o1, Job o2) { if (o1.ed < o2.ed) { return 1; } else { return 0; } } } public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); Job[] arr = new Job[n]; int cost; String st, ed; int total = 0; for (int i = 0; i < n; i++) { st = sc.next(); ed = sc.next(); if (st.length() < 4) { while (st.length() != 4) { st += "0"; } } if (ed.length() < 4) { while (ed.length() != 4) { ed += "0"; } } cost = sc.nextInt(); arr[i] = new Job(); arr[i].st = getTime(st); arr[i].ed = getTime(ed); arr[i].cost = cost; total += cost; } Arrays.sort(arr, new SortingJobs()); Pair res = new Pair(); res = solve(arr, n); if (res == null) { System.out.println(0); } else { System.out.println(n - res.first); System.out.println(total - res.second); } } private static Pair solve(Job[] arr, int n) { if (n == 0) { return null; } int dp[] = new int[n]; int numOfJobs[] = new int[n]; for (int i = 0; i < n; i++) { dp[i] = 0; numOfJobs[i] = 0; } dp[0] = arr[0].cost; numOfJobs[0] = 1; for (int i = 1; i < n; i++) { int curr = arr[i].cost; int num = 1; int idx = searchJob(arr, 0, i - 1, arr[i].st); if (idx != curr && idx != -1) { curr += dp[idx]; num += numOfJobs[idx]; } if (curr > dp[i - 1]) { dp[i] = curr; numOfJobs[i] = num; } else { dp[i] = dp[i - 1]; numOfJobs[i] = numOfJobs[i - 1]; } } return new Pair(numOfJobs[n - 1], dp[n - 1]); } private static int searchJob(Job[] arr, int st, int ed, int key) { int ans = -1; while (st <= ed) { int mid = (st + ed) / 2; if (arr[mid].ed <= key) { ans = mid; st = mid + 1; } else { ed = mid - 1; } } return ans; } private static int getTime(String st) { int hr = (st.charAt(0) - '0') * 10 + (st.charAt(1) - '0'); int min = (st.charAt(2) - '0') * 10 + (st.charAt(3) - '0'); return hr * 60 + min; } }
FAQs on Sopra Banking Coding Questions
Question 1: Is Coding questions asked in Sopra Banking Recruitment Process?
Yes, Coding Questions were asked in Online Assessment and Technical Interview of Sopra Banking Recruitment Process.
Question 2: In what field does Sopra Banking works?
Sopra Banking works in the field of banking and financial services to help there customers to operate efficiently on their financial systems and services.
Question 3: What is the minimum salary of Sopra Banking?
The salary offered by the company for Engineer Trainee is a minimum ₹6.0 Lakhs per year, for Software Engineers the minimum salary is ₹8.5 L.P.A and so on.
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