Specialist Programmer

50+ Specialist Programmer Interview Questions and Answers

Updated 20 Nov 2024

Q1. 1. Find the first occurrence of the target value in a sorted array. (Duplicates are allowed)

Ans.

Find the first occurrence of target value in a sorted array with duplicates.

  • Use binary search to find the target value.

  • If found, check if the previous element is also the target value.

  • If not, return the index of the target value.

  • If yes, continue binary search on the left subarray.

Q2. 2. Find the maximum subarray sum given an array with positive and negative integers.

Ans.

Find the maximum subarray sum in an array with positive and negative integers.

  • Use Kadane's algorithm to find the maximum subarray sum.

  • Initialize two variables, one for current maximum and one for global maximum.

  • Iterate through the array and update the variables accordingly.

  • Return the global maximum.

  • Example: [-2, 1, -3, 4, -1, 2, 1, -5, 4] returns 6 (subarray [4, -1, 2, 1])

Specialist Programmer Interview Questions and Answers for Freshers

illustration image

Q3. Which are the process scheduling algorithms and explain each algorithm.

Ans.

Process scheduling algorithms determine the order in which processes are executed by the CPU.

  • First Come First Serve (FCFS) - Processes are executed in the order they arrive.

  • Shortest Job Next (SJN) - Process with the shortest burst time is executed next.

  • Round Robin (RR) - Each process is assigned a fixed time slice for execution.

  • Priority Scheduling - Processes are executed based on priority levels assigned to them.

  • Multi-Level Queue Scheduling - Processes are divided into diffe...read more

Q4. What is deadlock in OS & how it overcome?

Ans.

Deadlock in OS occurs when two or more processes are unable to proceed because each is waiting for the other to release a resource.

  • Deadlock happens when processes have acquired resources but are waiting for additional resources that are held by other processes.

  • Four conditions must hold for deadlock to occur: mutual exclusion, hold and wait, no preemption, and circular wait.

  • Deadlock can be prevented by using techniques like resource allocation graphs, deadlock detection algori...read more

Are these interview questions helpful?

Q5. Write a SQL query to print n'th highest salary with full details

Ans.

SQL query to retrieve the n'th highest salary with full details

  • Use the ORDER BY clause to sort salaries in descending order

  • Use the LIMIT clause to retrieve the n'th highest salary

  • Join with the employee table to get full details

Q6. What are the joins in DBMS and explain each join

Ans.

Joins in DBMS are used to combine rows from two or more tables based on a related column between them.

  • Inner Join: Returns rows when there is at least one match in both tables.

  • Left Join: Returns all rows from the left table and the matched rows from the right table.

  • Right Join: Returns all rows from the right table and the matched rows from the left table.

  • Full Outer Join: Returns rows when there is a match in one of the tables.

  • Self Join: Joining a table with itself to combine r...read more

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

Q7. What is inheritance and explain each type

Ans.

Inheritance is a concept in object-oriented programming where a class inherits properties and behaviors from another class.

  • Types of inheritance: single inheritance, multiple inheritance, multilevel inheritance, hierarchical inheritance, hybrid inheritance

  • Single inheritance: a class inherits from only one base class

  • Multiple inheritance: a class inherits from multiple base classes

  • Multilevel inheritance: a class inherits from a class which in turn inherits from another class

  • Hier...read more

Q8. Design a path for visiting all popular places of your city.

Ans.

Design a path for visiting all popular places of your city.

  • Identify all popular places in the city

  • Group them based on their proximity to each other

  • Create a route that covers all groups in an efficient manner

  • Consider transportation options and time of day

  • Include breaks for meals and rest

  • Test the route to ensure it is feasible and enjoyable

Specialist Programmer Jobs

Power Programmer - Specialist Programmer .NET Full Stack 3-8 years
Infosys Limited
3.7
Bangalore / Bengaluru
Power Programmer - Specialist Programmer Data Engineering 3-8 years
Infosys Limited
3.7
Bangalore / Bengaluru
Power Programmer - Specialist Programmer Java Full Stack 3-8 years
Infosys Limited
3.7
Bangalore / Bengaluru

