BNP Paribas interview prep
5 practice questions on the topics candidates reported from BNP Paribas interviews, with answers. The questions are ours; each one links to the interview report that names its topic.
DSA 3
-
Prices over six days are [7, 1, 5, 3, 6, 4]. Buying once and selling once later, what is the best profit?
- 5
- 6
- 4
- 0
Show the answer
A. 5
Buy at 1, sell at 6. One pass keeps the lowest price so far and the best price minus that low, O(n). Selling at 7 is impossible because 7 comes before 1.
This topic is named in a candidate’s interview report: Software engineer intern on-campus interview, 2024, on Code360.
-
What is the largest product of a contiguous subarray of [2, -5, -2, -4, 3]?
- 20
- 30
- 24
- 240
Show the answer
C. 24
[-2, -4, 3] gives 24, and [2, -5, -2] gives 20. Keep both the largest and the smallest product ending at each index, because a negative number turns the smallest into the largest; swap them when the current number is negative.
This topic is named in a candidate’s interview report: Software engineer intern on-campus interview, 2024, on Code360.
-
Intervals [1, 3], [2, 4], [6, 7], [9, 12] and [11, 13]. Which overlap no other interval (sharing an end point counts as overlapping)?
- [6, 7] only
- [1, 3] and [6, 7]
- [6, 7] and [9, 12]
- None of them
Show the answer
A. [6, 7] only
Sort by start; an interval is isolated when it starts after the largest end seen so far and ends before the next interval starts. [1, 3] and [2, 4] overlap, as do [9, 12] and [11, 13]. Sorting makes it O(n log n).
This topic is named in a candidate’s interview report: Software engineer intern on-campus interview, 2024, on Code360.
Java 1
-
In System.out.println("hi"), what are System, out and println?
- A package, a class and a keyword
- System is a class in java.lang, out is its public static field of type PrintStream, and println is a method of PrintStream
- System is an object, out a method and println a field
- Three keywords of the language
Show the answer
B. System is a class in java.lang, out is its public static field of type PrintStream, and println is a method of PrintStream
out is a static field, so it is reached through the class name with no System object. It is a PrintStream wired to standard output; System.err is another PrintStream for errors, and System.setOut can replace out.
This topic is named in a candidate’s interview report: Java developer intern interview, Chennai, 2019, on GeeksforGeeks.
DBMS and SQL 1
-
customer has the names Balaji, Abhay, Shobana and Saba. With a case-sensitive comparison, which names does this return?
SELECT name FROM customer WHERE name LIKE '%ba%';- Balaji, Shobana and Saba
- Saba only
- Shobana and Saba
- Abhay, Shobana and Saba
Show the answer
C. Shobana and Saba
% matches any run of characters, including none, so the pattern means "ba" anywhere in the name. Shobana and Saba contain lower-case "ba". Balaji starts with "Ba", which a case-sensitive comparison does not match, and Abhay has "bh", not "ba". MySQL's default collations are case-insensitive and would add Balaji.
This topic is named in a candidate’s interview report: Java developer intern interview, Chennai, 2019, on GeeksforGeeks.