Ml Engineer Interview Questions

1,795 ml engineer interview questions shared by candidates

1. Quick self introduction 2. Python assessment (you have to tell, without using IDE or AI, what will be printed for each exercise): # Exercise 1 my_str = "ABCDEFGH" print(my_str[1:3] + my_str[5:7]) # Exercise 2 import numpy as np a_1 = [1, 4] a_2 = [2, 5] dot = np.dot(a_1, a_2) print(dot) # Exercise 3 def func(a: int, b: int) -> int: return a + b try: result = func(1, "a") print(result, sep=" ") except: print("1b", sep=" ") finally: print("1c", sep=" ") # Exercise 4 def func(name): name = "A" name = "B" func(name) print(name) # Exercise 5 nums = range(1, 6) nums_modified = [x ** 2 for x in nums if x % 2 == 0] print(sum(nums_modified))
avatar

ML Engineer

Interviewed at Sonar

3
Nov 19, 2025

1. Quick self introduction 2. Python assessment (you have to tell, without using IDE or AI, what will be printed for each exercise): # Exercise 1 my_str = "ABCDEFGH" print(my_str[1:3] + my_str[5:7]) # Exercise 2 import numpy as np a_1 = [1, 4] a_2 = [2, 5] dot = np.dot(a_1, a_2) print(dot) # Exercise 3 def func(a: int, b: int) -> int: return a + b try: result = func(1, "a") print(result, sep=" ") except: print("1b", sep=" ") finally: print("1c", sep=" ") # Exercise 4 def func(name): name = "A" name = "B" func(name) print(name) # Exercise 5 nums = range(1, 6) nums_modified = [x ** 2 for x in nums if x % 2 == 0] print(sum(nums_modified))

Coding: You are given an integer array parent representing a forest of rooted trees with n nodes, where parent[i] is the parent of the i-th node. If parent[i] == i, then node i is the root of a tree. Otherwise, parent[i] < i, meaning that the parent always has a smaller index. Every node has exactly one parent, except the root. You are also given an integer nodeToDelete, representing a node to delete. Your task is to delete nodeToDelete and all of its descendants from the forest. Deletion is done in-place by setting parent[x] = -1 for every deleted node x. Return the updated parent array.
avatar

ML Engineer

Interviewed at Pinterest

3.6
Sep 30, 2025

Coding: You are given an integer array parent representing a forest of rooted trees with n nodes, where parent[i] is the parent of the i-th node. If parent[i] == i, then node i is the root of a tree. Otherwise, parent[i] < i, meaning that the parent always has a smaller index. Every node has exactly one parent, except the root. You are also given an integer nodeToDelete, representing a node to delete. Your task is to delete nodeToDelete and all of its descendants from the forest. Deletion is done in-place by setting parent[x] = -1 for every deleted node x. Return the updated parent array.

Viewing 731 - 740 interview questions

Glassdoor has 1,795 interview questions and reports from Ml engineer interviews. Prepare for your interview. Get hired. Love your job.