Q9. What are late binding and early binding?

Ans.

Late binding and early binding are concepts in programming related to when the binding of a method to its implementation occurs.

  • Early binding refers to the process of linking a method call to the method implementation at compile time.

  • Late binding refers to the process of linking a method call to the method implementation at runtime.

  • Early binding is also known as static binding, while late binding is also known as dynamic binding.

  • Late binding allows for more flexibility and ex...read more

Q10. Memory sorting Code with given 3 RAMs and quantity of data present in them.

Ans.

Sorting code for given 3 RAMs and data quantity

  • Determine the size of each RAM and the quantity of data in them

  • Choose a sorting algorithm based on the size of data and available RAM

  • Divide the data into chunks that can fit into the available RAM

  • Sort each chunk using the chosen algorithm

  • Merge the sorted chunks into a single sorted list

Q11. Write a code to convert camel casing to snake casing and vice versa.

Ans.

Code to convert camel casing to snake casing and vice versa.

  • For camel to snake case, iterate through the string and add '_' before every uppercase letter except the first one.

  • For snake to camel case, iterate through the string and remove '_' and capitalize the letter after it.

  • Handle edge cases like consecutive uppercase letters or underscores in the input string.

  • Use built-in string functions like split(), join(), and replace() for efficient implementation.

Q12. What are three drawbacks of pandas, what are middleware, CDNs etc

Ans.

Three drawbacks of pandas are performance issues with large datasets, limited visualization capabilities, and lack of built-in support for time series analysis.

  • Performance can be slow with large datasets due to pandas being memory intensive

  • Limited visualization capabilities compared to tools like Matplotlib or Seaborn

  • Lack of built-in support for time series analysis, requiring additional libraries like Statsmodels or Prophet

Q13. Design a promise wrapper that accepts two parameters - a promise function and integer timeout value. If the promise function resolve before timeout, resolve it else reject it.

Ans.

Design a promise wrapper with timeout for resolving or rejecting a promise function.

  • Create a function that takes a promise function and timeout value as parameters.

  • Inside the function, create a new Promise that wraps the original promise function.

  • Use Promise.race to race between the original promise and a timeout promise.

  • If the original promise resolves before timeout, resolve the wrapper promise with the result.

  • If the original promise rejects or the timeout occurs first, rej...read more

Q14. Write a program to print frequencies of elementsof an array.

Ans.

Program to print frequencies of elements in an array.

  • Create a dictionary to store the frequency of each element.

  • Iterate through the array and update the frequency in the dictionary.

  • Print the dictionary to display the frequency of each element.

Q15. Swap two numbers without using third variable?

Ans.

To swap two numbers without using third variable, use arithmetic operations.

  • Add the two numbers and store the result in the first variable.

  • Subtract the second variable from the sum and store the result in the second variable.

  • Subtract the second variable from the original sum and store the result in the first variable.

Q16. What is difference between javascript and typescript

Ans.

JavaScript is a dynamic scripting language, while TypeScript is a statically typed superset of JavaScript.

  • JavaScript is dynamically typed, while TypeScript is statically typed.

  • TypeScript supports type checking at compile time, while JavaScript does not.

  • TypeScript allows for the use of interfaces and advanced OOP features, while JavaScript does not.

  • TypeScript code needs to be transpiled to JavaScript before it can be executed in a browser.

Q17. Frequency of elements in an array

Ans.

Count the frequency of elements in an array.

  • Iterate through the array and use a hash table to keep track of the frequency of each element.

  • Alternatively, use a dictionary in Python or a map in C++ to achieve the same result.

  • If the array is sorted, you can use binary search to find the first and last occurrence of each element and calculate the frequency.

  • Time complexity can be improved to O(n) using a modified counting sort algorithm.

Q18. Search an element in sorted 2d matrix.

Ans.

