Pergunta de entrevista da empresa iCIMS

Onsite interview 1: A paper test, questions including Java syntax, SQL, JavaScript, code review. Java syntax question is: given a method: int exchange(int a), we need: if a == 1 return 2, if a == 2 return 1. Give 4 methods to implement the method, "if" statement cannot be used. SQL question was about nested queries and aggregation. JavaScript question was to write a JavaScript function, when a radiobox is checked then alert sth. Code review question is an implementation of tree level traverse algorithm, lot of errors.

Respostas da entrevista

Sigiloso

21 de jan. de 2014

can be done using ternary operator int result = (input == 1) ? 2 : 1 ; return result ;

2

Sigiloso

31 de jan. de 2014

3. // using switch switch(input): case 1: return 2; case 2: return 1; 4. return (input%2)+1;

2

Sigiloso

20 de abr. de 2014

// using bit operation // Assumption is input is always either 1 or 2 int fun(int a) { int x = a & 1; return x+1; }

Sigiloso

6 de mai. de 2014

return a^3;

Sigiloso

26 de out. de 2013

{if a == 1 return 2, if a == 2 return 1} --> { return -i + 3 }

2