Junior Java Interview Questions -- What to Expect?

  • Context: Java 
  • Thread starter Thread starter Robben
  • Start date Start date
  • Tags Tags
    Interview Java
Click For Summary

Discussion Overview

The discussion revolves around what to expect from a math-based coding interview question for a junior Java internship. Participants explore potential types of questions and coding challenges that may be presented during the interview.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Homework-related

Main Points Raised

  • One participant inquires about the nature of a math-based question they must code for an internship interview, seeking examples of general math questions.
  • Another participant suggests asking the recruiter for clarification about the interview question, questioning the taboo of such inquiries.
  • Some participants propose that the coding task may involve converting a String input to a numerical value, with various examples provided, such as extracting numbers from a mixed String or evaluating mathematical expressions.
  • Specific examples discussed include coding to handle inputs like "4 + 2", "12 / 3", and more complex expressions with operator precedence.
  • Participants express uncertainty about the expected complexity of the coding tasks, with one noting that simple tasks may require additional error handling.
  • There is a discussion about the methods of error handling, with suggestions of using try-catch blocks within loops to manage user input validation.

Areas of Agreement / Disagreement

Participants generally agree that asking the recruiter for clarification is acceptable. However, there is no consensus on the specific nature of the coding tasks or the complexity expected in the interview.

Contextual Notes

Participants mention various assumptions about the interview format and the types of questions, but these remain unresolved. The discussion reflects a range of potential coding challenges without definitive conclusions.

Who May Find This Useful

Individuals preparing for junior Java internship interviews, particularly those interested in coding challenges involving mathematical concepts and error handling in Java.

Robben
Messages
166
Reaction score
2
I am applying for a junior java internship and the recruiter told me there is going to be a math based interview question that I must code. What can I expect from this math based question? Are there general math questions that you can provide me so that I will have a good understanding of what to expect?
 
Technology news on Phys.org
Robben said:
I am applying for a junior java internship and the recruiter told me there is going to be a math based interview question that I must code. What can I expect from this math based question? Are there general math questions that you can provide me so that I will have a good understanding of what to expect?
Have you tried asking the recruiter?
 
Borg said:
Have you tried asking the recruiter?
I thought it would have been bad/taboo to ask the recruiter lol? So it is acceptable to ask the recruiter?
 
Robben said:
I thought it would have been bad/taboo to ask the recruiter lol? So it is acceptable to ask the recruiter?
If I was concerned about my ability to be fully prepared for an interview, I would check with the recruiter to clarify anything that I was unsure about. Maybe that's just me. I did ask for a raise after I got a job once - I got the raise. I think that if you just ask for clarification about the test and present it as wanting to be fully prepared for the interview, you shouldn't break any taboos.

BTW, good luck in the interview.
 
  • Like
Likes   Reactions: Robben
Borg said:
If I was concerned about my ability to be fully prepared for an interview, I would check with the recruiter to clarify anything that I was unsure about. Maybe that's just me. I did ask for a raise after I got a job once - I got the raise. I think that if you just ask for clarification about the test and present it as wanting to be fully prepared for the interview, you shouldn't break any taboos.

BTW, good luck in the interview.

I talked to the recruiter and they stated that I must code the answer to find a numerical value. Do you have any ideas what they mean?
 
Robben said:
I talked to the recruiter and they stated that I must code the answer to find a numerical value. Do you have any ideas what they mean?
It sounds like you will be given a value as a String or some other non-numerical format and will be expected to return the numerical value. There could be any number of ways to code that depending on the problem that they give you. For example, could you code the following cases?
  • Write a program that takes a String input from a user and outputs the value as a number. Pretty simple and straightforward - you probably won't get this lucky. :oldtongue:
  • Or, the above problem where the user can input letters and numbers and you have to find the numbers within - For example, given the input "fosi7f2h98s", your program should output 7, 2, 98 (or 7, 2, 9, 8 depending on how they ask for it).
  • Given an input string of the following formats, write a program that calculates the answer - For example, "4 + 2", "12 / 3", or "2*6". Note that some have spaces and some do not.
  • Or, the above problem with multiple operations taking into account operator preference - For example, "4+2*6/2-3". You would have to look ahead to make sure that the next operator(s) don't take precedence over the current one such that you don't add 4 to the 2 before multiplying it by 6 and then dividing it by 2.
  • And, probably worst of all, given an input of the form "4plus2times6divided by2minus3", find the answer.
 
Last edited:
Borg said:
It sounds like you will be given a value as a String or some other non-numerical format and will be expected to return the numerical value. There could be any number of ways to code that depending on the problem that they give you. For example, could you code the following cases?
  • Write a program that takes a String input from a user and outputs the value as a number. Pretty simple and straightforward - you probably won't get this lucky. :oldtongue:
  • Or, the above problem where the user can input letters and numbers and you have to find the numbers within - For example, given the input "fosi7f2h98s", your program should output 7, 2, 98 (or 7, 2, 9, 8 depending on how they ask for it).
  • Given an input string of the following formats, write a program that calculates the answer - For example, "4 + 2", "12 / 3", or "2*6". Note that some have spaces and some do not.
  • Or, the above problem with multiple operations taking into account operator preference - For example, "4+2*6/2-3". You would have to look ahead to make sure that the next operator(s) don't take precedence over the current one such that you don't add 4 to the 2 before multiplying it by 6 and then dividing it by 2.
  • And, probably worst of all, given an input of the form "4plus2times6divided by2minus3", find the answer.

Oh, I see. Sounds reasonable.

For your first example, do you mean a String that contains only integers i.e. "123" then I must convert the string into an integer?

And the last two examples looks pretty difficult. I am going to attempt them now. Thanks a bunch!
 
Robben said:
For your first example, do you mean a String that contains only integers i.e. "123" then I must convert the string into an integer?
Yes. It's unlikely that they would ask for something this easy unless they want you to include proper error handling also. Error handling in this case would probably be to recognize that it isn't a proper number and ask the user to try again (or enter 'q' to quit). Of course you should try to implement error handling in whatever you code for the test.
 
  • Like
Likes   Reactions: Robben
Borg said:
Yes. It's unlikely that they would ask for something this easy unless they want you to include proper error handling also. Error handling in this case would probably be to recognize that it isn't a proper number and ask the user to try again (or enter 'q' to quit). Of course you should try to implement error handling in whatever you code for the test.
By error handling would an if and else statement suffice or would I have to use a try and catch block?
 
  • #10
Robben said:
By error handling would an if and else statement suffice or would I have to use a try and catch block?
For that example, I would put a try catch block within a loop. Something like this:
Java:
Integer finalValue = null;
boolean validValue = false;
while(!validValue) {
    try {
        // Get user input
        // Check for 'q' and quit if that's the case
        // Otherwise attempt to convert input to int
        // If it doesn't throw an error...
        validValue = true;
    }
    catch(Exception e){
        // Display error message
    } 
}
// Display output
 
  • Like
Likes   Reactions: Robben
  • #11
Thank you very much!
 
  • Like
Likes   Reactions: Borg

Similar threads

Replies
8
Views
3K
Replies
1
Views
2K
Replies
86
Views
3K
  • · Replies 14 ·
Replies
14
Views
6K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
3
Views
4K
Replies
1
Views
1K
  • · Replies 3 ·
Replies
3
Views
7K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 10 ·
Replies
10
Views
2K