Search an element in sorted 2d matrix.

  • Start from the top right corner or bottom left corner and move towards the target element

  • If the current element is greater than target, move left. If it's smaller, move down

  • Repeat until target is found or all elements are traversed

Q19. Given a list of natural numbers, find the largest increasing subsequence from it

Ans.

Find the largest increasing subsequence from a list of natural numbers

  • Use dynamic programming to keep track of the longest increasing subsequence ending at each index

  • Iterate through the list and update the longest increasing subsequence for each element

  • Return the maximum length of the increasing subsequence

Q20. What is normalization? Explain with an example.

Ans.

Normalization is the process of organizing data in a database to reduce redundancy and improve data integrity.

  • Normalization involves breaking down data into smaller, more manageable tables and establishing relationships between them.

  • It helps in reducing data redundancy and inconsistencies.

  • There are different normal forms such as 1NF, 2NF, 3NF, BCNF, and 4NF.

  • For example, in a database of students and courses, instead of storing all student details in the same table as course d...read more

Q21. Pros and cons of Monolith and microservice architecture.

Ans.

Monolith vs microservice architecture pros and cons

  • Monolith: easier to develop and test, simpler deployment process

  • Monolith: can be harder to scale and maintain as it grows

  • Microservices: scalable and flexible, easier to update and maintain

  • Microservices: complex to develop and deploy, requires more monitoring and management

  • Example: Monolith - traditional web applications, Example: Microservices - Netflix, Amazon

Q22. What is immutability in Python?

Ans.

Immutability in Python refers to the property of objects that cannot be changed after creation.

  • Immutable objects cannot be modified once created

  • Immutable objects include numbers, strings, and tuples

  • Immutable objects are useful for caching and as dictionary keys

Q23. Compare time complexityand space complexity of array list and linked list

Ans.

Array list has O(1) time complexity for accessing elements but O(n) for insertion/deletion, while linked list has O(n) time complexity for accessing elements but O(1) for insertion/deletion.

  • Array list has constant time complexity O(1) for accessing elements by index, but linear time complexity O(n) for insertion/deletion operations due to shifting elements.

  • Linked list has linear time complexity O(n) for accessing elements as it requires traversing from the head node, but cons...read more

Q24. Write a code to find next palindrome in O(1)

Ans.

Code to find next palindrome in O(1)

  • Check if the number is already a palindrome, if yes then add 1 to it

  • If the number is not a palindrome, split it into two halves and reverse the first half

  • If the reversed first half is greater than the second half, append the first half to the second half

  • If the reversed first half is less than or equal to the second half, increment the first half and append it to the second half

Q25. Define BSTs and their difference from normal Binary Trees

Ans.

BSTs are binary trees where each node has a value greater than all nodes in its left subtree and less than all nodes in its right subtree.

  • BSTs are binary trees where each node has a value greater than all nodes in its left subtree and less than all nodes in its right subtree.

  • BSTs allow for efficient searching, insertion, and deletion of elements compared to normal binary trees.

  • Example: In a BST, the left subtree of a node contains only nodes with values less than the node's v...read more

Q26. What do you undertsnand by subnetting?

Ans.

Subnetting is the process of dividing a network into smaller subnetworks to improve performance and security.

  • Subnetting helps in optimizing network traffic by breaking a large network into smaller, more manageable subnetworks.

  • It allows for better organization and management of IP addresses within a network.

  • Subnetting also enhances network security by creating boundaries between different segments of a network.

  • Example: Dividing a network with IP address range 192.168.1.0/24 in...read more

Q27. Explain Precision and Recall with real world examples

Ans.

Precision measures the accuracy of positive predictions, while recall measures the ability to find all positive instances.

  • Precision = TP / (TP + FP)

  • Recall = TP / (TP + FN)

  • Example: In spam email detection, precision is the ratio of correctly classified spam emails to all emails classified as spam.

  • Example: In disease diagnosis, recall is the ratio of correctly identified positive cases to all actual positive cases.

Q28. Find the largest subarray with equal character frequency

Ans.

