InternDoor

Zensar Technologies interview prep

9 practice questions on the topics candidates reported from Zensar Technologies interviews, with answers. The questions are ours; each one links to the interview report that names its topic.

Practise them as a timed round34 roles open at Zensar Technologies

DSA 1

  1. DSAMedium

    B is the array A = [1, 2, 3] repeated forever: 1, 2, 3, 1, 2, 3, ... Counting from position 1, what is the sum of B from position 2 to position 7?

    1. 11
    2. 13
    3. 12
    4. 14
    Show the answer

    C. 12

    Positions 2 to 7 hold 2, 3, 1, 2, 3, 1, which add to 12. For huge ranges, use prefix sums of A: the sum up to position p is (p / n) full copies times sum(A) plus the prefix of the remaining p mod n elements, and the range is the difference of two such sums, O(1) per query.

    This topic is named in a candidate’s interview report: Junior software engineer on-campus interview, 2021, on Code360.

DBMS and SQL 5

  1. DBMS and SQLMedium

    In a data warehouse, what is a star schema?

    1. A schema where every table references every other table
    2. A fully normalised schema in third normal form
    3. A table with a star (*) in every column
    4. One central fact table of measurements, such as sales, joined to dimension tables such as date, product and store
    Show the answer

    D. One central fact table of measurements, such as sales, joined to dimension tables such as date, product and store

    The fact table holds the numbers and foreign keys; the denormalised dimensions describe them. Queries then need few joins. Normalising the dimensions further gives a snowflake schema.

    This topic is named in a candidate’s interview report: Software developer interview, 2021, on Code360.

  2. DBMS and SQLHard

    Which query returns the third-highest distinct salary in emp without LIMIT or TOP?

    1. SELECT MAX(salary) FROM emp WHERE salary < (SELECT MAX(salary) FROM emp);
    2. SELECT DISTINCT salary FROM emp e1 WHERE 3 = (SELECT COUNT(DISTINCT e2.salary) FROM emp e2 WHERE e2.salary > e1.salary);
    3. SELECT DISTINCT salary FROM emp e1 WHERE 2 = (SELECT COUNT(DISTINCT e2.salary) FROM emp e2 WHERE e2.salary > e1.salary);
    4. SELECT salary FROM emp ORDER BY salary DESC;
    Show the answer

    C. SELECT DISTINCT salary FROM emp e1 WHERE 2 = (SELECT COUNT(DISTINCT e2.salary) FROM emp e2 WHERE e2.salary > e1.salary);

    The correlated subquery counts how many distinct salaries are larger than each row's. The third highest has exactly two above it. Counting 3 above gives the fourth highest, and the MAX below MAX gives the second. With window functions, DENSE_RANK() = 3 says the same thing.

    This topic is named in a candidate’s interview report: Junior software engineer on-campus interview, 2021, on Code360.

  3. DBMS and SQLEasy

    emp has (1, Asha), (2, Ravi), (3, Meena) as (id, name), and pay has (1, 50000) and (3, 42000) as (emp_id, amount). What does this return?

    SELECT e.name, p.amount
    FROM emp e
    LEFT JOIN pay p ON p.emp_id = e.id;
    1. 3 rows, with NULL as Ravi's amount
    2. 2 rows; Ravi is missing
    3. 3 rows, with 0 as Ravi's amount
    4. 6 rows
    Show the answer

    A. 3 rows, with NULL as Ravi's amount

    A LEFT JOIN keeps every row of the left table. Ravi has no pay row, so his amount comes back NULL, not 0. An INNER JOIN would drop him, and COALESCE(p.amount, 0) would show 0 if that is what the report needs.

    This topic is named in a candidate’s interview report: Junior software engineer on-campus interview, 2021, on Code360.

  4. DBMS and SQLEasy

    How does OLAP differ from OLTP?

    1. They are two names for the same workload
    2. OLTP is only for data warehouses
    3. OLAP is always faster than OLTP
    4. OLTP runs many short transactions that insert and update a few rows (orders, payments); OLAP runs fewer, heavy read queries that aggregate history for analysis
    Show the answer

    D. OLTP runs many short transactions that insert and update a few rows (orders, payments); OLAP runs fewer, heavy read queries that aggregate history for analysis

    An OLTP schema is normalised for fast, safe writes. A warehouse for OLAP is usually denormalised into fact and dimension tables (a star schema) so large aggregations read fewer joins, and it is loaded from the OLTP systems by ETL.

    This topic is named in a candidate’s interview report: Software developer interview, 2021, on Code360.

  5. DBMS and SQLMedium

    In a data warehouse, a customer moves city. Which kind of slowly changing dimension keeps the old city for the orders placed before the move?

    1. Type 1: overwrite the city
    2. Type 0: refuse the change
    3. Type 2: close the old row and insert a new row for the customer, with validity dates or a current flag
    4. Delete the customer and insert them again
    Show the answer

    C. Type 2: close the old row and insert a new row for the customer, with validity dates or a current flag

    Type 2 keeps every version as its own row with its own surrogate key, so old facts still point at the old city. Type 1 loses history; Type 3 keeps only a "previous value" column. Type 2 is the usual choice when reports must stay true to the past.

    This topic is named in a candidate’s interview report: Software developer interview, 2021, on Code360.

Machine learning 1

  1. Machine learningMedium

    How does a random forest overfit less than one deep decision tree?

    1. It uses gradient descent to prune the tree
    2. It limits every tree to a depth of one
    3. It averages many trees, each trained on a bootstrap sample and random subsets of features
    4. It trains a single tree on more data
    Show the answer

    C. It averages many trees, each trained on a bootstrap sample and random subsets of features

    Each deep tree overfits in its own way. Training them on different samples and features makes their errors less correlated, and averaging cancels much of the variance.

    This topic is named in a candidate’s interview report: Software developer interview, 2021, on Code360.

Software engineering 2

  1. Software engineeringMedium

    In integration testing, what is the difference between a test stub and a test driver?

    1. They are the same thing
    2. Drivers are only used in black-box testing
    3. A stub is a real module, a driver is a fake one
    4. A stub stands in for a module that the unit under test calls; a driver stands in for the caller and invokes the unit under test
    Show the answer

    D. A stub stands in for a module that the unit under test calls; a driver stands in for the caller and invokes the unit under test

    Top-down integration tests high-level modules first, so missing lower modules are replaced by stubs returning canned answers. Bottom-up integration tests low-level modules first, so a driver feeds them inputs in place of the callers that do not exist yet.

    This topic is named in a candidate’s interview report: Software engineer (testing) interview, 2021, on Code360.

  2. Software engineeringEasy

    What is black-box testing?

    1. Testing that reads every line of the code
    2. Testing done only after release
    3. Testing the behaviour from inputs and expected outputs without looking at the code, using techniques such as equivalence partitioning and boundary values
    4. Testing the hardware only
    Show the answer

    C. Testing the behaviour from inputs and expected outputs without looking at the code, using techniques such as equivalence partitioning and boundary values

    White-box testing designs cases from the code's structure (branches, paths). Black-box testing designs them from the specification, so it catches missing features and wrong behaviour that code-based coverage can miss.

    This topic is named in a candidate’s interview report: Software engineer (testing) interview, 2021, on Code360.

Prep for other employers

All employers
See who is hiring after Zensar Technologies

Engineering internships and entry-level jobs in India, newest first.