Siemens interview prep
4 practice questions on the topics candidates reported from Siemens interviews, with answers. The questions are ours; each one links to the interview report that names its topic.
Practise them as a timed round5 roles open at Siemens Healthineers
Java 3
-
Does Java support multiple inheritance?
- Yes, a class can extend several classes
- No, and a class can implement only one interface
- Not of classes: a class extends one class, but it can implement several interfaces
- Only abstract classes can extend several classes
Show the answer
C. Not of classes: a class extends one class, but it can implement several interfaces
Java avoids the diamond problem for state by allowing a single superclass. Interfaces give multiple inheritance of type; if two default methods clash, the class must override the method.
This topic is named in a candidate’s interview report: PLM software developer on-campus interview, 2019, on GeeksforGeeks.
-
What does the Java compiler, javac, produce from a .java file?
- Bytecode in .class files, which the JVM interprets or compiles to machine code at run time
- Native machine code for the current CPU only
- C++ source code
- An .exe that runs without a JVM
Show the answer
A. Bytecode in .class files, which the JVM interprets or compiles to machine code at run time
Bytecode is the same on every platform, which is how compiled Java runs anywhere a JVM exists. The JVM's just-in-time compiler turns frequently run bytecode into fast machine code.
This topic is named in a candidate’s interview report: PLM software developer on-campus interview, 2019, on GeeksforGeeks.
-
Which statement about Java compared with C++ is true?
- Java has pointer arithmetic and manual delete, like C++
- Java frees memory with a garbage collector and has no pointer arithmetic; C++ manages memory by hand or through destructors and smart pointers
- C++ runs on a virtual machine and Java compiles to native code
- Java allows a class to extend several classes, C++ does not
Show the answer
B. Java frees memory with a garbage collector and has no pointer arithmetic; C++ manages memory by hand or through destructors and smart pointers
Java references cannot be incremented or pointed at arbitrary memory, and objects are reclaimed by the GC. C++ gives direct control, including multiple inheritance of classes, at the cost of managing lifetimes.
This topic is named in a candidate’s interview report: PLM software developer on-campus interview, 2019, on GeeksforGeeks.
Aptitude 1
-
Three switches outside a closed room control three bulbs inside, one each. You may flip switches as you like but enter the room only once. How do you tell which switch controls which bulb?
- Turn all three on, then enter
- Turn switch 1 on for a few minutes, turn it off, turn switch 2 on, then enter: the lit bulb is 2, the warm unlit bulb is 1, the cold unlit bulb is 3
- It cannot be done with one visit
- Turn switches 1 and 2 on, then enter: the brighter bulb is 1
Show the answer
B. Turn switch 1 on for a few minutes, turn it off, turn switch 2 on, then enter: the lit bulb is 2, the warm unlit bulb is 1, the cold unlit bulb is 3
A bulb has two observable properties, on or off and warm or cold, giving enough states to tell three switches apart in one visit.
This topic is named in a candidate’s interview report: PLM software developer on-campus interview, 2019, on GeeksforGeeks.