Find the largest subarray with equal character frequency in an array of strings.

  • Iterate through each string in the array and calculate the frequency of each character.

  • Store the frequency of characters in a hashmap.

  • Keep track of the starting and ending indices of the subarray with equal character frequency.

  • Return the largest subarray with equal character frequency.

Q29. What is stack data structure?

Ans.

Stack is a linear data structure that follows Last In First Out (LIFO) principle.

  • Elements are added and removed from the top of the stack.

  • Push operation adds an element to the top of the stack.

  • Pop operation removes the top element from the stack.

  • Peek operation returns the top element without removing it.

  • Examples: function call stack, undo-redo operations in text editors.

Q30. What is mutable objects in python

Ans.

Mutable objects in Python are objects whose value can be changed after creation.

  • Lists, dictionaries, and sets are examples of mutable objects in Python.

  • Changes made to mutable objects directly affect the original object.

  • Mutable objects can be modified in place using methods like append(), update(), and remove().

Q31. DB design regarding ticket booking of airways

Ans.

Design a database for airways ticket booking system

  • Create tables for flights, passengers, bookings, and seats

  • Use foreign keys to establish relationships between tables

  • Include attributes like flight number, passenger name, seat number, etc.

  • Implement constraints to ensure data integrity

  • Consider indexing for faster retrieval of data

Q32. Implement phone directory using Data structures

Ans.

Phone directory can be implemented using an array of strings.

  • Use an array of strings to store phone numbers with corresponding names

  • Implement functions to add, delete, search, and display entries in the phone directory

  • Consider using a hash table for faster search operations

Q33. Find first non repeating character in string

Ans.

Use a hashmap to store the frequency of each character and then iterate through the string to find the first non-repeating character.

  • Create a hashmap to store the frequency of each character in the string.

  • Iterate through the string and update the frequency in the hashmap.

  • Iterate through the string again and return the first character with frequency 1.

Q34. Minimum subarray sum with some edge cases

Ans.

Find the minimum sum of a subarray within an array of integers.

  • Use Kadane's algorithm to find the minimum subarray sum efficiently.

  • Consider edge cases like all negative numbers or all positive numbers.

  • Handle cases where the array is empty or has only one element.

Q35. Swap the number without third variable

Ans.

Swapping numbers without using a third variable

  • Use bitwise XOR operation to swap two numbers without using a third variable

  • Example: a = 5, b = 10. a = a XOR b, b = a XOR b, a = a XOR b. Now a = 10, b = 5

Q36. Find the closest element in a sorted array

Ans.

Find the closest element in a sorted array

  • Use binary search to find the closest element

  • Compare the middle element with the target element

  • Update the search range based on the comparison

Q37. What is Deadlock in OS

Ans.

Deadlock in OS is a situation where two or more processes are unable to proceed because each is waiting for the other to release a resource.

  • Deadlock occurs when processes compete for resources and each process holds a resource while waiting for another resource.

  • Four necessary conditions for deadlock are mutual exclusion, hold and wait, no preemption, and circular wait.

  • Example: Process A holds Resource 1 and waits for Resource 2, while Process B holds Resource 2 and waits for ...read more

Q38. What is Deadlock mechanism?

Ans.

Deadlock mechanism is a situation in which two or more processes are unable to proceed because each is waiting for the other to release a resource.

  • Deadlock occurs when two or more processes are waiting indefinitely for an event that can only be caused by one of the waiting processes.

  • Four necessary conditions for deadlock are mutual exclusion, hold and wait, no preemption, and circular wait.

  • Example: Process A holds Resource 1 and waits for Resource 2, while Process B holds Res...read more

Q39. What is Machine Learning?

Ans.

Machine Learning is a branch of artificial intelligence that involves developing algorithms and statistical models to enable computers to learn from and make predictions or decisions based on data.

  • Machine Learning involves training algorithms to learn patterns from data and make predictions or decisions without being explicitly programmed.

  • It is used in various applications such as image recognition, natural language processing, recommendation systems, and autonomous vehicles....read more

