IC2 Software Engineer Interview at ServiceNow - R2
Anonymous User
1276

✅ Round: 2 (Techncal)

📌 Format:

  • 1:1 live video call (60 minutes)
  • Focus on practical logic, Java/JS theory, and real-world application
  • Covered both backend (Java) and frontend (JavaScript)

🔸 1. T9 Mobile Keypad Decoding Problem

Problem: Given a T9-style string (like on feature phones), decode it using custom logic.

🧠 Rule:

  • If the current character is the starting character of a T9 group (e.g., 'a', 'd', 'g', 'p'),
  • Then previous character is finalized → print it.

🧪 Examples:

  • "aback" → "cat"
  • "pp" → "pp"
  • "abcd" → "ad"
  • "pqrsatm" → "sam"
  • "ppqrammnod" → "pramod"

✅ Solution:

function decodeT9Input(input) {
  const t9Groups = {
    '2': 'abc', '3': 'def', '4': 'ghi',
    '5': 'jkl', '6': 'mno', '7': 'pqrs',
    '8': 'tuv', '9': 'wxyz'
  };

  const startingChars = new Set();
  for (let key in t9Groups) {
    startingChars.add(t9Groups[key][0]);
  }

  let result = '';
  for (let i = 1; i < input.length; i++) {
    if (startingChars.has(input[i])) {
      result += input[i - 1];
    }
  }

  return result;
}

🔸 2. Palindrome Number (No Built-in Reverse)

Problem: Check if a number is a palindrome, without using .reverse() or string helpers.

✅ Solution:

function isPalindrome(num) {
  let original = num;
  let reversed = 0;
  while (num > 0) {
    reversed = reversed * 10 + num % 10;
    num = Math.floor(num / 10);
  }
  return original === reversed;
}

🧠 Optimized One-Liner:

function isPalindrome(n, r = 0) {
  for (let x = n; x; x = ~~(x / 10)) r = r * 10 + x % 10;
  return n === r;
}

🔸 3. Palindrome (Handles String & Number)

Unified version that handles both strings and numbers:

function isPalindrome(input) {
  const str = input.toString();
  let left = 0, right = str.length - 1;
  while (left < right) {
    if (str[left++] !== str[right--]) return false;
  }
  return true;
}

🔸 4. Java 7 vs Java 8 – Interface vs Abstract Class

Q: Java 8 allows default methods in interfaces — so do we still need abstract classes?

✅ Answer:

  • Yes, abstract classes are still needed for:

    • Constructors
    • Shared state (instance variables)
    • Access modifiers like protected/private
  • Use interface when multiple inheritance or contracts are needed.

  • Use abstract class when common base logic or shared config is needed.

🧠 My real-world answer:

“I used interfaces for extensibility in platform components and abstract classes for shared behavior like audit logging and retry logic.”


🔸 5. JavaScript Callback Function (Namaste JS Style)

Q: What is a callback?

✅ Answer:

  • A callback is a function passed as an argument to another function, to be executed later.

  • Commonly used in:

    • Event handlers
    • Async flows (setTimeout, APIs)
  • In real projects, I used it to handle fetch results or execute steps after background jobs.


🔸 6. Technologies Used in ServiceNow (Real-world Stack)

✅ Answer:

  • Backend: Java, Glide APIs, Business Rules, Flow Designer
  • Frontend: React (Now UI), AngularJS (legacy), UI Builder
  • Database: MySQL (MariaDB)
  • Integration: Scripted REST APIs, MID Server, IntegrationHub
  • Cloud Infra: Hosted on AWS, with Docker/K8s used internally for newer services

✅ Final Notes:

Got the call for HM Round -> Link

Comments (0)