This is a sample Q&A given by a technical interview for a software developer intern for an AI/ML role.

**1. Describe polymorphism using Java classes as an example.**

Polymorphism describes the ability of an object to take on many forms. Objects of different type can be accessed with the same interface, but with its own separate implementations. In Java, there are two types of polymorphism, namely static and dynamic polymorphism.

For static polymorphism, multiple methods are used with the same name but with different parameters (method overloading). The parameters allow the compiler to identify which method has to be called and bind it to the method call.

For dynamic polymorphism, the compiler does not determine the executed method, the Java Virtual Machine (JVM) does that at runtime. Using an inheritance hierarchy, a subclass overrides a method of its superclass, changing the method’s behaviour. In this way, the methods of the super- and subclass share the same name and parameters but provide different functionality.

Links: OOP Concepts for Beginners: What is Polymorphism

**2. Explain what is a promise in Javascript and how does it work?**

A promise is an object that may produce a single value some time in the future, given it is resolved or not. A promise is an object which can be returned synchronously (execute one thing at a time) from an asynchronous function (execute multiple things at a time). A promise can be in one of the 3 possible states: fulfilled, rejected or pending. Callbacks can be used to handle the fulfilled value or the reason for the rejection.

A promise can be implemented with the following code

`let firstPromise = new Promise((resolve, reject) => { // resolve(value) when promise is successful`

// reject(failed) when the promise has failed } firstPromise.then((successMsg) => { // do something when promise is fulfilled }).catch( // Error )

Links: MDN Docs, Async/Await: The Hero JavaScript Deserved, Javascript Promises for Dummies

**3. What is REST API?**

The REST API design (Representational State Transfer) is a set of rules to determine what an API looks like. One rule states that you should be able to get data when you link to a specific URL. Each URL is called a request while the data sent back to you is called a response. A request is made up of four things, which are the endpoint, method, headers and the data. The endpoint is the URL path you are requesting it from. There are five methods, GET, POST, PUT, PATCH, DELETE, which provide meaning for the request that you are making. The header is the information provided to both the client and the server, working as the authentication and providing of information about the body. The data contains information you want to send to the server.

Links: Understanding and using REST APIs

**4. Say you have a large number, a factorial between 1 and 1000000, how do you efficiently get the largest prime factor of the factorial?**

The square root of the value of the factorial is greater than 3! will always be larger than its largest prime factor.

Take, for example,

4! = 24, Sqrt(24) = 4.898,

5! = 120, Sqrt(120) = 10.95445

6! = 720, Sqrt(720) = 25.8328

Therefore, one can logarithmically reduce the search space to find the largest prime factor of the factorial. (Assuming the boundary value can be found by taking the root of a certain value – Cube root boundary value is > 5!)

*Comments: Does not have a hard empirical prove*

** 5. What is Microsoft Access and why is it popular?**

Microsoft Access is an information management tool to store information for reference, reporting and analysis. Microsoft Access uses a relational database which creates connections between different things. This has an advantage over Microsoft Excel as there would be fewer errors and inconsistencies in values, greater productivity by reducing record changes, improved security and control through encryption of database, and better decision and insights by reporting and analyzing data in the database. Data entry forms can also be used to store information and create reports with the data.

Microsoft access is popular as it allows for developers to create a simple database quickly and use a wider range of functionality without intense technical knowledge. The timesaving allows for business requirements to be met sooner, with lesser expenditure, by more people.

Link: What is Microsoft Access Used For?, WHY IS MICROSOFT ACCESS SO POPULAR?

** 6. Explain how SVM works**

Support Vector Machine (SVM) maps data to a high dimensional feature space so that data points can be categorized, even when the data are not otherwise linearly separable. In a two dimensional space, this hyperplane is a line dividing the plane into two parts wherein each class lay in either side

There are three tuning parameters, kernel, regularization, gamma, and margin. The kernel function is the mathematical function used to take data as its input and transform it into the required form. Kernel functions can be of different types such as linear, nonlinear, polynomial, radial basis function, and sigmoid. Regularization parameter is the optimization to choose a smaller margin hyperplane to avoid misclassifying each training example. Gamma parameter defines how far the influence of points which are located away from the separation line is considered in the calculation for the separation line. Margin is the separation of the line to the closest class point, where a good margin allows the points to be in their respective class without crossing to other class.

Link: Support Vector Machine (Theory), kernel Functions-Introduction to SVM Kernel & Examples

** 7. What is decision variables?**

A decision variable is a quantity that the decision-maker controls. For instance, in an optimization model for labour scheduling, the number of nurses to employ in the morning may be a decision variable. A range of values is defined for the decision variable by setting the lower and upper bound of the variable. In the above example, the lower bound is the minimum number of nurse required to be employed and the upper bound is the total number of nurse available.

Link: Defining decision variables

** 8. Can you prove Pythagoras theorem using the dot product of vectors**

x, y are perpendicular if and only if x⋅y=0

|x+y|² = (x + y)⋅(x + y) = (x⋅x) + (x⋅y) + (y⋅x) + (y⋅y)

The middle two terms are zero if and only if x, y are perpendicular

So, |x+y|² = (x⋅x) + (y⋅y) =|x|² + |y|² if and only if x, y are perpendicular.

Link: How to prove the Pythagoras theorem using vectors

** 9. How does the heuristic function help to reduce the search space for an AI**

The heuristic function helps to inform the search about the direction to a goal. It provides information to guess which neighbour of a node will lead to a goal. Heuristic algorithms are used in AI to get a computer to find an approximate solution instead of an exact solution.

A heuristic function takes a look at the search algorithm at each branching step by evaluating the information available and make a decision on which branch to follow by ranking alternatives.

Link: Heuristic Search, What is Heuristic Search – Techniques & Hill Climbing in AI

** 10. What are features in machine learning?**

A feature is a measurable property of the object which you are trying to analyze. For datasets, features appear as columns.

Link: Feature Variables