Frequently asked in,

Q40. What is regression analysis?

Ans.

Regression analysis is a statistical method used to examine the relationship between one dependent variable and one or more independent variables.

  • It helps in predicting the value of the dependent variable based on the values of independent variables.

  • There are different types of regression analysis such as linear regression, logistic regression, polynomial regression, etc.

  • It is commonly used in various fields like economics, finance, marketing, and social sciences.

  • Example: Pre...read more

Q41. Detect and remove loop in linked list

Ans.

Use Floyd's Tortoise and Hare algorithm to detect and remove loop in linked list.

  • Use two pointers, slow and fast, to detect a loop in the linked list.

  • If there is a loop, move slow pointer to the head and then move both pointers one step at a time until they meet at the loop start.

  • Set the next pointer of the node where they meet to null to remove the loop.

Q42. Find repeated number in an array

Ans.

Iterate through array and use a hashmap to find repeated numbers

  • Iterate through the array and store each element in a hashmap with its count

  • Check if the count of any element is greater than 1, that element is repeated

Q43. find next greater element in an array

Ans.

Find the next greater element in an array of strings.

  • Iterate through the array and for each element, compare it with the elements to its right to find the next greater element.

  • Use a stack to keep track of elements whose next greater element is yet to be found.

  • If the current element is greater than the top element in the stack, update the next greater element for the top element and pop it from the stack.

  • Continue this process until all elements have their next greater element ...read more

Q44. Invert a binary tree?

Ans.

Inverting a binary tree involves swapping the left and right children of each node recursively.

  • Start at the root node and swap its left and right children

  • Recursively invert the left and right subtrees

  • Repeat the process for each node in the tree

  • Example: Original tree - 1 Inverted tree - 1

  • / \ / \

  • 2 3 3 2

  • / \ / \ / \ / \

  • 4 5 6 7 7 6 5 4

Q45. remove duplicate from sorted array

Ans.

Use two pointers to remove duplicates from a sorted array of strings.

  • Initialize two pointers, one for the current element and one for the next unique element.

  • Compare current element with next element, if same, move next pointer until a different element is found.

  • Replace duplicate elements with unique elements found by next pointer.

Q46. Iterative traversal of binary tree

Ans.

Iterative traversal of binary tree involves visiting each node in a systematic way without using recursion.

  • Use a stack to keep track of nodes to visit

  • Start with the root node and push it onto the stack

  • While the stack is not empty, pop a node, visit it, and push its children onto the stack

Q47. Reversed a linkedlist

Ans.

Reverse a linked list by changing the next pointers of each node to point to the previous node.

  • Start by initializing three pointers: current, previous, and next.

  • Iterate through the linked list, updating the next pointer of each node to point to the previous node.

  • Update the previous, current, and next pointers accordingly in each iteration.

  • Return the new head of the reversed linked list.

Q48. One problem based on anagram?

Ans.

An anagram is a word or phrase formed by rearranging the letters of a different word or phrase.

  • Create a function that takes in an array of strings as input

  • For each string, sort the characters alphabetically

  • Check if the sorted strings are equal, if so, they are anagrams

Q49. Top view of binary tree

Ans.

Top view of binary tree is the nodes visible when viewed from the topmost node.

  • Top view is the set of nodes visible when viewed from the topmost node

  • Nodes are ordered from left to right

  • Nodes at the same horizontal distance from the root are at the same level

  • Example: For tree with root node A and left child B and right child C, top view is B-A-C

Q50. Array Based DSA problem

Ans.

Implement a data structure using an array of strings

  • Use an array of strings to store and manipulate data

  • Consider using functions to perform operations on the array

  • Examples: storing names, storing messages, storing file paths

1
2
Next
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Interview Questions for Specialist Programmer Related Skills

Interview experiences of popular companies

3.7
 • 7.3k Interviews
3.7
 • 905 Interviews
3.8
 • 492 Interviews
3.3
 • 165 Interviews
View all

Calculate your in-hand salary

Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary

Specialist Programmer Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter