Pergunta de entrevista da empresa Santander

1. Is Groovy compiled or interpreted? 2. How do you stop a cron job? 3. What is the difference between Java and Groovy? 4. What is the difference between UNION and UNION ALL in SQL? 5. What are the types of SQL joins? 6. What is the difference between Heap and Stack memory? 7. What is the Singleton pattern? 8. 8. How would you implement a method sum(x, y) without using built-in operations or the '+' operator?

Resposta da entrevista

Sigiloso

27 de out. de 2025

1.-Groovy is compiled. Although it behaves like an interpreter at runtime, it must first be compiled into JVM bytecode in order to run on the Java Virtual Machine. 2.- In UNIX systems, you can use systemctl, which manages asynchronous processes (including cron daemons). The solution is simply to stop or disable the job’s service using commands like systemctl stop or systemctl disable. 3. Java supports multiple programming paradigms such as object-oriented, functional, and imperative programming. Groovy, on the other hand, focuses primarily on the imperative paradigm and is often used as a scripting language for the JVM. 4. UNION combines the results of two queries and removes duplicate rows. UNION ALL also combines results, but it keeps all duplicates. 5. INNER JOIN: Returns only rows that have matching values in both tables. LEFT JOIN (LEFT OUTER JOIN): Returns all rows from the left table and the matched rows from the right table. RIGHT JOIN (RIGHT OUTER JOIN): Returns all rows from the right table and the matched rows from the left table. FULL JOIN (FULL OUTER JOIN): Returns all rows when there is a match in one of the tables. SELF JOIN: A table is joined with itself to compare rows within the same table. The Heap is used for dynamic memory allocation where data structures such as Lists, Arrays, Trees, and HashMaps are stored. The Stack holds references to variables and objects created during the execution of a program and manages function calls and local variables. 7. It’s a creational design pattern that ensures a class has only one instance throughout the application. Traditionally, it’s implemented using a private constructor and a static instance method. In modern approaches, a final keyword can be used to ensure immutability and a single shared instance. One efficient way is to use bitwise operations, converting numbers to their binary representation and summing bits manually using bit manipulation (XOR and AND with shifts). Alternatively, a simpler approach is using a for loop, starting from x and incrementing it (x++) a total of y times.