---
title: "EXL Interview Questions: Python and SQL"
description: "Here are EXL's interview questions on Python and SQL, including SQL JOINs and Python list manipulation methods."
url: https://srinimf.com/2024/01/22/exl-interview-questions-python-and-sql/
date: 2024-01-22
modified: 2026-10-05
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2024/01/pexels-photo-6953985.jpeg?fit=1880%2C1253&ssl=1
categories: ["Data Science"]
tags: ["coding", "Database", "Interview Questions", "programming", "Python", "sql"]
type: post
lang: en
---

# EXL Interview Questions: Python and SQL

EXL asked questions covering Python and SQL in a recent interview. These on SQL Joins, Rank functions, and Python Lists and functions.

![EXL Python and SQL interview questions](https://i0.wp.com/srinimf.com/wp-content/uploads/2024/01/pexels-photo-5439148.jpeg?resize=1880%2C1253&ssl=1)*Photo by Tima Miroshnichenko on Pexels.com*

Table of contents

1. [SQL interview questions](https://srinimf.com/2024/01/22/exl-interview-questions-python-and-sql/#sql-interview-questions)
2. [Python interview questions](https://srinimf.com/2024/01/22/exl-interview-questions-python-and-sql/#python-interview-questions)

## SQL interview questions

Here are two tables. Table_a and Table_b with data below.

```
Table_a
id
--
1
1
1
1
null

Table_b
id
--
1
1
1
```

**Q.1 Count the output rows for INNER JOIN, LEFT JOIN, FULL JOIN, and RIGHT JOIN?**

```
INNER JOIN
12

LEFT JOIN
13

FULL JOIN
13

RIGHT JOIN
12
```

**Q.2 Add new columns (rank(), dense_rank(), row_number()) in the output of the emp table?**

```
Here, in each query, the rank function has been changed.
SELECT empno, ename, job, mgr, hiredate, sal, comm, deptno,
       RANK() OVER (PARTITION BY hiredate ORDER BY sal) AS salrank
FROM emp
ORDER BY sal;

SELECT empno, ename, job, mgr, hiredate, sal, comm, deptno,
       DENSE_RANK() OVER (PARTITION BY hiredate ORDER BY sal) AS salrank
FROM emp
ORDER BY sal;

SELECT empno, ename, job, mgr, hiredate, sal, comm, deptno,
       ROW_NUMBER() OVER (PARTITION BY hiredate ORDER BY sal) AS salrank
FROM emp
ORDER BY sal;
```

**Q.3 Find employees in each dept where the count of employees is > 2?**

```
SELECT DEPTNO, COUNT(EMPNO) as COUNT_OF_EMP
FROM EMP
GROUP BY DEPTNO
HAVING COUNT(EMPNO) > 2;
```

Output

```
DEPTNO	COUNT_OF_EMP
30	6
10	3
20	5
```

## Python interview questions

**Q.1 Write a method to calculate Squares and Cubes for the given number. Show only Cubes in the output?**

```
#function
def calc(numb):
    sq = numb ** 2
    cu = numb **3
    return sq, cu 

#calling function
squares, cubes = calc(10)

print(cubes)

Output
------
1000

** Process exited - Return Code: 0 **

Press Enter to exit terminal
```

**Q.2 Check each element in a list. If the number is < 100 write to a new list?**

```
a = [ 200, 300, 50, 10, 160]output = []for i in a:
    if i > 100:
        output.append(i)       

print(output)

Result
-------
[200, 300, 160]
** Process exited - Return Code: 0 **

Press Enter to exit terminal
```

**Q.3 Check each element in a list. If it is an integer, continue the loop, else, break the loop?**

```
Method-1
=========
a = [1000, 2000, 3000, "NA"]x = all(isinstance(i, int) for i in a)
if x:
    # Continue with your code here
    pass
else:
    # Break out of the loop or handle the case where not all elements are integers
    print(" all the elements are not int")
Method-2
========
a = [1000, 2000, 3000, "NA"]for i in a:
    if isinstance(i, int):
        pass
    else:
        print("All the elements not the int")
        break
```

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2024%2F01%2F22%2Fexl-interview-questions-python-and-sql%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2024%2F01%2Fpexels-photo-6953985.jpeg%3Ffit%3D1200%252C800%26ssl%3D1&description=EXL%20Interview%20Questions%3A%20Python%20and%20SQL)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2024/01/22/exl-interview-questions-python-and-sql/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2024/01/22/exl-interview-questions-python-and-sql/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2024/01/22/exl-interview-questions-python-and-sql/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2024/01/22/exl-interview-questions-python-and-sql/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20EXL%20Interview%20Questions%3A%20Python%20and%20SQL&body=https%3A%2F%2Fsrinimf.com%2F2024%2F01%2F22%2Fexl-interview-questions-python-and-sql%2F&share=email)
-

### Like this:

Like Loading…
